Examples of PaintedShape


Examples of diva.util.java2d.PaintedShape

        Polygon2D polygon = new Polygon2D.Double();
        polygon.moveTo(30, 50);
        polygon.lineTo(70, 80);
        polygon.lineTo(70, 20);
        graphic.add(new PaintedShape(polygon, Color.red, 1.0f));

        Line2D line1 = new Line2D.Double(10, 50, 30, 50);
        graphic.add(new PaintedPath(line1));

        Line2D line2 = new Line2D.Double(70, 50, 90, 50);
View Full Code Here

Examples of diva.util.java2d.PaintedShape

    public static PaintedObject createPaintedObject(String type,
            Map attributes, String content) {
        double[] coords = parseCoordString((String) attributes.get("coords"));

        if (type.equals("rectangle")) {
            PaintedShape ps = new PaintedShape(new Rectangle2D.Double(
                    coords[0], coords[1], coords[2], coords[3]));
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("ellipse")) {
            PaintedShape ps = new PaintedShape(new Ellipse2D.Double(coords[0],
                    coords[1], coords[2], coords[3]));
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("polygon")) {
            Polygon2D poly = new Polygon2D.Double();
            poly.moveTo(coords[0], coords[1]);

            for (int i = 2; i < coords.length; i += 2) {
                poly.lineTo(coords[i], coords[i + 1]);
            }

            poly.closePath();

            PaintedShape ps = new PaintedShape(poly);
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("line")) {
            Shape s;
View Full Code Here

Examples of diva.util.java2d.PaintedShape

     */
    public static PaintedObject createPaintedObject(String type, Map attributes) {
        double[] coords = parseCoordString((String) attributes.get("coords"));

        if (type.equals("rectangle")) {
            PaintedShape ps = new PaintedShape(new Rectangle2D.Double(
                    coords[0], coords[1], coords[2], coords[3]));
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("ellipse")) {
            PaintedShape ps = new PaintedShape(new Ellipse2D.Double(coords[0],
                    coords[1], coords[2], coords[3]));
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("polygon")) {
            Polygon2D poly = new Polygon2D.Double();
            poly.moveTo(coords[0], coords[1]);

            for (int i = 2; i < coords.length; i += 2) {
                poly.lineTo(coords[i], coords[i + 1]);
            }

            poly.closePath();

            PaintedShape ps = new PaintedShape(poly);
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("line")) {
            Shape s;

View Full Code Here

Examples of diva.util.java2d.PaintedShape

            Polygon2D polygon = new Polygon2D.Double();
            polygon.moveTo(30, 50);
            polygon.lineTo(70, 80);
            polygon.lineTo(70, 20);
            graphic.add(new PaintedShape(polygon, Color.red, 1.0f));

            Line2D line1 = new Line2D.Double(10, 50, 30, 50);
            graphic.add(new PaintedPath(line1));

            Line2D line2 = new Line2D.Double(70, 50, 90, 50);
View Full Code Here

Examples of diva.util.java2d.PaintedShape

    /** Create a new figure at the given coordinates. The figure, by
     *  default, has a unit-width continuous black outline and no fill.
     */
    public StateBubble(double x, double y, double width, double height) {
        Shape s = new Ellipse2D.Double(x, y, width, height);
        _outsideEllipse = new PaintedShape(s);
    }
View Full Code Here

Examples of diva.util.java2d.PaintedShape

     * given fill.
     */
    public StateBubble(double x, double y, double width, double height,
            Paint fill) {
        Shape s = new Ellipse2D.Double(x, y, width, height);
        _outsideEllipse = new PaintedShape(s, fill);
    }
View Full Code Here

Examples of diva.util.java2d.PaintedShape

                    .getY()
                    + _spacing, bounds.getWidth() - (2 * _spacing), bounds
                    .getHeight()
                    - (2 * _spacing));

            _insideEllipse = new PaintedShape(s);
            _outsideEllipse.setLineWidth(1);
            break;

        case FINAL_STATE:

View Full Code Here

Examples of diva.util.java2d.PaintedShape

            x = _getDouble(attributes, "x", 0);
            y = _getDouble(attributes, "y", 0);
            width = _getDouble(attributes, "width");
            height = _getDouble(attributes, "height");

            PaintedShape ps = new PaintedShape(new Rectangle2D.Double(x, y,
                    width, height));
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("circle")) {
            double cx;
            double cy;
            double r;
            cx = _getDouble(attributes, "cx", 0);
            cy = _getDouble(attributes, "cy", 0);
            r = _getDouble(attributes, "r");

            PaintedShape ps = new PaintedShape(new Ellipse2D.Double(cx - r, cy
                    - r, 2 * r, 2 * r));
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("ellipse")) {
            double cx;
            double cy;
            double rx;
            double ry;
            cx = _getDouble(attributes, "cx", 0);
            cy = _getDouble(attributes, "cy", 0);
            rx = _getDouble(attributes, "rx");
            ry = _getDouble(attributes, "ry");

            PaintedShape ps = new PaintedShape(new Ellipse2D.Double(cx - rx, cy
                    - ry, 2 * rx, 2 * ry));
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("line")) {
            double x1;
            double y1;
            double x2;
            double y2;
            x1 = _getDouble(attributes, "x1", 0);
            y1 = _getDouble(attributes, "y1", 0);
            x2 = _getDouble(attributes, "x2", 0);
            y2 = _getDouble(attributes, "y2", 0);

            Line2D line = new Line2D.Double(x1, y1, x2, y2);
            PaintedPath pp = new PaintedPath(line);
            processPaintedPathAttributes(pp, attributes);
            return pp;
        } else if (type.equals("polyline")) {
            double[] coords = parseCoordString((String) attributes
                    .get("points"));
            Polyline2D poly = new Polyline2D.Double();
            poly.moveTo(coords[0], coords[1]);

            for (int i = 2; i < coords.length; i += 2) {
                poly.lineTo(coords[i], coords[i + 1]);
            }

            PaintedPath pp = new PaintedPath(poly);
            processPaintedPathAttributes(pp, attributes);
            return pp;
        } else if (type.equals("polygon")) {
            double[] coords = parseCoordString((String) attributes
                    .get("points"));
            Polygon2D poly = new Polygon2D.Double();
            poly.moveTo(coords[0], coords[1]);

            for (int i = 2; i < coords.length; i += 2) {
                poly.lineTo(coords[i], coords[i + 1]);
            }

            poly.closePath();

            PaintedShape ps = new PaintedShape(poly);
            processPaintedShapeAttributes(ps, attributes);
            return ps;
        } else if (type.equals("text")) {
            double x;
            double y;
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.