Examples of Polygon


Examples of java.awt.Polygon

                this(n, d, xp, yp, (AffineTransform) null);
            }

            public Poly(String n, String d, int[] xp, int[] yp,
                    AffineTransform af) {
                super(n, d, new Polygon(xp, yp, xp.length), af);
            }
View Full Code Here

Examples of java.awt.Polygon

            /*
             * very crude technique just break each segment up into
             * steps lines
             */
            Polygon p = new Polygon();
            p.addPoint((int) Math.round(X[0].eval(0)),
                    (int) Math.round(Y[0].eval(0)));
            for (int i = 0; i < X.length; i++) {
                for (int j = 1; j <= steps; j++) {
                    float u = j / (float) steps;
                    p.addPoint(Math.round(X[i].eval(u)),
                            Math.round(Y[i].eval(u)));
                }
            }

            // copy polygon points to the return array
View Full Code Here

Examples of java.awt.Polygon

            /*
             * very crude technique just break each segment up into
             * steps lines
             */
            Polygon p = new Polygon();
            p.addPoint((int) Math.round(X[0].eval(0)),
                    (int) Math.round(Y[0].eval(0)));
            for (int i = 0; i < X.length; i++) {
                for (int j = 1; j <= steps; j++) {
                    float u = j / (float) steps;
                    p.addPoint(Math.round(X[i].eval(u)),
                            Math.round(Y[i].eval(u)));
                }
            }

            res = new float[p.npoints * 2];
 
View Full Code Here

Examples of java.awt.Polygon

                height = fm.getAscent();
                descent = 0;
            }

            int nLines = parsedData.length;
            polyBounds = new Polygon();

            computeStringWidths(fm);

            int baselineOffset = 0; // baseline == BASELINE_BOTTOM,
            // normal.
View Full Code Here

Examples of java.awt.Polygon

        g.setStroke(stroke);
        g.drawLine(0, middleY, width, middleY);

        int upTip = (int) ((float) height * .25);
        int downTip = (int) ((float) height * .75);
        Polygon poly = null;
        if (arrowHeadType == OMArrowHead.ARROWHEAD_DIRECTION_FORWARD
                || arrowHeadType == OMArrowHead.ARROWHEAD_DIRECTION_BOTH) {
            int rightWingX = (int) ((float) width * .75);
            poly = new Polygon(new int[] { width, rightWingX, rightWingX }, new int[] {
                    middleY, upTip, downTip }, 3);
            g.fill(poly);
            g.draw(poly); // Seems to help with rendering problem.
        }

        if (arrowHeadType == OMArrowHead.ARROWHEAD_DIRECTION_BACKWARD
                || arrowHeadType == OMArrowHead.ARROWHEAD_DIRECTION_BOTH) {
            int leftWingX = (int) ((float) width * .25);
            poly = new Polygon(new int[] { 0, leftWingX, leftWingX }, new int[] {
                    middleY, upTip, downTip }, 3);
            g.fill(poly);
            g.draw(poly); // Seems to help with rendering problem.
        }

View Full Code Here

Examples of java.awt.Polygon

        da2.setLinePaint(Color.lightGray);
        da2.setStroke(new BasicStroke(2));

        int[] xpoints = new int[] { 15, 15, 50, 50, 90, 50, 50, 15 };
        int[] ypoints = new int[] { 30, 70, 70, 90, 50, 10, 30, 30 };
        Shape shape = new Polygon(xpoints, ypoints, xpoints.length);

        BasicIconPart testPart = new BasicIconPart(shape);
        testPart.setRenderingAttributes(da);
        testPart.setGradient(true);
View Full Code Here

Examples of java.awt.Polygon

        ip.setRenderingAttributes(invisDa);
        invisibleImage = OMIconFactory.getIcon(buttonSize, buttonSize, ip);

        IconPartList ipl = new IconPartList();

        Polygon triangle = new Polygon(new int[] { 50, 90, 10, 50 }, new int[] {
                10, 90, 90, 10 }, 4);

        BasicIconPart bip = new BasicIconPart(triangle);
        bip.setRenderingAttributes(yellowDa);
        ipl.add(bip);
View Full Code Here

Examples of java.awt.Polygon

    int[] py = new int[edges];
    for (int i=0; i<edges; ++i) {
      px[i] = _ox + _x + (int)Math.round((x[i] + 1.0) * (_w-1) / 2.0); // From 0 to width-1, included
      py[i] = _oy + _y -1 - (int)Math.round((y[i] + 1.0) * (_h-1) / 2.0); // From 0 to height-1, included
    }
    polygon = new Polygon(px,py,edges);
  }
View Full Code Here

Examples of java.awt.Polygon

        double  theta = Math.atan2((slopeEndposY-posY),(slopeEndposX-posX));

        AffineTransform affineTransform = new AffineTransform();
        affineTransform.setToTranslation(slopeEndposX, slopeEndposY);
        affineTransform.rotate(theta);
        Polygon first = new Polygon(new int[] {-5,0,-5},new int[] {2,0,-2},3);
        Shape firstArrow = affineTransform.createTransformedShape(first);
        g2.fill(firstArrow);
        g2.draw(firstArrow);

        // Restore old preferences
View Full Code Here

Examples of java.awt.Polygon

    /* (non-Javadoc)
     * @see jsynoptic.plugins.circuit.RectangleCircuitComponent#createSymbol()
     */
    protected Polygon[] createSymbol(){
        Polygon[] res = new Polygon[2];
        res[0] = new Polygon(new int[] {3,6,6,8,6,6,3},new int[] {4,4,3,5,7,6,6},7);
        res[1] = new Polygon(new int[] {1,1,3,3,2,2,3,3},new int[] {2,8,8,7,7,3,3,2},8);

        return res;
    }
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.