Package java.awt.geom

Examples of java.awt.geom.Path2D$Float$TxIterator


     * @param polygon List of nodes forming polygon (LatLon coordinates)
     * @return Area for the given list of nodes
     * @since 6841
     */
    public static Area getAreaLatLon(List<Node> polygon) {
        Path2D path = new Path2D.Double();

        boolean begin = true;
        for (Node n : polygon) {
            if (begin) {
                path.moveTo(n.getCoor().lon(), n.getCoor().lat());
                begin = false;
            } else {
                path.lineTo(n.getCoor().lon(), n.getCoor().lat());
            }
        }
        if (!begin) {
            path.closePath();
        }

        return new Area(path);
    }
View Full Code Here


        }
    }
   
    public void visit(GeneralPath path) {
        this.g.setColor(path.color);
        Path2D cpy = new Path2D.Double();
        cpy.append(getPathIterator(path, transform), false);

        if (path.fill) {
            this.g.fill(cpy);
        } else {
            Stroke stroke = this.g.getStroke();
View Full Code Here

      assertTrue(lastPoint.getY() < 513.0);
    }
  }

  private static Point2D getLastPointOfALane(Lane lane) throws IOException {
    Path2D shape = lane.queryReadShape().get();
    PathIterator it = shape.getPathIterator(null);
    double[] coords = new double[6];
    while (!it.isDone()) {
      it.currentSegment(coords);
      it.next();
    }
View Full Code Here

            Rect r = (Rect) s;
            return new Rectangle2D.Float(r.x, r.y, r.width, r.height);
        }
        if (s instanceof Triangle2D) {
            Triangle2D t = (Triangle2D) s;
            Path2D path = new Path2D.Float();
            path.moveTo(t.a.x, t.a.y);
            path.lineTo(t.b.x, t.b.y);
            path.lineTo(t.c.x, t.c.y);
            path.closePath();
            return path;
        }
        if (s instanceof Ellipse) {
            Ellipse e = (Ellipse) s;
            Vec2D r = e.getRadii();
            return new Ellipse2D.Float(e.x - r.x, e.y - r.y, r.x * 2, r.y * 2);
        }
        if (!(s instanceof Polygon2D)) {
            s = s.toPolygon2D();
        }
        Polygon2D poly = (Polygon2D) s;
        Path2D path = new Path2D.Float();
        Vec2D p = poly.get(0);
        path.moveTo(p.x, p.y);
        for (int i = 1, num = poly.getNumVertices(); i < num; i++) {
            p = poly.get(i);
            path.lineTo(p.x, p.y);
        }
        path.closePath();
        return path;
    }
View Full Code Here

TOP

Related Classes of java.awt.geom.Path2D$Float$TxIterator

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.