Search in sources :

Example 1 with Polygon

use of java.awt.Polygon in project Activiti by Activiti.

the class DefaultProcessDiagramCanvas method drawEventBasedGateway.

public void drawEventBasedGateway(GraphicInfo graphicInfo, double scaleFactor) {
    // rhombus
    drawGateway(graphicInfo);
    if (scaleFactor == 1.0) {
        int x = (int) graphicInfo.getX();
        int y = (int) graphicInfo.getY();
        int width = (int) graphicInfo.getWidth();
        int height = (int) graphicInfo.getHeight();
        double scale = .6;
        GraphicInfo eventInfo = new GraphicInfo();
        eventInfo.setX(x + width * (1 - scale) / 2);
        eventInfo.setY(y + height * (1 - scale) / 2);
        eventInfo.setWidth(width * scale);
        eventInfo.setHeight(height * scale);
        drawCatchingEvent(eventInfo, true, null, "eventGateway", scaleFactor);
        double r = width / 6.;
        // create pentagon (coords with respect to center)
        // top right corner
        int topX = (int) (.95 * r);
        int topY = (int) (-.31 * r);
        // bottom right corner
        int bottomX = (int) (.59 * r);
        int bottomY = (int) (.81 * r);
        int[] xPoints = new int[] { 0, topX, bottomX, -bottomX, -topX };
        int[] yPoints = new int[] { -(int) r, topY, bottomY, bottomY, topY };
        Polygon pentagon = new Polygon(xPoints, yPoints, 5);
        pentagon.translate(x + width / 2, y + width / 2);
        // draw
        g.drawPolygon(pentagon);
    }
}
Also used : GraphicInfo(org.activiti.bpmn.model.GraphicInfo) Polygon(java.awt.Polygon) Point(java.awt.Point) Paint(java.awt.Paint)

Example 2 with Polygon

use of java.awt.Polygon in project android by JetBrains.

the class ConnectionDraw method getBottomArrow.

/**
     * Static accessor to the bottom arrow
     *
     * @return return a Polygon representing a bottom arrow
     */
public static Polygon getBottomArrow() {
    if (sBottomArrow == null) {
        sBottomArrow = new Polygon();
        sBottomArrow.addPoint(0, 0);
        sBottomArrow.addPoint(-CONNECTION_ARROW_SIZE, -ARROW_SIDE);
        sBottomArrow.addPoint(+CONNECTION_ARROW_SIZE, -ARROW_SIDE);
    }
    return sBottomArrow;
}
Also used : Polygon(java.awt.Polygon)

Example 3 with Polygon

use of java.awt.Polygon in project android by JetBrains.

the class ConnectionDraw method getLeftArrow.

/**
     * Static accessor to the left arrow
     *
     * @return return a Polygon representing a left arrow
     */
public static Polygon getLeftArrow() {
    if (sLeftArrow == null) {
        sLeftArrow = new Polygon();
        sLeftArrow.addPoint(0, 0);
        sLeftArrow.addPoint(ARROW_SIDE, -CONNECTION_ARROW_SIZE);
        sLeftArrow.addPoint(ARROW_SIDE, +CONNECTION_ARROW_SIZE);
    }
    return sLeftArrow;
}
Also used : Polygon(java.awt.Polygon)

Example 4 with Polygon

use of java.awt.Polygon in project android by JetBrains.

the class ConnectionDraw method getRightArrow.

/**
     * Static accessor to the right arrow
     *
     * @return return a Polygon representing a right arrow
     */
public static Polygon getRightArrow() {
    if (sRightArrow == null) {
        sRightArrow = new Polygon();
        sRightArrow.addPoint(0, 0);
        sRightArrow.addPoint(-ARROW_SIDE, -CONNECTION_ARROW_SIZE);
        sRightArrow.addPoint(-ARROW_SIDE, +CONNECTION_ARROW_SIZE);
    }
    return sRightArrow;
}
Also used : Polygon(java.awt.Polygon)

Example 5 with Polygon

use of java.awt.Polygon in project adempiere by adempiere.

the class AdempiereTabbedPaneUI method createCroppedTabClip.

private Polygon createCroppedTabClip(int tabPlacement, Rectangle tabRect, int cropline) {
    int rlen = 0;
    int start = 0;
    int end = 0;
    int ostart = 0;
    switch(tabPlacement) {
        case LEFT:
        case RIGHT:
            rlen = tabRect.width;
            start = tabRect.x;
            end = tabRect.x + tabRect.width;
            ostart = tabRect.y;
            break;
        case TOP:
        case BOTTOM:
        default:
            rlen = tabRect.height;
            start = tabRect.y;
            end = tabRect.y + tabRect.height;
            ostart = tabRect.x;
    }
    int rcnt = rlen / CROP_SEGMENT;
    if (rlen % CROP_SEGMENT > 0) {
        rcnt++;
    }
    int npts = 2 + (rcnt * 8);
    int[] xp = new int[npts];
    int[] yp = new int[npts];
    int pcnt = 0;
    xp[pcnt] = ostart;
    yp[pcnt++] = end;
    xp[pcnt] = ostart;
    yp[pcnt++] = start;
    for (int i = 0; i < rcnt; i++) {
        for (int j = 0; j < xCropLen.length; j++) {
            xp[pcnt] = cropline - xCropLen[j];
            yp[pcnt] = start + (i * CROP_SEGMENT) + yCropLen[j];
            if (yp[pcnt] >= end) {
                yp[pcnt] = end;
                pcnt++;
                break;
            }
            pcnt++;
        }
    }
    if (tabPlacement == SwingConstants.TOP || tabPlacement == SwingConstants.BOTTOM) {
        return new Polygon(xp, yp, pcnt);
    }
    //LEFT or RIGHT
    return new Polygon(yp, xp, pcnt);
}
Also used : Polygon(java.awt.Polygon) Point(java.awt.Point)

Aggregations

Polygon (java.awt.Polygon)184 Point (java.awt.Point)51 Rectangle (java.awt.Rectangle)29 Graphics2D (java.awt.Graphics2D)25 ArrayList (java.util.ArrayList)20 Color (java.awt.Color)19 Area (java.awt.geom.Area)19 BasicStroke (java.awt.BasicStroke)17 Paint (java.awt.Paint)11 AffineTransform (java.awt.geom.AffineTransform)11 LocalPoint (net.runelite.api.coords.LocalPoint)11 Point2D (java.awt.geom.Point2D)10 Point (net.runelite.api.Point)10 FloatPolygon (ij.process.FloatPolygon)9 HashSet (java.util.HashSet)7 List (java.util.List)7 Font (java.awt.Font)6 FontMetrics (java.awt.FontMetrics)6 GradientPaint (java.awt.GradientPaint)6 PathIterator (java.awt.geom.PathIterator)6