Package diva.util.java2d

Examples of diva.util.java2d.Polygon2D


            }
            return convertCoords(coords, coords.length);
        }

        if (shape instanceof Polygon2D) {
            Polygon2D p = (Polygon2D) shape;
            int n = p.getVertexCount();
            coords = new double[n * 2];
            for (int i = 0; i < n; i++) {
                coords[i * 2] = p.getX(i);
                coords[i * 2 + 1] = p.getY(i);
            }
            return convertCoords(coords, coords.length);
        }

        // For Path2D, the integer path type is inserted before the coordinates of each segment
        if (shape instanceof Path2D) {
            Path2D p = (Path2D) shape;
            StringBuffer buf = new StringBuffer();
            coords = new double[6];
            PathIterator pathIter = p.getPathIterator(null);
            while (!pathIter.isDone()) {
                int subPathType = pathIter.currentSegment(coords);
                buf.append(subPathType).append(" ");
                if (subPathType == PathIterator.SEG_MOVETO || subPathType == PathIterator.SEG_LINETO) {
                    buf.append(convertCoords(coords, 2)).append(" ");
View Full Code Here


            l1 = -l1;
            l2 = -l2;
            //at.translate(length, 0.0);
        }

        Polygon2D polygon = new Polygon2D.Double();
        polygon.moveTo(pos.x, pos.y);
        polygon.lineTo(
                pos.x + l2,
                pos.y + w);
        polygon.lineTo(
                pos.x + l1,
                pos.y);
        polygon.lineTo(
                pos.x + l2,
                pos.y - w);
        polygon.closePath();
        polygon.transform(at);
        return polygon;
    }
View Full Code Here

TOP

Related Classes of diva.util.java2d.Polygon2D

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.