mxCellState gatewayState = graph.getView().getState(gatewayVertex); mxPoint northPoint = new mxPoint(gatewayState.getX() + (gatewayState.getWidth()) / 2, gatewayState.getY()); mxPoint southPoint = new mxPoint(gatewayState.getX() + (gatewayState.getWidth()) / 2, gatewayState.getY() + gatewayState.getHeight()); mxPoint eastPoint = new mxPoint(gatewayState.getX() + gatewayState.getWidth(), gatewayState.getY() + (gatewayState.getHeight()) / 2); mxPoint westPoint = new mxPoint(gatewayState.getX(), gatewayState.getY() + (gatewayState.getHeight()) / 2);
protected void handleBoundaryEvents() { for (BoundaryEvent boundaryEvent : boundaryEvents) { mxGeometry geometry = new mxGeometry(0.8, 1.0, eventSize, eventSize); geometry.setOffset(new mxPoint(-(eventSize / 2), -(eventSize / 2))); geometry.setRelative(true); mxCell boundaryPort = new mxCell(null, geometry, "shape=ellipse;perimter=ellipsePerimeter"); boundaryPort.setId("boundary-event-" + boundaryEvent.getId()); boundaryPort.setVertex(true); Object portParent = null; if (boundaryEvent.getAttachedToRefId() != null) { portParent = generatedVertices.get(boundaryEvent.getAttachedToRefId()); } else if (boundaryEvent.getAttachedToRef() != null) { portParent = generatedVertices.get(boundaryEvent.getAttachedToRef().getId()); } else { throw new RuntimeException("Could not generate DI: boundaryEvent '" + boundaryEvent.getId() + "' has no attachedToRef"); } graph.addCell(boundaryPort, portParent); generatedVertices.put(boundaryEvent.getId(), boundaryPort); } }
/** * Sets the current translate. */ public void setTranslate(double dx, double dy) { translate = new mxPoint(dx, dy); }
/** * Rotates the given point by the given cos and sin. */ public static mxPoint getRotatedPoint(mxPoint pt, double cos, double sin) { return getRotatedPoint(pt, cos, sin, new mxPoint()); }
/** * Rotates the given point by the given cos and sin. */ public static mxPoint getRotatedPoint(mxPoint pt, double cos, double sin) { return getRotatedPoint(pt, cos, sin, new mxPoint()); }
/** * */ protected void route(Object edge, double x, double y) { if (graph.isCellMovable(edge)) { setEdgePoints(edge, Arrays.asList(new mxPoint[] { new mxPoint(x, y) })); } }
/** * */ protected void route(Object edge, double x, double y) { if (graph.isCellMovable(edge)) { setEdgePoints(edge, Arrays.asList(new mxPoint[] { new mxPoint(x, y) })); } }
/** * @param t 0 <= t <= 1 */ public mxPoint getPoint(double t) { mxPoint result = new mxPoint(splineX.getValue(t), splineY.getValue(t)); return result; }
/** * @param t 0 <= t <= 1 */ public mxPoint getPoint(double t) { mxPoint result = new mxPoint(splineX.getValue(t), splineY.getValue(t)); return result; }
public mxPoint paintMarker(mxGraphics2DCanvas canvas, mxCellState state, String type, mxPoint pe, double nx, double ny, double size, boolean source) { double cx = pe.getX() - nx / 2; double cy = pe.getY() - ny / 2; double a = size / 2; Shape shape = new Ellipse2D.Double(cx - a, cy - a, size, size); if (mxUtils.isTrue(state.getStyle(), (source) ? "startFill" : "endFill", true)) { canvas.fillShape(shape); } canvas.getGraphics().draw(shape); return new mxPoint(-nx / 2, -ny / 2); } });
public mxPoint paintMarker(mxGraphics2DCanvas canvas, mxCellState state, String type, mxPoint pe, double nx, double ny, double size, boolean source) { double cx = pe.getX() - nx / 2; double cy = pe.getY() - ny / 2; double a = size / 2; Shape shape = new Ellipse2D.Double(cx - a, cy - a, size, size); if (mxUtils.isTrue(state.getStyle(), (source) ? "startFill" : "endFill", true)) { canvas.fillShape(shape); } canvas.getGraphics().draw(shape); return new mxPoint(-nx / 2, -ny / 2); } });
/** * Paints the marker. */ public mxPoint paintMarker(mxGraphics2DCanvas canvas, mxCellState state, String type, mxPoint pe, double nx, double ny, double size, boolean source) { double nx2 = nx * 0.5; double ny2 = ny * 0.5; Line2D line = new Line2D.Double(pe.getX() + ny2 - 0.3 * nx, pe.getY() + nx2 - 0.3 * ny, pe.getX() - nx - ny2, pe.getY() - nx2 - ny); Line2D line2 = new Line2D.Double(pe.getX(), pe.getY(), pe.getX() - nx, pe.getY() - ny); canvas.getGraphics().draw(line); canvas.getGraphics().draw(line2); return new mxPoint(-nx, -ny); }
/** * Returns an mxPoint representing the given event in the unscaled, * non-translated coordinate space and applies the grid. */ public mxPoint getPointForEvent(MouseEvent e, boolean addOffset) { double s = graph.getView().getScale(); mxPoint tr = graph.getView().getTranslate(); double off = (addOffset) ? graph.getGridSize() / 2 : 0; double x = graph.snap(e.getX() / s - tr.getX() - off); double y = graph.snap(e.getY() / s - tr.getY() - off); return new mxPoint(x, y); }
/** * Returns an mxPoint representing the given event in the unscaled, * non-translated coordinate space and applies the grid. */ public mxPoint getPointForEvent(MouseEvent e, boolean addOffset) { double s = graph.getView().getScale(); mxPoint tr = graph.getView().getTranslate(); double off = (addOffset) ? graph.getGridSize() / 2 : 0; double x = graph.snap(e.getX() / s - tr.getX() - off); double y = graph.snap(e.getY() / s - tr.getY() - off); return new mxPoint(x, y); }
/** * Rotates the given point by the given cos and sin. */ public static mxPoint getRotatedPoint(mxPoint pt, double cos, double sin, mxPoint c) { double x = pt.getX() - c.getX(); double y = pt.getY() - c.getY(); double x1 = x * cos - y * sin; double y1 = y * cos + x * sin; return new mxPoint(x1 + c.getX(), y1 + c.getY()); }
/** * Rotates the given point by the given cos and sin. */ public static mxPoint getRotatedPoint(mxPoint pt, double cos, double sin, mxPoint c) { double x = pt.getX() - c.getX(); double y = pt.getY() - c.getY(); double x1 = x * cos - y * sin; double y1 = y * cos + x * sin; return new mxPoint(x1 + c.getX(), y1 + c.getY()); }
/** * Transforms the given control point to an absolute point. */ public mxPoint transformControlPoint(mxCellState state, mxPoint pt) { mxPoint origin = state.getOrigin(); return new mxPoint(scale * (pt.getX() + translate.getX() + origin.getX()), scale * (pt.getY() + translate.getY() + origin.getY())); }
/** * Transforms the given control point to an absolute point. */ public mxPoint transformControlPoint(mxCellState state, mxPoint pt) { mxPoint origin = state.getOrigin(); return new mxPoint(scale * (pt.getX() + translate.getX() + origin.getX()), scale * (pt.getY() + translate.getY() + origin.getY())); }
/** * */ protected mxPoint transformScreenPoint(double x, double y) { mxGraph graph = graphComponent.getGraph(); mxPoint tr = graph.getView().getTranslate(); double scale = graph.getView().getScale(); return new mxPoint(graph.snap(x / scale - tr.getX()), graph.snap(y / scale - tr.getY())); }
/** * */ protected mxPoint transformScreenPoint(double x, double y) { mxGraph graph = graphComponent.getGraph(); mxPoint tr = graph.getView().getTranslate(); double scale = graph.getView().getScale(); return new mxPoint(graph.snap(x / scale - tr.getX()), graph.snap(y / scale - tr.getY())); }