Package jsky.coords

Examples of jsky.coords.WorldCoords


                    c += 2;
                    urlHasId = true;
                } else if (urlStr.startsWith("ra", c)) {
                    CoordinateRadius region = queryArgs.getRegion();
                    if (region != null) {
                        WorldCoords pos = (WorldCoords) region.getCenterPosition();
                        buf.append(pos.getRA().toString());
                    }
                    c += 2;
                    urlHasRaDec = true;
                } else if (urlStr.startsWith("dec", c)) {
                    CoordinateRadius region = queryArgs.getRegion();
                    if (region != null) {
                        WorldCoords pos = (WorldCoords) region.getCenterPosition();
                        buf.append(pos.getDec().toString());
                    }
                    c += 3;
                    urlHasRaDec = true;
                } else if (urlStr.charAt(c) == 'x') {
                    CoordinateRadius region = queryArgs.getRegion();
                    if (region != null) {
                        ImageCoords pos = (ImageCoords) region.getCenterPosition();
                        buf.append(pos.getX());
                    }
                    c++;
                    urlHasXy = true;
                } else if (urlStr.charAt(c) == 'y') {
                    CoordinateRadius region = queryArgs.getRegion();
                    if (region != null) {
                        ImageCoords pos = (ImageCoords) region.getCenterPosition();
                        buf.append(pos.getY());
                    }
                    c++;
                    urlHasXy = true;
                } else if (urlStr.startsWith("r1", c)) {
                    CoordinateRadius region = queryArgs.getRegion();
View Full Code Here


            r1 = 0.;
        }

        // look for the center position parameters
        if (isWCS()) {
            WorldCoords wcs;
            String objectName = (String) queryArgs.getParamValue(SkycatConfigEntry.OBJECT);
            if (objectName == null || objectName.length() == 0) {
                // no object name specified, check RA and Dec
                String raStr = (String) queryArgs.getParamValue(SkycatConfigEntry.RA);
                String decStr = (String) queryArgs.getParamValue(SkycatConfigEntry.DEC);
                if (raStr == null || decStr == null)
                    return;
                double equinox = _getEquinox(queryArgs);
                wcs = new WorldCoords(raStr, decStr, equinox, true);
            } else {
                // an object name was specified, which needs to be resolved with a nameserver
                Object o = queryArgs.getParamValue(SkycatConfigEntry.NAME_SERVER);
                if (!(o instanceof Catalog))
                    throw new RuntimeException("No name server was specified");
                wcs = _resolveObjectName(objectName, (Catalog) o);
                queryArgs.setParamValue(SkycatConfigEntry.RA, wcs.getRA().toString());
                queryArgs.setParamValue(SkycatConfigEntry.DEC, wcs.getDec().toString());
                queryArgs.setParamValue(SkycatConfigEntry.EQUINOX, "2000");               
            }
            queryArgs.setRegion(new CoordinateRadius(wcs, r1, r2));
        } else if (isPix()) {
            Double x = (Double) queryArgs.getParamValue(SkycatConfigEntry.X);
View Full Code Here

        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;
            String[] radec = pos.format(equinox);
            queryArgs.setParamValue(SkycatConfigEntry.RA, radec[0]);
            queryArgs.setParamValue(SkycatConfigEntry.DEC, radec[1]);
            queryArgs.setParamValue(SkycatConfigEntry.EQUINOX, equinoxStr);
            queryArgs.setParamValue(SkycatConfigEntry.MIN_RADIUS, region.getMinRadius());
            queryArgs.setParamValue(SkycatConfigEntry.MAX_RADIUS, region.getMaxRadius());
            queryArgs.setParamValue(SkycatConfigEntry.WIDTH, region.getWidth());
            queryArgs.setParamValue(SkycatConfigEntry.HEIGHT, region.getHeight());
        } else if (rowCoordinates.isPix()) {
            ImageCoords pos = (ImageCoords) coords;
            queryArgs.setParamValue(SkycatConfigEntry.X, pos.getX());
            queryArgs.setParamValue(SkycatConfigEntry.Y, pos.getY());
            queryArgs.setParamValue(SkycatConfigEntry.MIN_RADIUS, region.getMinRadius());
            queryArgs.setParamValue(SkycatConfigEntry.MAX_RADIUS, region.getMaxRadius());
            queryArgs.setParamValue(SkycatConfigEntry.WIDTH, region.getWidth());
            queryArgs.setParamValue(SkycatConfigEntry.HEIGHT, region.getHeight());
        }
View Full Code Here

            System.out.println("result: " + r1);

            System.out.println("");
            System.out.println("test query: at center position/radius: ");
            QueryArgs q2 = new BasicQueryArgs(cat);
            q2.setRegion(new CoordinateRadius(new WorldCoords("03:19:44.44", "+41:30:58.21"), 2.));
            QueryResult r2 = cat.query(q2);
            System.out.println("result: " + r2);
        } catch (Exception e) {
            e.printStackTrace();
        }
View Full Code Here

    public double[] getDefaultSearchRadius(WorldCoords centerPos, boolean useImageSize) {
        Point2D.Double p1 = new Point2D.Double(1., 1.);
        WorldCoordinateConverter wcs = getWCS();
        wcs.imageToWorldCoords(p1, false);
        double equinox = wcs.getEquinox();
        WorldCoords origin = new WorldCoords(p1, equinox);

        double maxRadius = centerPos.dist(origin);
        return new double[]{0., maxRadius};
    }
View Full Code Here

            return result;
        }

        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();
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);
        queryArgs.setParamValue(SkycatConfigEntry.EQUINOX, equinoxStr);
        queryArgs.setParamValue(SkycatConfigEntry.MAX_RADIUS, region.getMaxRadius());
View Full Code Here

     *
     * @param queryArgs the query arguments
     * @throws java.io.IOException if there is an error resolving the object name via name server
     */
    private void _setRegion(QueryArgs queryArgs) throws IOException {
        WorldCoords wcs;
        String objectName = (String) queryArgs.getParamValue(SkycatConfigEntry.OBJECT);
        if (objectName == null || objectName.length() == 0) {
            // no object name specified, check RA and Dec
            String raStr = (String) queryArgs.getParamValue(SkycatConfigEntry.RA);
            String decStr = (String) queryArgs.getParamValue(SkycatConfigEntry.DEC);
            if (raStr == null || decStr == null) {
                return;
            }
            double equinox = _getEquinox(queryArgs);
            wcs = new WorldCoords(raStr, decStr, equinox, true);
        } else {
            // an object name was specified, which needs to be resolved with a nameserver
            Object o = queryArgs.getParamValue(SkycatConfigEntry.NAME_SERVER);
            if (!(o instanceof Catalog)) {
                throw new RuntimeException("No name server was specified");
            }
            wcs = _resolveObjectName(objectName, (Catalog) o);
            queryArgs.setParamValue(SkycatConfigEntry.RA, wcs.getRA().toString());
            queryArgs.setParamValue(SkycatConfigEntry.DEC, wcs.getDec().toString());
            queryArgs.setParamValue(SkycatConfigEntry.EQUINOX, "2000");
        }

        double radius = queryArgs.getParamValueAsDouble(SkycatConfigEntry.MAX_RADIUS, 10.);
        queryArgs.setRegion(new CoordinateRadius(wcs, radius));
View Full Code Here

        double ra = Double.NaN, dec = Double.NaN;
        String radecStr = "";

        if (_imageDisplay.isWCS()) {
            WorldCoordinateConverter wcs = _imageDisplay.getWCS();
            WorldCoords center = new WorldCoords(wcs.getWCSCenter(), wcs.getEquinox());
            radecStr += center.toString();
            ra = center.getRaDeg();
            dec = center.getDecDeg();
        }

        String name = "";
        if (_imageDisplay.getFilename() != null) {
            name = new File(_imageDisplay.getFilename()).getName();
View Full Code Here

        // get the center position
        Point2D.Double center = new Point2D.Double(r.getX() + r.getWidth() / 2.,
                                                   r.getY() + r.getHeight() / 2.);
        wcs.screenToWorldCoords(center, false);
        double equinox = wcs.getEquinox();
        WorldCoords centerPos = new WorldCoords(center, equinox);

        // get the radius in arcmin
        Point2D.Double p = new Point2D.Double(r.getX(), r.getY());
        wcs.screenToWorldCoords(p, false);
        WorldCoords origin = new WorldCoords(p, equinox);
        double radius = centerPos.dist(origin);

        // get the image width and height in arcmin
        Point2D.Double dims = new Point2D.Double(r.getWidth(), r.getHeight());
        wcs.screenToWorldCoords(dims, true);
View Full Code Here

TOP

Related Classes of jsky.coords.WorldCoords

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.