Examples of CoordinateConverter


Examples of jsky.coords.CoordinateConverter

     */
    public void setSelectedArea(Rectangle2D r) {
        _selectedArea = r;
        if (_imageDisplay == null || r == null)
            return;
        CoordinateConverter wcs = _imageDisplay.getCoordinateConverter();
        if (!wcs.isWCS()) {
            //DialogUtil.error("The image does not support world coordinates.");
            return;
        }

        // 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);
        double width = dims.x * 60; // convert deg to arcmin
        double height = dims.y * 60;

        // set the values in the query panel
        CatalogQueryPanel catalogQueryPanel = getCatalogQueryPanel();
View Full Code Here

Examples of jsky.coords.CoordinateConverter

        _zoomWidth = (int) (w / zoomScale);


        if (_stats != null) {
            Point2D.Double p = new Point2D.Double(_stats.getImageX(), _stats.getImageY());
            CoordinateConverter cc = _mainImageDisplay.getCoordinateConverter();
            cc.imageToScreenCoords(p, false);
            _imageZoom.zoom((int) p.x, (int) p.y, true);
        }

        _updating = true;
        try {
View Full Code Here

Examples of jsky.coords.CoordinateConverter

        double dxY = Math.cos(rad) * y / 2.0;
        double dyY = Math.sin(rad) * y / 2.0;

        // compute end points for X-axis and convert them to canvas coordinates
        double xc = _stats.getImageX(), yc = _stats.getImageY();
        CoordinateConverter cc = imgDisp.getCoordinateConverter();
        Point2D.Double px1 = new Point2D.Double(xc + dxX, yc + dyX);
        Point2D.Double px2 = new Point2D.Double(xc - dxX, yc - dyX);
        cc.imageToScreenCoords(px1, false);
        cc.imageToScreenCoords(px2, false);

        // the Y-axis is rotated "by hand" so that it appears perpendicular to the X-axis
        Point2D.Double py1 = new Point2D.Double(xc + dyY, yc - dxY);
        Point2D.Double py2 = new Point2D.Double(xc - dyY, yc + dxY);
        cc.imageToScreenCoords(py1, false);
        cc.imageToScreenCoords(py2, false);

        // draw X and Y axis lines with an outer thick black line
        // and inner thin white line
        Line2D.Double lx = new Line2D.Double(px1, px2);
        Line2D.Double ly = new Line2D.Double(py1, py2);
View Full Code Here

Examples of jsky.coords.CoordinateConverter

        }

        _rect = _mainImageDisplay.getVisibleArea();
        Point2D.Double p = new Point2D.Double(_rect.getX(), _rect.getY());
        Point2D.Double d = new Point2D.Double(_rect.getWidth(), _rect.getHeight());
        CoordinateConverter cc = _imageDisplay.getCoordinateConverter();
        cc.userToScreenCoords(p, false);
        cc.userToScreenCoords(d, true);
        _rect.setRect(p.getX(), p.getY(), d.getX(), d.getY());
    }
View Full Code Here

Examples of jsky.coords.CoordinateConverter

        _north.y = center.y + sizeInDeg;
        if (_north.y >= 90.)
            _north.y = 180. - _north.y;

        CoordinateConverter cc = _imageDisplay.getCoordinateConverter();
        cc.worldToScreenCoords(center, false);
        cc.worldToScreenCoords(_north, false);
        cc.worldToScreenCoords(_east, false);

        GeneralPath path = new GeneralPath();
        ShapeUtil.addArrowLine(path, center, _north);
        ShapeUtil.addArrowLine(path, center, _east);
        _compass = path;
View Full Code Here

Examples of jsky.coords.CoordinateConverter

     */
    public CanvasFigure makeLabeledRectangle(Rectangle2D.Double rect, int coordType, Paint fill,
                                             Paint outline, float lineWidth,
                                             String label, int anchor, Paint labelColor, Font font,
                                             Interactor interactor) {
        CoordinateConverter coordinateConverter = _imageDisplay.getCoordinateConverter();
        Point2D.Double p = new Point2D.Double(rect.x, rect.y);
        coordinateConverter.convertCoords(p, coordType, CoordinateConverter.SCREEN, false);
        Point2D.Double size = new Point2D.Double(rect.width, rect.height);
        coordinateConverter.convertCoords(size, coordType, CoordinateConverter.SCREEN, true);
        Rectangle2D.Double r = new Rectangle2D.Double(p.x, p.y, size.x, size.y);
        return makeLabeledFigure(r, fill, outline, lineWidth, label, anchor, labelColor, font, interactor);
    }
View Full Code Here

Examples of jsky.coords.CoordinateConverter

     * @param interactor the interactor for the figure (SelctionInteractor, DragInteractor, etc.)
     * @return the new figure
     */
    public CanvasFigure makeRectangle(Rectangle2D.Double rect, int coordType, Paint fill,
                                      Paint outline, float lineWidth, Interactor interactor) {
        CoordinateConverter coordinateConverter = _imageDisplay.getCoordinateConverter();
        Point2D.Double p = new Point2D.Double(rect.x, rect.y);
        coordinateConverter.convertCoords(p, coordType, CoordinateConverter.SCREEN, false);
        Point2D.Double size = new Point2D.Double(rect.width, rect.height);
        coordinateConverter.convertCoords(size, coordType, CoordinateConverter.SCREEN, true);
        Rectangle2D.Double r = new Rectangle2D.Double(p.x, p.y, size.x, size.y);
        return makeFigure(r, fill, outline, lineWidth, interactor);
    }
View Full Code Here

Examples of jsky.coords.CoordinateConverter

     * @param lineWidth the line width
     * @return the new figure
     */
    public RotatableCanvasFigure makeRoiRectangle(Rectangle2D.Double rect, int coordType, Paint fill,
                                         Paint outline, float lineWidth) {
        CoordinateConverter coordinateConverter = _imageDisplay.getCoordinateConverter();
        Point2D.Double p = new Point2D.Double(rect.x, rect.y);
        coordinateConverter.convertCoords(p, coordType, CoordinateConverter.SCREEN, false);
        Point2D.Double size = new Point2D.Double(rect.width, rect.height);
        coordinateConverter.convertCoords(size, coordType, CoordinateConverter.SCREEN, true);

        Rectangle2D.Double r = new Rectangle2D.Double(p.x, p.y, size.x, size.y);
        return new RoiRectangle(r, fill, outline, lineWidth, _roiSelectionInteractor);
    }
View Full Code Here

Examples of jsky.coords.CoordinateConverter

     * @param lineWidth the line width
     * @return the new figure
     */
    public RotatableCanvasFigure makeRoiEllipse(Ellipse2D.Double ellipse, int coordType, Paint fill,
                                       Paint outline, float lineWidth) {
        CoordinateConverter coordinateConverter = _imageDisplay.getCoordinateConverter();
        Point2D.Double p = new Point2D.Double(ellipse.x, ellipse.y);
        coordinateConverter.convertCoords(p, coordType, CoordinateConverter.SCREEN, false);
        Point2D.Double size = new Point2D.Double(ellipse.width, ellipse.height);
        coordinateConverter.convertCoords(size, coordType, CoordinateConverter.SCREEN, true);

        Ellipse2D.Double e = new Ellipse2D.Double(p.x, p.y, size.x, size.y);
        return new RoiEllipse(e, fill, outline, lineWidth, _roiSelectionInteractor);
    }
View Full Code Here

Examples of jsky.coords.CoordinateConverter

     */
    public CanvasFigure makeLabeledEllipse(Ellipse2D.Double ellipse, int coordType, Paint fill,
                                           Paint outline, float lineWidth,
                                           String label, int anchor, Paint labelColor, Font font,
                                           Interactor interactor) {
        CoordinateConverter coordinateConverter = _imageDisplay.getCoordinateConverter();
        Point2D.Double p = new Point2D.Double(ellipse.x, ellipse.y);
        coordinateConverter.convertCoords(p, coordType, CoordinateConverter.SCREEN, false);
        Point2D.Double size = new Point2D.Double(ellipse.width, ellipse.height);
        coordinateConverter.convertCoords(size, coordType, CoordinateConverter.SCREEN, true);
        Ellipse2D.Double r = new Ellipse2D.Double(p.x, p.y, size.x, size.y);
        return makeLabeledFigure(r, fill, outline, lineWidth, label, anchor, labelColor, font, interactor);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.