Package java.awt

Examples of java.awt.Point


        Shape shape = getShape();
        if (shape == null) {
            return false;
        }

        Point p1 = proj.forward(proj.getUpperLeft());
        Point p2 = proj.forward(proj.getLowerRight());
        int h = (int) (p2.getY() - p1.getY());
        int w = (int) (p2.getX() - p1.getX());

        Rectangle mapRect = new Rectangle((int) p1.getX(), (int) p1.getY(), w, h);

        return mapRect.intersects(shape.getBounds());
    }
View Full Code Here


        synchronized (helper) {
            super.computeParameters();

            // Screen stuff
            Point temp = new Point();

            helper.setAllParams(pixelsPerMeter,
                    planetRadius,
                    planetPixelRadius,
                    planetPixelCircumference,
View Full Code Here

            npts = xs.length;
            int[] _x = new int[npts];
            int[] _y = new int[npts];

            // forward project the radian point
            Point origin = proj.forward(lat, lon, new Point(0, 0), true);// radians

            if (coordMode == COORDMODE_ORIGIN) {
                for (i = 0; i < npts; i++) {
                    _x[i] = xs[i] + origin.x;
                    _y[i] = ys[i] + origin.y;
View Full Code Here

            int startXPixelInSource = point1.x < 0 ? (int) ((-1.0 * point1.x) / widthScale)
                    : 0;
            int startYPixelInSource = point1.y < 0 ? (int) ((-1 * point1.y) / heightScale)
                    : 0;
            Point scaledDim = new Point((int) (point1.x + (width * widthScale)), (int) (point1.y + (height * heightScale)));
            int endXPixelInSource = (scaledDim.x > projWidth ? (int) ((projWidth - point1.x) / widthScale) + 1
                    : width);
            int endYPixelInSource = scaledDim.y > projHeight ? (int) ((projHeight - point1.y) / heightScale) + 1
                    : height;

View Full Code Here

        case RENDERTYPE_LATLON:
            if (!proj.isPlotable(lat1, lon1)) {
                setNeedToRegenerate(true);// HMMM not the best flag
                return false;
            }
            Point p1 = proj.forward(lat1, lon1);

            x1 = p1.x + x - radius;
            y1 = p1.y + y - radius;
            x2 = p1.x + x + radius;
            y2 = p1.y + y + radius;
            break;
        case RENDERTYPE_UNKNOWN:
            System.err.println("OMPoint.generate(): invalid RenderType");
            return false;
        }

        if (oval) {
            shape = new GeneralPath(new Ellipse2D.Float((float) Math.min(x2, x1), (float) Math.min(y2,
                    y1), (float) Math.abs(x2 - x1), (float) Math.abs(y2 - y1)));
        } else {
            shape = createBoxShape((int) Math.min(x2, x1), (int) Math.min(y2,
                    y1), (int) Math.abs(x2 - x1), (int) Math.abs(y2 - y1));
        }

        initLabelingDuringGenerate();
        setLabelLocation(new Point(x2, y1));

        setNeedToRegenerate(false);
        return true;
    }
View Full Code Here

            case RENDERTYPE_LATLON:
                if (!proj.isPlotable(lat1, lon1)) {
                    setNeedToRegenerate(true);// HMMM not the best flag
                    return false;
                }
                Point p1 = proj.forward(lat1, lon1);

                imageX = p1.x + x - imageOffsetX;
                imageY = p1.y + y - imageOffsetY;
                break;
            case RENDERTYPE_UNKNOWN:
                System.err.println("OMPoint.Image.generate(): invalid RenderType");
                return false;
            }

            shape = createBoxShape(imageX, imageY, imageWidth, imageHeight);

            initLabelingDuringGenerate();
            setLabelLocation(new Point(imageX + imageWidth, imageY
                    + imageOffsetY));

            setNeedToRegenerate(false);
            return true;
        }
View Full Code Here

        double distance = getSlopeRun(grid, getContrast());

        // Used for projections of image coordinates. Reused in the
        // loops to save memory.
        LatLonPoint llp = new LatLonPoint();
        Point point = new Point();
        ElevationColors colors = getColors();

        if (colors == null) {
            return SinkGraphic.getSharedInstance();
        }

        // x is the horizontal pixel being modified
        for (short x = 0; x < grid.width; x++) {
            // Check to make sure the pixels we're calculating are on
            // the map.
            int screenx = (int) grid.point1.getX() + x;
            if (screenx < 0 || screenx > proj.getWidth()) {
                incomplete = true;
                continue;
            }

            for (short y = 0; y < grid.height; y++) {

                // Check to make sure the pixels we're calculating are
                // on the map.
                int screeny = (int) grid.point1.getY() + y;
                if (screeny < 0 || screeny > proj.getHeight()) {
                    incomplete = true;
                    continue;
                }

                // OK, on the map.
                point.setLocation(screenx, screeny);
                llp = proj.inverse(point.x, point.y, llp);

                int yc = Math.round((llp.getLatitude() - grid.getLatitude())
                        / grid.getVerticalResolution());
                int xc = Math.round((llp.getLongitude() - grid.getLongitude())
View Full Code Here

        // increments needed to get good coordinates for the arc.
        // Then, starting at the low arc angle, we increment it to get
        // the coordinates for the arced line, a given radius away
        // from the circle center, between the arc angle extents.

        Point midPoint = new Point();
        Point arcCenter = new Point();
        Point peakPoint = new Point();

        // pixel distance between points.
        double distance = Math.sqrt(Math.pow(Math.abs(y2 - y1), 2.0)
                + Math.pow(Math.abs(x2 - x1), 2.0));
        // slope of straight line between points.
View Full Code Here

        case RENDERTYPE_OFFSET:
            if (!proj.isPlotable(center)) {
                setNeedToRegenerate(true);//HMMM not the best flag
                return false;
            }
            Point p1 = proj.forward(center.radlat_,
                    center.radlon_,
                    new Point(),
                    true);
            x1 = p1.x + off_x;
            y1 = p1.y + off_y;

        case RENDERTYPE_XY:
            float fwidth = (float) width;
            float fheight = (float) height;
            float transx = (float) x1;
            float transy = (float) y1;
            float x = transx - fwidth / 2f;
            float y = transy - fheight / 2f;

            Shape arcShape = createArcShape(x, y, fwidth, fheight);

            if (rotationAngle != DEFAULT_ROTATIONANGLE) {
                af = new AffineTransform();
                af.rotate(rotationAngle, transx, transy);
            }
            pi = arcShape.getPathIterator(af);
            gp = new GeneralPath();
            gp.append(pi, false);
            // In X/Y or Offset RenderType, there is only one shape.
            setShape(gp);

            break;

        case RENDERTYPE_LATLON:
            ArrayList coordLists = getCoordLists(proj, center, radius, nverts);

            Point p = proj.forward(center.radlat_,
                    center.radlon_,
                    new Point(),
                    true);
            x1 = p.x;
            y1 = p.y;

            int size = coordLists.size();
View Full Code Here

            } else if (anchor == ANCHOR_BOTTOMLEFT || anchor == ANCHOR_BOTTOM
                    || anchor == ANCHOR_BOTTOMRIGHT) {
                y += rect.getHeight();
            }

            setLocation(new Point((int) x, (int) y));
        }
    }
View Full Code Here

TOP

Related Classes of java.awt.Point

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.