Package com.google.code.appengine.awt.geom

Examples of com.google.code.appengine.awt.geom.Point2D


        return dst;
    }

    public void transform(Point2D[] src, int srcOff, Point2D[] dst, int dstOff, int length) {
        while (--length >= 0) {
            Point2D srcPoint = src[srcOff++];
            double x = srcPoint.getX();
            double y = srcPoint.getY();
            Point2D dstPoint = dst[dstOff];
            if (dstPoint == null) {
                if (srcPoint instanceof Point2D.Double) {
                    dstPoint = new Point2D.Double();
                } else {
                    dstPoint = new Point2D.Float();
                }
            }
            dstPoint.setLocation(x * m00 + y * m01 + m02, x * m10 + y * m11 + m12);
            dst[dstOff++] = dstPoint;
        }
    }
View Full Code Here


    public boolean equals(Object obj) {
        if (obj == this) {
            return true;
        }
        if (obj instanceof Point2D) {
            Point2D p = (Point2D) obj;
            return getX() == p.getX() && getY() == p.getY();
        }
        return false;
    }
View Full Code Here

        double rx1 = getX();
        double ry1 = getY();
        double rx2 = rx1 + getWidth();
        double ry2 = ry1 + getHeight();

        Point2D p1 = getStartPoint();
        Point2D p2 = getEndPoint();

        double bx1 = containsAngle(180.0) ? rx1 : Math.min(p1.getX(), p2.getX());
        double by1 = containsAngle(90.0? ry1 : Math.min(p1.getY(), p2.getY());
        double bx2 = containsAngle(0.0)   ? rx2 : Math.max(p1.getX(), p2.getX());
        double by2 = containsAngle(270.0) ? ry2 : Math.max(p1.getY(), p2.getY());

        if (type == PIE) {
            double cx = getCenterX();
            double cy = getCenterY();
            bx1 = Math.min(bx1, cx);
View Full Code Here

        double cy = getCenterY();
        if (r.contains(cx, cy)) {
            return false;
        }

        Point2D p1 = getStartPoint();
        Point2D p2 = getEndPoint();

        return !r.intersectsLine(cx, cy, p1.getX(), p1.getY())
                && !r.intersectsLine(cx, cy, p2.getX(), p2.getY());
    }
View Full Code Here

            return true;
        }

        double cx = getCenterX();
        double cy = getCenterY();
        Point2D p1 = getStartPoint();
        Point2D p2 = getEndPoint();
        Rectangle2D r = new Rectangle2D.Double(rx, ry, rw, rh);

        // Check: Does rectangle contain arc's points
        if (r.contains(p1) || r.contains(p2) || (type == PIE && r.contains(cx, cy))) {
            return true;
        }

        if (type == PIE) {
            if (r.intersectsLine(p1.getX(), p1.getY(), cx, cy) ||
                r.intersectsLine(p2.getX(), p2.getY(), cx, cy))
            {
                return true;
            }
        } else {
            if (r.intersectsLine(p1.getX(), p1.getY(), p2.getX(), p2.getY())) {
                return true;
            }
        }

        // Nearest rectangle point
View Full Code Here

    protected void writePaint(GradientPaint paint) throws IOException {
        if (gradients.get(paint) == null) {
            String name = "gradient-" + gradients.size();
            gradients.put(paint, name);
            Point2D p1 = paint.getPoint1();
            Point2D p2 = paint.getPoint2();
            os.println("<defs>");
            os.print("  <linearGradient id=\"" + name + "\" ");
            os.print("x1=\"" + fixedPrecision(p1.getX()) + "\" ");
            os.print("y1=\"" + fixedPrecision(p1.getY()) + "\" ");
            os.print("x2=\"" + fixedPrecision(p2.getX()) + "\" ");
            os.print("y2=\"" + fixedPrecision(p2.getY()) + "\" ");
            os.print("gradientUnits=\"userSpaceOnUse\" ");
            os.print("spreadMethod=\""
                    + ((paint.isCyclic()) ? "reflect" : "pad") + "\" ");
            os.println(">");
            os.println("    <stop offset=\"0\" stop-color=\""
View Full Code Here

        }

        // transform the bounds
        bounds = at.createTransformedShape(bounds).getBounds2D();
        // create the result with the same transformation
        Point2D result = at.transform(new Point2D.Double(0, 0), new Point2D.Double());

        // space between string and border
        double adjustment = (getFont().getSize2D() * 2) / 10;

        // add the adjustment
View Full Code Here

            str,
            FontUtilities.getAttributes(getFont()),
            getFontRenderContext());

        // draw the frame
        Point2D offset = drawFrameAndBanner(
            tl, x, y, horizontal, vertical,
            framed, frameColor, frameWidth, banner, bannerColor);

        // draw the string
        drawString(str, offset.getX(), offset.getY());
    }
View Full Code Here

    GenericTagHandler tagHandler = new GenericTagHandler(this);
    TextLayout tl = tagHandler.createTextLayout(str, getFont().getSize2D() / 7.5);

        // draw the frame
        Point2D offset = drawFrameAndBanner(
            tl, x, y, horizontal, vertical,
            framed, frameColor, frameWidth, banner, bannerColor);

        // FIXME: not quite clear why correction is needed
        // see {@link GenericTagHandler#superscriptCorrection
        tagHandler.print(str, offset.getX(), offset.getY(), getFont().getSize2D() / 7.5);
    }
View Full Code Here

        double[] transformedYPoints = yPoints;
        if (t != null) {
            // FIXME, this seems a silly slow way to deal with this.
            transformedXPoints = new double[nPoints];
            transformedYPoints = new double[nPoints];
            Point2D s = new Point2D.Double();
            Point2D d = new Point2D.Double();
            for (int i = 0; i < nPoints; i++) {
                s.setLocation(xPoints[i], yPoints[i]);
                t.transform(s, d);
                transformedXPoints[i] = d.getX();
                transformedYPoints[i] = d.getY();
            }
        }
        return new ArrayPathIterator(transformedXPoints, transformedYPoints,
                nPoints, closed, resolution);
    }
View Full Code Here

TOP

Related Classes of com.google.code.appengine.awt.geom.Point2D

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.