Package jsky.coords

Examples of jsky.coords.Coordinates


                                 int[] searchCols) {

        if (_rowCoordinates != null) {
            if (region != null) {
                // check if the row coordinates are within the given region
                Coordinates pos = _rowCoordinates.getCoordinates(row);
                if (pos == null || !region.contains(pos)) {
                    return false;    // position not found or not in region
                }
            }
View Full Code Here


     * if known, otherwise return the coordinates of the first row, or null
     * if there are no world coordinates available.
     */
    public WorldCoordinates getWCSCenter() {
        if (_queryArgs != null && _queryArgs.getRegion() != null) {
            Coordinates pos = _queryArgs.getRegion().getCenterPosition();
            if (pos instanceof WorldCoordinates) {
                return (WorldCoordinates) pos;
            }
        }

        int nrows = getRowCount();
        if (nrows != 0) {
            RowCoordinates rowCoordinates = getRowCoordinates();
            if (rowCoordinates != null && rowCoordinates.isWCS()) {
                Vector dataVec = getDataVector();
                Vector rowVec = (Vector) dataVec.get(0);
                Coordinates pos = rowCoordinates.getCoordinates(rowVec);
                if (pos instanceof WorldCoordinates) {
                    return (WorldCoordinates) pos;
                }
            }
        }
View Full Code Here

    private WorldCoords _resolveObjectName(String objectName, Catalog cat) throws IOException {
        QueryArgs queryArgs = new BasicQueryArgs(cat);
        queryArgs.setId(objectName);
        QueryResult r = cat.query(queryArgs);
        if (r instanceof TableQueryResult) {
            Coordinates coords = ((TableQueryResult) r).getCoordinates(0);
            if (coords instanceof WorldCoords)
                return (WorldCoords) coords;
        }
        throw new RuntimeException("Unexpected result from " + cat.toString());
    }
View Full Code Here

     *
     * @param queryArgs (in/out) describes the query arguments
     * @param region (in) describes the query region (center and radius range)
     */
    public void setRegionArgs(QueryArgs queryArgs, CoordinateRadius region) {
        Coordinates coords = region.getCenterPosition();
        RowCoordinates rowCoordinates = _entry.getRowCoordinates();
        String equinoxStr = (String) queryArgs.getParamValue(SkycatConfigEntry.EQUINOX);
        double equinox = _getEquinox(queryArgs);
        if (rowCoordinates.isWCS()) {
            WorldCoords pos = (WorldCoords) coords;
View Full Code Here

        CoordinateRadius cr = queryArgs.getRegion();
        if (cr == null) {
            cr = new CoordinateRadius(new WorldCoords(), 15);
        }
        Coordinates coords = cr.getCenterPosition();
        double ra = coords.getX();
        double dec = coords.getY();
        double radius = cr.getMaxRadius();

        _progressPanel = _getProgressPanel("Downloading query results ...");
        _progressPanel.start();
View Full Code Here

     *
     * @param queryArgs (in/out) describes the query arguments
     * @param region    (in) describes the query region (center and radius range)
     */
    public void setRegionArgs(QueryArgs queryArgs, CoordinateRadius region) {
        Coordinates coords = region.getCenterPosition();
        WorldCoords pos = (WorldCoords) coords;
        String[] radec = pos.format();
        queryArgs.setParamValue(SkycatConfigEntry.RA, radec[0]);
        queryArgs.setParamValue(SkycatConfigEntry.DEC, radec[1]);
        String equinoxStr = (String) queryArgs.getParamValue(SkycatConfigEntry.EQUINOX);
View Full Code Here

    private WorldCoords _resolveObjectName(String objectName, Catalog cat) throws IOException {
        QueryArgs queryArgs = new BasicQueryArgs(cat);
        queryArgs.setId(objectName);
        QueryResult r = cat.query(queryArgs);
        if (r instanceof TableQueryResult) {
            Coordinates coords = ((TableQueryResult) r).getCoordinates(0);
            if (coords instanceof WorldCoords) {
                return (WorldCoords) coords;
            }
        }
        throw new RuntimeException("Unexpected result from " + cat.toString());
View Full Code Here

            throw new RuntimeException("no wcs or image coordinates to plot");
        }

        for (int row = 0; row < nrows; row++) {
            Vector rowVec = (Vector) dataVec.get(row);
            Coordinates pos = rowCoords.getCoordinates(rowVec);
            if (pos == null) {
                continue;    // coordinates might be missing - just ignore
            }

            double x, y;
            if (isPix) {
                x = pos.getX();
                y = pos.getY();
            } else {
                // need to keep table values in the image equinox, since the WCS conversion
                // methods all assume the image equinox
                double[] radec = ((WorldCoords) pos).getRaDec(_imageEquinox);
                x = radec[0];
View Full Code Here

            region = queryArgs.getRegion();
        }
        if (region == null) {
            return false;
        }
        Coordinates centerPosition = region.getCenterPosition();
        if (!(centerPosition instanceof WorldCoords)) {
            return true;
        }
        if (!_coordinateConverter.isWCS()) {
            return false;
View Full Code Here

        // we have world coordinages: find the bounding box of the objects in the table
        double ra0 = 0., ra1 = 0., dec0 = 0., dec1 = 0.;
        boolean firstTime = true;
        for (int row = 1; row < nrows; row++) {
            Vector rowVec = (Vector) dataVec.get(row);
            Coordinates pos = rowCoords.getCoordinates(rowVec);
            if (pos == null) {
                continue;
            }
            if (firstTime) {
                firstTime = false;
                ra0 = pos.getX();
                ra1 = ra0;
                dec0 = pos.getY();
                dec1 = dec0;
            } else {
                double ra = pos.getX(), dec = pos.getY();
                ra0 = Math.min(ra0, ra);
                ra1 = Math.max(ra1, ra);
                dec0 = Math.min(dec0, dec);
                dec1 = Math.max(dec1, dec);
            }
View Full Code Here

TOP

Related Classes of jsky.coords.Coordinates

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.