Package jsky.catalog

Examples of jsky.catalog.RowCoordinates


     * @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;
            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());
View Full Code Here


            }
            i++;
        }
        if (raCol != -1 && decCol != -1) {
            // XXX What if table coords are not J2000? Where is that described?
            setRowCoordinates(new RowCoordinates(raCol, decCol, 2000));
        }
    }
View Full Code Here

        if (!raColSet && !decColSet && !xColSet && !yColSet) {
            raCol = 1;
            decCol = 2;
        }
        if (raCol >= 0 && decCol >= 0) {
            _rowCoordinates = new RowCoordinates(raCol, decCol, equinox);
        } else if (xCol >= 0 && yCol >= 0) {
            _rowCoordinates = new RowCoordinates(xCol, yCol);
        } else {
            _rowCoordinates = new RowCoordinates();
        }

        _rowCoordinates.setIdCol(idCol);
    }
View Full Code Here

     * @param symbols an array of objects describing the symbols to plot
     */
    protected void plotSymbols(TableQueryResult table, TablePlotSymbol[] symbols) {
        // for each row in the catalog, evaluate the expressions and plot the symbols
        int nrows = table.getRowCount();
        RowCoordinates rowCoords = table.getRowCoordinates();
        //double tableEquinox = rowCoords.getEquinox();  // XXX might be specified in a column?
        Vector dataVec = table.getDataVector();

        boolean isWCS = rowCoords.isWCS();
        boolean isPix = rowCoords.isPix();
        int cooSys;
        if (isPix) {
            cooSys = CoordinateConverter.IMAGE;
        } else if (isWCS) {
            cooSys = CoordinateConverter.WORLD;
            _imageEquinox = _coordinateConverter.getEquinox();
        } else {
            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;
View Full Code Here

        int nrows = table.getRowCount();
        if (nrows == 0) {
            return null;
        }

        RowCoordinates rowCoords = table.getRowCoordinates();
        double tableEquinox = rowCoords.getEquinox();
        Vector dataVec = table.getDataVector();

        if (rowCoords.isPix()) {
            // no WCS, just use image center and size
            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;
View Full Code Here

                ListIterator figureListIt = sli.figureList.listIterator(0);
                while (figureListIt.hasNext()) {
                    FigureListItem fli = (FigureListItem) figureListIt.next();
                    // assume symbol has already been selected
                    if (fli.selected && sli.symbol.getBoundingShape(fli.shape).contains(p)) {
                        RowCoordinates rowCoords = tli.table.getRowCoordinates();
                        if (!rowCoords.isWCS()) {
                            return null;
                        }
                        Vector dataVec = tli.table.getDataVector();
                        _imageEquinox = _coordinateConverter.getEquinox();
                        Vector rowVec = (Vector) dataVec.get(fli.row);

                        // get the world coordinates
                        Coordinates cpos = rowCoords.getCoordinates(rowVec);
                        if (cpos == null) {
                            return null;
                        }
                        WorldCoords pos = (WorldCoords) cpos;

                        // modify the parameter to point to the center of the symbol
                        double[] radec = pos.getRaDec(_imageEquinox);
                        p.x = radec[0];
                        p.y = radec[1];
                        _coordinateConverter.convertCoords(p, CoordinateConverter.WORLD, CoordinateConverter.SCREEN, false);

                        // get the id of the catalog symbol
                        int idCol = rowCoords.getIdCol();
                        String id = null;
                        if (idCol != -1) {
                            Object o = rowVec.get(idCol);
                            if (o != null) {
                                id = o.toString();
View Full Code Here

            _entry = new SkycatConfigEntry(p);
        } else {
            _entry = entry;
        }

        RowCoordinates rowCoordinates = entry.getRowCoordinates();
        setRowCoordinates(rowCoordinates);
        if (rowCoordinates.isWCS()) {
            FieldDesc[] fields = getFields();
            if (fields != null) {
                int idCol = rowCoordinates.getIdCol();
                if (idCol >= 0 && idCol < fields.length)
                    ((FieldDescAdapter) fields[idCol]).setIsId(true);

                int raCol = rowCoordinates.getRaCol();
                if (raCol >= 0 && raCol < fields.length)
                    ((FieldDescAdapter) fields[raCol]).setIsRA(true);

                int decCol = rowCoordinates.getDecCol();
                if (decCol >= 0 && decCol < fields.length)
                    ((FieldDescAdapter) fields[decCol]).setIsDec(true);
            }
        }
    }
View Full Code Here

TOP

Related Classes of jsky.catalog.RowCoordinates

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.