Package java.awt.geom

Examples of java.awt.geom.Point2D$Double


    {
      return false;
    }
    if (key == ElementStyleKeys.ABSOLUTE_POS)
    {
      final Point2D point = (Point2D) value;
      setStyleProperty(ElementStyleKeys.POS_X, new Float(point.getX()));
      setStyleProperty(ElementStyleKeys.POS_Y, new Float(point.getY()));
      return true;
    }
    if (key == ElementStyleKeys.MINIMUMSIZE)
    {
      final Dimension2D dim = (Dimension2D) value;
View Full Code Here


  }

  public void setCenter(float lat, float lon) {
    super.setCenter(lat, lon);

    Point2D centerInDifferentDatum = datum.forward(lat, lon,
        new Point2D.Double());
    wrappedProjection.setCenter((float) centerInDifferentDatum.getY(),
        (float) centerInDifferentDatum.getX());
  }
View Full Code Here

  protected ArrayList _forwardPoly(float[] rawllpts, int ltype, int nsegs,
      boolean isFilled) {
   
    float[] rawllptsInDifferentDatum = new float[rawllpts.length];

    Point2D tmpll = new Point2D.Double();

    for (int i = 0; i < rawllpts.length; i += 2) {
      tmpll = datum.forward(Math.toDegrees(rawllpts[i]), Math.toDegrees(rawllpts[i + 1]), tmpll);
      rawllptsInDifferentDatum[i] = (float) Math.toRadians(tmpll.getY());
      rawllptsInDifferentDatum[i + 1] = (float) Math.toRadians(tmpll.getX());
    }

    return wrappedProjection._forwardPoly(rawllptsInDifferentDatum, ltype,
        nsegs, isFilled);
  }
View Full Code Here

  public Point forward(float lat, float lon, Point pt) {
    return forward(lat, lon, pt, false);
  }

  public Point forward(float lat, float lon, Point pt, boolean isRadian) {
    Point2D t;
    if (isRadian) {
      t = datum.forward(Math.toDegrees(lat), Math.toDegrees(lon));
    } else {
      t = datum.forward(lat, lon);
    }
    return wrappedProjection
        .forward((float) t.getY(), (float) t.getX(), pt);
  }
View Full Code Here

  public boolean forwardRaw(float[] rawllpts, int rawoff, int[] xcoords,
      int[] ycoords, boolean[] visible, int copyoff, int copylen) {

    float[] rawllptsInDifferentDatum = new float[rawllpts.length];

    Point2D tmpll = new Point2D.Double();

    int end = copylen + copyoff;
    for (int i = copyoff, j = rawoff; i < end; i++, j += 2) {
      tmpll = datum.forward(Math.toDegrees(rawllpts[j]), Math.toDegrees(rawllpts[j + 1]), tmpll);
      rawllptsInDifferentDatum[j] = (float) Math.toRadians(tmpll.getY());
      rawllptsInDifferentDatum[j + 1] = (float) Math.toRadians(tmpll.getX());
    }

    return wrappedProjection.forwardRaw(rawllptsInDifferentDatum, rawoff,
        xcoords, ycoords, visible, copyoff, copylen);
  }
View Full Code Here

    llpt = wrappedProjection.inverse(x, y, llpt);
    return datum.inverse(llpt.getLongitude(), llpt.getLatitude(), llpt);
  }

  public boolean isPlotable(float lat, float lon) {
    Point2D t = datum.forward(lat, lon);
    return wrappedProjection.isPlotable((float) t.getY(), (float) t.getX());
  }
View Full Code Here

        if (r < FLT_EPSILON)
            return A;
        if (1 - r < FLT_EPSILON)
            return B;

        Point2D P = new Point2D.Double(r * B.getX() + (1 - r) * A.getX(), r
                * B.getY() + (1 - r) * A.getY());
        return P;
    }
View Full Code Here

    protected static boolean retrievePoints(float length, LinkedList points,
                                            LinkedList polysegment) {
        polysegment.clear();

        // first point
        Point2D point = (Point2D) points.removeFirst();
        ;
        polysegment.add(point);

        double consumedLength = 0.0;
        double norm = 0.0;
        Point2D nextPoint = null;

        while (consumedLength < length && points.size() > 0) {
            // consume points while distance is not reached
            nextPoint = (Point2D) points.removeFirst();
            polysegment.add(nextPoint);
            norm = LineUtil.norm(point, nextPoint);
            consumedLength += norm;
            point = nextPoint;
        }

        if (consumedLength == length) {
            // we got the exact distance with an existing point.
            // we need to copy the last point back: it will be the
            // first for the next call
            points.addFirst(point);
            return true;
        } else {
            if (consumedLength > length) {
                // we went too far, we need to put back the last point
                points.addFirst(polysegment.removeLast());
                consumedLength -= norm;
                // and interpolate a new point
                point = (Point2D) polysegment.getLast();
                double d = length - consumedLength;
                // between point and nextPoint at distance d
                Point2D interp = LineUtil.interpolatedPoint(point, nextPoint, d);
                polysegment.add(interp);
                points.addFirst(interp);
                return true;
            } else {
                // no more points !
View Full Code Here

        }

        LinkedList polysegment = new LinkedList();
        int l, x1, y1, x2, y2;
        String c;
        Point2D p1, p2;
        double angle;
        for (int i = 0; i < text.length(); i++) {
            c = text.substring(i, i + 1);
            l = metrics.stringWidth(c);
            if (points.size() == 0)
                break;
            LineUtil.retrievePoints(l, points, polysegment);

            p1 = (Point2D) polysegment.getFirst();
            x1 = (int) p1.getX();
            y1 = (int) p1.getY();
            p2 = (Point2D) polysegment.getLast();
            x2 = (int) p2.getX();
            y2 = (int) p2.getY();

            angle = Math.atan2(y2 - y1, x2 - x1);
View Full Code Here

        PathIterator pi = s.getPathIterator(null, FLATNESS);
        int segType;
        double[] segCoords = new double[6];

        LinkedList points = new LinkedList();
        Point2D firstPoint = null;
        Point2D point;

        // split path in polylines
        do {
            segType = pi.currentSegment(segCoords);
            point = new Point2D.Double(segCoords[0], segCoords[1]);
View Full Code Here

TOP

Related Classes of java.awt.geom.Point2D$Double

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.