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);
}
}
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;
}
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;
}
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;
}
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);
}
Aggregations