org.eclipse.draw2d.geometry.PointList Java Examples
The following examples show how to use
org.eclipse.draw2d.geometry.PointList.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: XPDLToProc.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
/** * @param poolPart * @param process */ private void processTransitions(WorkflowProcessType process) throws ProcBuilderException { if (process.getTransitions() != null) { for (final TransitionType transition : process.getTransitions().getTransition()) { final ConditionType transitionCondition = transition.getCondition(); String condition = ""; if (transitionCondition != null) { final FeatureMap mixed = transitionCondition.getMixed(); if (mixed.size() != 0) { condition = mixed.get(0).getValue().toString(); } } builder.addSequenceFlow(transition.getName(), transition.getFrom(), transition.getTo(), false, null, null, new PointList()); if (!condition.isEmpty()) { builder.addSequenceFlowCondition(condition, ExpressionConstants.GROOVY, ExpressionConstants.SCRIPT_TYPE); } builder.addDescription(transition.getDescription()); } } }
Example #2
Source File: IDEF1XZeroOneSourceDecoration.java From ermaster-b with Apache License 2.0 | 6 votes |
public IDEF1XZeroOneSourceDecoration() { super(); PointList pointList = new PointList(); pointList.addPoint(-1, 0); pointList.addPoint(-8, -7); pointList.addPoint(-15, 0); pointList.addPoint(-8, 7); pointList.addPoint(-1, 0); this.setTemplate(pointList); this.setScale(1, 1); Label label = new Label(); label.setText("Z"); this.add(label); }
Example #3
Source File: FiguresHelper.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
public static PointList CirclePointList(final Rectangle anchRect) { final PointList points = new PointList(NB_POINTS_DRAW_CIRCLE); final double angle = TWO_PI / NB_POINTS_DRAW_CIRCLE; final Point center = anchRect.getCenter(); final int centerX = center.x; final int centerY = center.y; final int halfWidth = anchRect.width / 2; final int halfHeight = anchRect.height / 2; double angleT = 0; while (angleT < TWO_PI) { points.addPoint((int) (halfWidth * Math.cos(angleT) + centerX), (int) (halfHeight * Math.sin(angleT) + centerY)); angleT += angle; } // add last point, the same than the first point points.addPoint((int) (halfWidth * Math.cos(0) + centerX), (int) (halfHeight * Math.sin(0) + centerY)); return points; }
Example #4
Source File: CustomANDGateway2EditPart.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected NodeFigure createNodePlate() { DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(FiguresHelper.GATEWAY_WIDTH, FiguresHelper.GATEWAY_WIDTH) { public PointList getPolygonPoints() { PointList points = new PointList(5); Rectangle anchRect = getHandleBounds(); points.addPoint(anchRect.x+anchRect.width/2,anchRect.y); points.addPoint(anchRect.x + anchRect.width, anchRect.y+anchRect.height/2); points.addPoint(anchRect.x+anchRect.width/2,anchRect.y+anchRect.height); points.addPoint(anchRect.x, anchRect.y+anchRect.height/2); points.addPoint(anchRect.x+ anchRect.width/2,anchRect.y); return points; } }; return result; }
Example #5
Source File: CursorTimingsLayer.java From nebula with Eclipse Public License 2.0 | 6 votes |
/** * Clip cursor connectors at the left/right side of the screen. This is a performance optimization for windows. When a connection is much larger than * the screen size, drawing takes ages. */ @Override public PointList getPoints() { final PointList originalPoints = super.getPoints(); if (originalPoints.size() == 2) { final Point targetPoint = originalPoints.getLastPoint(); final Rectangle layerBounds = CursorTimingsLayer.this.getBounds(); if (targetPoint.x() < layerBounds.x()) { // clip cursor on the left screen border targetPoint.setX(layerBounds.x()); originalPoints.setPoint(targetPoint, 1); } else if (targetPoint.x() > layerBounds.right()) { // clip cursor on the right screen border targetPoint.setX(layerBounds.right()); originalPoints.setPoint(targetPoint, 1); } } return originalPoints; }
Example #6
Source File: CustomXORGateway2EditPart.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected NodeFigure createNodePlate() { DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(FiguresHelper.GATEWAY_WIDTH, FiguresHelper.GATEWAY_WIDTH) { public PointList getPolygonPoints() { PointList points = new PointList(5); Rectangle anchRect = getHandleBounds(); points.addPoint(anchRect.x+anchRect.width/2,anchRect.y); points.addPoint(anchRect.x + anchRect.width, anchRect.y+anchRect.height/2); points.addPoint(anchRect.x+anchRect.width/2,anchRect.y+anchRect.height); points.addPoint(anchRect.x, anchRect.y+anchRect.height/2); points.addPoint(anchRect.x+ anchRect.width/2,anchRect.y); return points; } }; return result; }
Example #7
Source File: IntensityGraphFigure.java From nebula with Eclipse Public License 2.0 | 6 votes |
/**set Cross Position * @param x * @param y */ public void setCrossPosition(int x, int y, boolean updatedCrossDataIndex){ Rectangle bounds = getBounds(); if(x < bounds.x) crossX = bounds.x; else if(x>=bounds.x + bounds.width) crossX = bounds.x + bounds.width-1; else crossX = x; if(y < bounds.y) crossY = bounds.y; else if(y>=bounds.y + bounds.height) crossY = bounds.y + bounds.height-1; else crossY = y; inDefaultPosition = false; if(updatedCrossDataIndex){ crossDataIndex = graphArea.getDataLocation(crossX, crossY); if(croppedDataArray != null) fireProfileDataChanged(croppedDataArray, croppedDataWidth, croppedDataHeight); } hLine.setPoints(new PointList(new int[]{bounds.x,crossY, bounds.width+bounds.x, crossY})); vLine.setPoints(new PointList(new int[]{crossX, bounds.y, crossX, bounds.y + bounds.height})); crossPoint.setBounds(new Rectangle(crossX-5, crossY-5, 10,10)); }
Example #8
Source File: NoteFigure.java From ermaster-b with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected void fillShape(Graphics graphics) { graphics.setAlpha(200); Rectangle bounds = this.getBounds(); Point topRight1 = bounds.getTopRight().translate(0, RETURN_WIDTH); Point topRight2 = bounds.getTopRight().translate(-RETURN_WIDTH, 0); PointList pointList = new PointList(); pointList.addPoint(bounds.getTopLeft()); pointList.addPoint(bounds.getBottomLeft()); pointList.addPoint(bounds.getBottomRight()); pointList.addPoint(topRight1); pointList.addPoint(topRight2); pointList.addPoint(bounds.getTopLeft()); graphics.fillPolygon(pointList); }
Example #9
Source File: IETargetDecoration.java From ermaster-b with Apache License 2.0 | 6 votes |
public IETargetDecoration() { super(); PointList pointList = new PointList(); pointList.addPoint(-13, -12); pointList.addPoint(-13, 0); pointList.addPoint(-1, -12); pointList.addPoint(-13, 0); pointList.addPoint(-1, 12); pointList.addPoint(-13, 0); pointList.addPoint(-13, 12); this.setTemplate(pointList); this.setScale(0.66, 0.66); // this.setScale(1, 1); }
Example #10
Source File: DiagramElementsModifier.java From txtUML with Eclipse Public License 1.0 | 6 votes |
/** * Sets the points of a connection. * * @param connection * - The connection * @param bendpoints * - Start, end and bending points */ public static void setConnectionPoints(ConnectionNodeEditPart connection, List<Point> bendpoints) { TransactionalEditingDomain editingDomain = connection.getEditingDomain(); SetConnectionBendpointsCommand cmd = new SetConnectionBendpointsCommand(editingDomain); cmd.setEdgeAdapter(new EObjectAdapter(connection.getNotationView())); Point first = bendpoints.get(0); Point last = bendpoints.get(bendpoints.size() - 1); Point sourceRef = new Point(first.x(), first.y()); Point targetRef = new Point(last.x(), last.y()); PointList pointList = new PointList(); for (Point bendpoint : bendpoints) { pointList.addPoint(new Point(bendpoint.x(), bendpoint.y())); } cmd.setNewPointList(pointList, sourceRef, targetRef); Command proxy = new ICommandProxy(cmd); proxy.execute(); }
Example #11
Source File: CustomSequenceFlowEditPart.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private RotatableDecoration createDefaultSourceDecoration() { final PolylineDecoration df = new PolylineDecoration(); final Point startPoint = new Point(-2, -1); final Point endPoint = new Point(-1, 1); df.setFill(true); df.setLineWidth(1); df.setOutline(true); df.addPoint(startPoint); df.addPoint(endPoint); final PointList pl = new PointList(); pl.addPoint(startPoint); pl.addPoint(endPoint); df.setTemplate(pl); df.setStart(startPoint); df.setEnd(endPoint); df.setScale(getMapMode().DPtoLP(5), getMapMode().DPtoLP(5)); return df; }
Example #12
Source File: IETargetDecoration.java From ermasterr with Apache License 2.0 | 6 votes |
public IETargetDecoration() { super(); final PointList pointList = new PointList(); pointList.addPoint(-13, -12); pointList.addPoint(-13, 0); pointList.addPoint(-1, -12); pointList.addPoint(-13, 0); pointList.addPoint(-1, 12); pointList.addPoint(-13, 0); pointList.addPoint(-13, 12); setTemplate(pointList); setScale(1, 1); }
Example #13
Source File: BPMNToProc.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
private PointList computeBendpoints(final String sequenceFlowID) { final BPMNEdge edge = getBPMNEdgeFor(sequenceFlowID); final PointList bendpoints = new PointList(); if (edge != null) { /* Convert WayPoints to PointList */ final EList<org.omg.spec.dd.dc.Point> wayPoints = edge .getWaypoint(); final Point containerLocation = getContainerLocationFor( sequenceFlowID).getNegated(); for (int i = 0; i < wayPoints.size(); i++) { final org.omg.spec.dd.dc.Point ddp = wayPoints.get(i); bendpoints.insertPoint(new Point((int) ddp.getX(), (int) ddp.getY()).translate(containerLocation), i); } } return bendpoints; }
Example #14
Source File: IDEF1XZeroOneSourceDecoration.java From ermasterr with Apache License 2.0 | 6 votes |
public IDEF1XZeroOneSourceDecoration() { super(); final PointList pointList = new PointList(); pointList.addPoint(-1, 0); pointList.addPoint(-8, -7); pointList.addPoint(-15, 0); pointList.addPoint(-8, 7); pointList.addPoint(-1, 0); setTemplate(pointList); setScale(1, 1); final Label label = new Label(); label.setText("Z"); this.add(label); }
Example #15
Source File: NoteFigure.java From ermasterr with Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override protected void fillShape(final Graphics graphics) { graphics.setAlpha(200); final Rectangle bounds = getBounds(); final Point topRight1 = bounds.getTopRight().translate(0, RETURN_WIDTH); final Point topRight2 = bounds.getTopRight().translate(-RETURN_WIDTH, 0); final PointList pointList = new PointList(); pointList.addPoint(bounds.getTopLeft()); pointList.addPoint(bounds.getBottomLeft()); pointList.addPoint(bounds.getBottomRight()); pointList.addPoint(topRight1); pointList.addPoint(topRight2); pointList.addPoint(bounds.getTopLeft()); graphics.fillPolygon(pointList); }
Example #16
Source File: EllipseAnchorDefaultSizeNodeFigure.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override public PointList getPolygonPoints() { int points = 64; int radius = getSize().width / 2; Point center = getHandleBounds().getCenter(); PointList pointList = new PointList(); double slice = 2 * Math.PI / points; for (int i = 0; i < points; i++) { double angle = slice * i; int newX = (int) (center.x + radius * Math.cos(angle)); int newY = (int) (center.y + radius * Math.sin(angle)); Point p = new Point(newX, newY); pointList.addPoint(p); } return pointList; }
Example #17
Source File: ChoiceFigure.java From statecharts with Eclipse Public License 1.0 | 6 votes |
/** * @see org.eclipse.draw2d.Shape#outlineShape(org.eclipse.draw2d.Graphics) */ @Override protected void outlineShape(Graphics graphics) { graphics.pushState(); graphics.setForegroundColor(getForegroundColor()); graphics.setBackgroundColor(getBackgroundColor()); Rectangle f = Rectangle.SINGLETON; Rectangle r = getBounds(); f.x = r.x + getLineWidth() / 2; f.y = r.y + getLineWidth() / 2; f.width = r.width - getLineWidth() - 1; f.height = r.height - getLineWidth() - 1; PointList pl = new PointList(); pl.addPoint(f.getTop()); pl.addPoint(f.getRight()); pl.addPoint(f.getBottom()); pl.addPoint(f.getLeft()); graphics.drawPolygon(pl); graphics.popState(); }
Example #18
Source File: ChoiceEditPart.java From statecharts with Eclipse Public License 1.0 | 6 votes |
@Override protected NodeFigure createNodeFigure() { final NodeFigure figure = new NodeFigure() { @Override public PointList getPolygonPoints() { PointList points = new PointList(5); Rectangle handleBounds = getHandleBounds(); points.addPoint(handleBounds.x + (handleBounds.width / 2), handleBounds.y - 1); points.addPoint(handleBounds.x + handleBounds.width - 1, handleBounds.y + (handleBounds.height / 2)); points.addPoint(handleBounds.x + (handleBounds.width / 2), handleBounds.y + handleBounds.height); points.addPoint(handleBounds.x, handleBounds.y + handleBounds.height / 2); return points; } @Override public final Dimension getPreferredSize(int w, int h) { return getMinimumSize(); } }; figure.setLayoutManager(new StackLayout()); figure.add(createPrimaryShape()); figure.setBackgroundColor(org.eclipse.draw2d.ColorConstants.white); figure.setForegroundColor(org.eclipse.draw2d.ColorConstants.black); figure.setMinimumSize(getDefaultSize()); return figure; }
Example #19
Source File: WalkerNoteFigure.java From erflute with Apache License 2.0 | 5 votes |
@Override protected void fillShape(Graphics graphics) { graphics.setAlpha(200); final Rectangle bounds = getBounds(); final Point topRight1 = bounds.getTopRight().translate(0, RETURN_WIDTH); final Point topRight2 = bounds.getTopRight().translate(-RETURN_WIDTH, 0); final PointList pointList = new PointList(); pointList.addPoint(bounds.getTopLeft()); pointList.addPoint(bounds.getBottomLeft()); pointList.addPoint(bounds.getBottomRight()); pointList.addPoint(topRight1); pointList.addPoint(topRight2); pointList.addPoint(bounds.getTopLeft()); graphics.fillPolygon(pointList); }
Example #20
Source File: Animation.java From olca-app with Mozilla Public License 2.0 | 5 votes |
static boolean playbackState(Connection conn) { if (!PLAYBACK) { return false; } PointList list1 = (PointList) initialStates.get(conn); PointList list2 = (PointList) finalStates.get(conn); if (list1 == null) { conn.setVisible(false); return true; } if (list1.size() == list2.size()) { Point pt1 = new Point(), pt2 = new Point(); PointList points = conn.getPoints(); points.removeAllPoints(); for (int i = 0; i < list1.size(); i++) { list1.getPoint(pt2, i); list2.getPoint(pt1, i); pt1.x = (int) Math.round(pt1.x * progress + (1 - progress) * pt2.x); pt1.y = (int) Math.round(pt1.y * progress + (1 - progress) * pt2.y); points.addPoint(pt1); } conn.setPoints(points); } return true; }
Example #21
Source File: ConnData.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public List<PrecisionPoint> getVisualPoints() { List<PrecisionPoint> list = new ArrayList<>(); PointList pointList = conn.getPoints(); for (int i = 0; i < pointList.size(); i++) { list.add(new PrecisionPoint(pointList.getPoint(i))); } return list; }
Example #22
Source File: CustomStartEvent2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** Create a list of points to draw a circle * */ @Override protected NodeFigure createNodePlate() { final DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(FiguresHelper.EVENT_WIDTH, FiguresHelper.EVENT_WIDTH) { @Override public PointList getPolygonPoints() { final Rectangle anchRect = getHandleBounds(); return FiguresHelper.CirclePointList(anchRect); } }; return result; }
Example #23
Source File: BPMNShapeFactory.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private void attachEdgeLabel(final DecorationNode decorationNode, final BPMNEdge edge, String labelText, Edge bonitaEdge) { Font font = createFont(bonitaEdge); if (font != null) { final BPMNLabel label = DiFactory.eINSTANCE.createBPMNLabel(); Location relativeLocation = (Location) decorationNode.getLayoutConstraint(); Point offSet = new Point(relativeLocation.getX(), relativeLocation.getY()); org.eclipse.gmf.runtime.notation.Bounds absoluteBounds = NotationFactory.eINSTANCE.createBounds(); PointList pList = new PointList(); edge.getWaypoint().stream().map(wayPoint -> new PrecisionPoint(wayPoint.getX(), wayPoint.getY())) .forEach(pList::addPoint); Point referencePoint = PointListUtilities.calculatePointRelativeToLine(pList, 0, LabelViewConstants.MIDDLE_LOCATION, true); Point location = LabelHelper.calculatePointRelativeToPointOnLine(pList, referencePoint, offSet); //Here we use some default constant values to avoid a dependency on a set Display //The output diemension values are sligthly the same between windows and linux Dimension dimension = new Dimension((int) (labelText.length() * 7.42), (int) (11 * 1.6)); absoluteBounds.setWidth(dimension.width); absoluteBounds.setHeight(dimension.height); location.translate(-1 * dimension.width / 2, -1 * dimension.height / 2); absoluteBounds.setWidth(dimension.width); absoluteBounds.setHeight(dimension.height); absoluteBounds.setX(location.x); absoluteBounds.setY(location.y); final Bounds elementBounds = DcFactory.eINSTANCE.createBounds(); elementBounds.setX(absoluteBounds.getX()); elementBounds.setY(absoluteBounds.getY()); elementBounds.setHeight(absoluteBounds.getHeight()); elementBounds.setWidth(absoluteBounds.getWidth()); edge.setBPMNLabel(label); } }
Example #24
Source File: ChoiceFigure.java From statecharts with Eclipse Public License 1.0 | 5 votes |
/** * @see org.eclipse.draw2d.Shape#fillShape(org.eclipse.draw2d.Graphics) */ @Override protected void fillShape(Graphics graphics) { graphics.pushState(); graphics.setForegroundColor(getForegroundColor()); graphics.setBackgroundColor(getBackgroundColor()); PointList pl = new PointList(); pl.addPoint(getBounds().getTop()); pl.addPoint(getBounds().getRight()); pl.addPoint(getBounds().getBottom()); pl.addPoint(getBounds().getLeft()); graphics.fillPolygon(pl); graphics.popState(); }
Example #25
Source File: InitialPointsConnectionBendpointEditPolicy.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override protected Command getBendpointsChangedCommand(BendpointRequest request) { PointList originalPoints = InitialPointsOfRequestDataManager.getOriginalPoints(request); Command result = super.getBendpointsChangedCommand(request); if (result instanceof ICommandProxy) { ICommand iCommand = ((ICommandProxy) result).getICommand(); if (iCommand instanceof SetConnectionBendpointsAndLabelCommmand) { ((SetConnectionBendpointsAndLabelCommmand) iCommand).setLabelsToUpdate( (org.eclipse.gmf.runtime.diagram.ui.editparts.ConnectionEditPart) getHost(), originalPoints); } } return result; }
Example #26
Source File: FixedBendpointEditPolicy.java From statecharts with Eclipse Public License 1.0 | 5 votes |
private PointList getInitialPoints(Connection connection) { ConnData cd = router.getCD(connection); if (cd != null) { return relbpUtil.convertToPointList(cd.initialVisualPoints); } return connection.getPoints(); }
Example #27
Source File: TransitionPriorityDecorationProvider.java From statecharts with Eclipse Public License 1.0 | 5 votes |
public void createDecorators(IGraphicalEditPart editPart) { PriorityFigure figure = new PriorityFigure(MapModeUtil.getMapMode(), getPriority(editPart)); figure.setSize(12, 13); setDecoration(getDecoratorTarget().addDecoration(figure, new ConnectionLocator((Connection) editPart.getFigure(), ConnectionLocator.TARGET) { protected Point getLocation(PointList points) { Point p = PointListUtilities.pointOn(PointListUtilities.copyPoints(points), DISTANCE_TO_SOURCE, KeyPoint.ORIGIN, new Point()); return p; } }, false)); figure.setToolTip(new Label("Transition Priority " + getPriority(editPart))); }
Example #28
Source File: CustomEndTerminatedEvent2EditPart.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** Create a list of points to draw a circle * */ @Override protected NodeFigure createNodePlate() { DefaultSizeNodeFigure result = new DefaultSizeNodeFigure(FiguresHelper.EVENT_WIDTH, FiguresHelper.EVENT_WIDTH) { public PointList getPolygonPoints() { Rectangle anchRect = getHandleBounds(); return FiguresHelper.CirclePointList(anchRect); } }; return result; }
Example #29
Source File: HexagonalGridLayout.java From ice with Eclipse Public License 1.0 | 5 votes |
/** * The default constructor. Generates a 1x1 HexagonalGridLayout. */ public HexagonalGridLayout() { super(); // This constructor creates an underlying array of 0s for 6 points. points = new PointList(new int[12]); }
Example #30
Source File: IEOneDecoration.java From ermaster-b with Apache License 2.0 | 5 votes |
public IEOneDecoration() { super(); PointList pointList = new PointList(); pointList.addPoint(-13, -12); pointList.addPoint(-13, 12); this.setTemplate(pointList); this.setScale(0.66, 0.66); // this.setScale(1, 1); }