Package jsky.coords

Examples of jsky.coords.CoordinateRadius


                    if (id != null)
                        buf.append(id);
                    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();
                    if (region != null)
                        if (region.getMinRadius() != 0.0 || region.getMaxRadius() != 0.0)
                            buf.append(region.getMinRadius());
                    c += 2;
                } else if (urlStr.startsWith("r2", c)) {
                    CoordinateRadius region = queryArgs.getRegion();
                    if (region != null)
                        if (region.getMinRadius() != 0.0 || region.getMaxRadius() != 0.0)
                            buf.append(region.getMaxRadius());
                    c += 2;
                } else if (urlStr.charAt(c) == 'w') {
                    if (sc != null && sc.length > 0) {
                        for (SearchCondition aSc : sc) {
                            if (aSc.getName().equals(SkycatConfigEntry.WIDTH)) {
View Full Code Here


                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);
            Double y = (Double) queryArgs.getParamValue(SkycatConfigEntry.Y);
            if (x == null || y == null)
                return;
            ImageCoords ic = new ImageCoords(x.intValue(), y.intValue());
            queryArgs.setRegion(new CoordinateRadius(ic, r1, r2));
        }
    }
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

                ((TableQueryResult) result).setCatalog(this);
            }
            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();

        _progressPanel = _getProgressPanel("Downloading query results ...");
        _progressPanel.start();

        try {
View Full Code Here

            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

        // This vector holds the rows found
        Vector dataRows = new Vector(Math.min(maxRows, 1024), Math.min(maxRows, 256));

        // Get the region to search
        CoordinateRadius region = queryArgs.getRegion();

        // Specifies the ranges for column values we are search for.
        SearchCondition[] conditions = queryArgs.getConditions();

        // Get the numerical indexes for the search columns
View Full Code Here

        double height = dims.y * 60;

        // set the values in the query panel
        CatalogQueryPanel catalogQueryPanel = getCatalogQueryPanel();
        QueryArgs queryArgs = catalogQueryPanel.getQueryArgs();
        getCatalog().setRegionArgs(queryArgs, new CoordinateRadius(centerPos, radius, width, height));
        catalogQueryPanel.setQueryArgs(queryArgs);
    }
View Full Code Here

        if (mag != null) {
            queryArgs.setParamValueRange("mag", mag[0], mag[1]);
        }

        try {
            getCatalog().setRegionArgs(queryArgs, new CoordinateRadius(centerPos, minRadius, maxRadius, width, height));
            catalogQueryPanel.setQueryArgs(queryArgs);
        } catch (Exception ignored) {
        }
    }
View Full Code Here

     * range where they can be plotted in the current image.
     */
    protected boolean tableInRange(TableQueryResult table) {
        // get the coordinates of the region that the table covers from the query arguments, if known
        QueryArgs queryArgs = table.getQueryArgs();
        CoordinateRadius region;
        if (queryArgs == null) {
            // scan table here to get the range that it covers
            region = getTableRegion(table);
            if (region != null) {
                queryArgs = new BasicQueryArgs(table);
                queryArgs.setRegion(region);
                table.setQueryArgs(queryArgs);
            }
        } else {
            region = queryArgs.getRegion();
        }
        if (region == null) {
            return false;
        }
        Coordinates centerPosition = region.getCenterPosition();
        if (!(centerPosition instanceof WorldCoords)) {
            return true;
        }
        if (!_coordinateConverter.isWCS()) {
            return false;
        }

        WorldCoords pos = (WorldCoords) centerPosition;
        double ra = pos.getRaDeg();
        double dec = pos.getDecDeg();
        double w = region.getWidth();     // in arcmin
        double h = region.getHeight();
        Rectangle2D.Double tableRect = new Rectangle2D.Double(ra, dec, w, h);

        // get the image coords
        Point2D.Double p = _coordinateConverter.getWCSCenter();
        pos = new WorldCoords(p.x, p.y, _imageEquinox);
View Full Code Here

            Point2D.Double p = _coordinateConverter.getImageCenter();
            ImageCoords pos = new ImageCoords(p.x, p.y);
            double w = _coordinateConverter.getWidth();
            double h = _coordinateConverter.getHeight();
            double r = Math.sqrt(w * w + h * h);
            return new CoordinateRadius(pos, r, w, h);
        }

        if (!rowCoords.isWCS()) {
            return null;
        }

        // 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);
            }
        }

        // get the center point and radius
        WorldCoords centerPos = new WorldCoords((ra0 + ra1) / 2., (dec0 + dec1) / 2., tableEquinox);
        double d = WorldCoords.dist(ra0, dec0, ra1, dec1);
        return new CoordinateRadius(centerPos, d / 2.);
    }
View Full Code Here

TOP

Related Classes of jsky.coords.CoordinateRadius

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.