/** * */ protected Point[] createPoints(mxCellState s) { Point[] pts = new Point[s.getAbsolutePointCount()]; for (int i = 0; i < pts.length; i++) { pts[i] = s.getAbsolutePoint(i).getPoint(); } return pts; }
/** * */ protected Point[] createPoints(mxCellState s) { Point[] pts = new Point[s.getAbsolutePointCount()]; for (int i = 0; i < pts.length; i++) { pts[i] = s.getAbsolutePoint(i).getPoint(); } return pts; }
/** * Returns the Euclidean length of the edge defined by the absolute * points in the given state or 0 if no points are defined. */ public double getCost(mxCellState state) { double cost = 0; int pointCount = state.getAbsolutePointCount(); if (pointCount > 0) { mxPoint last = state.getAbsolutePoint(0); for (int i = 1; i < pointCount; i++) { mxPoint point = state.getAbsolutePoint(i); cost += point.getPoint().distance(last.getPoint()); last = point; } } return cost; } }
/** * Returns the Euclidean length of the edge defined by the absolute * points in the given state or 0 if no points are defined. */ public double getCost(mxCellState state) { double cost = 0; int pointCount = state.getAbsolutePointCount(); if (pointCount > 0) { mxPoint last = state.getAbsolutePoint(0); for (int i = 1; i < pointCount; i++) { mxPoint point = state.getAbsolutePoint(i); cost += point.getPoint().distance(last.getPoint()); last = point; } } return cost; } }
/** * */ public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Stroke stroke = g2.getStroke(); g2.setStroke(getSelectionStroke()); g.setColor(getSelectionColor()); Point last = state.getAbsolutePoint(0).getPoint(); for (int i = 1; i < state.getAbsolutePointCount(); i++) { Point current = state.getAbsolutePoint(i).getPoint(); Line2D line = new Line2D.Float(last.x, last.y, current.x, current.y); Rectangle bounds = g2.getStroke().createStrokedShape(line) .getBounds(); if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) { g2.draw(line); } last = current; } g2.setStroke(stroke); super.paint(g); }
/** * */ public void paint(Graphics g) { Graphics2D g2 = (Graphics2D) g; Stroke stroke = g2.getStroke(); g2.setStroke(getSelectionStroke()); g.setColor(getSelectionColor()); Point last = state.getAbsolutePoint(0).getPoint(); for (int i = 1; i < state.getAbsolutePointCount(); i++) { Point current = state.getAbsolutePoint(i).getPoint(); Line2D line = new Line2D.Float(last.x, last.y, current.x, current.y); Rectangle bounds = g2.getStroke().createStrokedShape(line) .getBounds(); if (g.hitClip(bounds.x, bounds.y, bounds.width, bounds.height)) { g2.draw(line); } last = current; } g2.setStroke(stroke); super.paint(g); }
/** * Paints the outline of the markedState with the currentColor. */ public void paint(Graphics g) { if (markedState != null && currentColor != null) { ((Graphics2D) g).setStroke(DEFAULT_STROKE); g.setColor(currentColor); if (markedState.getAbsolutePointCount() > 0) { Point last = markedState.getAbsolutePoint(0).getPoint(); for (int i = 1; i < markedState.getAbsolutePointCount(); i++) { Point current = markedState.getAbsolutePoint(i).getPoint(); g.drawLine(last.x - getX(), last.y - getY(), current.x - getX(), current.y - getY()); last = current; } } else { g.drawRect(1, 1, getWidth() - 3, getHeight() - 3); } } }
/** * Paints the outline of the markedState with the currentColor. */ public void paint(Graphics g) { if (markedState != null && currentColor != null) { ((Graphics2D) g).setStroke(DEFAULT_STROKE); g.setColor(currentColor); if (markedState.getAbsolutePointCount() > 0) { Point last = markedState.getAbsolutePoint(0).getPoint(); for (int i = 1; i < markedState.getAbsolutePointCount(); i++) { Point current = markedState.getAbsolutePoint(i).getPoint(); g.drawLine(last.x - getX(), last.y - getY(), current.x - getX(), current.y - getY()); last = current; } } else { g.drawRect(1, 1, getWidth() - 3, getHeight() - 3); } } }
/** * */ protected Rectangle[] createHandles() { p = createPoints(state); Rectangle[] h = new Rectangle[p.length + 1]; for (int i = 0; i < h.length - 1; i++) { h[i] = createHandle(p[i]); } h[p.length] = createHandle(state.getAbsoluteOffset().getPoint(), mxConstants.LABEL_HANDLE_SIZE); return h; }
/** * */ protected Rectangle[] createHandles() { p = createPoints(state); Rectangle[] h = new Rectangle[p.length + 1]; for (int i = 0; i < h.length - 1; i++) { h[i] = createHandle(p[i]); } h[p.length] = createHandle(state.getAbsoluteOffset().getPoint(), mxConstants.LABEL_HANDLE_SIZE); return h; }
e.getLocation(), graphComponent.getGraphControl()); pt = graphComponent.snapScaledPoint(new mxPoint(pt)).getPoint(); handler.setLocation(new Point(pt));
e.getLocation(), graphComponent.getGraphControl()); pt = graphComponent.snapScaledPoint(new mxPoint(pt)).getPoint(); handler.setLocation(new Point(pt));
EdgeDragContextMenu edcm = new EdgeDragContextMenu(((BpmnGraph) graphComponent.getGraph()).getModelContainer(), ((mxICell) connectPreview.getPreviewState().getCell()).getTerminal(true), graphComponent.getPointForEvent(e).getPoint(), actionlistener); edcmc[0] = edcm;