/** * */ public void paint(Graphics g) { if (currentState != null && first != null) { Rectangle rect = currentState.getRectangle(); double deg = currentAngle * mxConstants.DEG_PER_RAD; if (deg != 0) { ((Graphics2D) g).rotate(Math.toRadians(deg), currentState.getCenterX(), currentState.getCenterY()); } mxUtils.setAntiAlias((Graphics2D) g, true, false); g.drawRect(rect.x, rect.y, rect.width, rect.height); } }
/** * */ public void paint(Graphics g) { if (currentState != null && first != null) { Rectangle rect = currentState.getRectangle(); double deg = currentAngle * mxConstants.DEG_PER_RAD; if (deg != 0) { ((Graphics2D) g).rotate(Math.toRadians(deg), currentState.getCenterX(), currentState.getCenterY()); } mxUtils.setAntiAlias((Graphics2D) g, true, false); g.drawRect(rect.x, rect.y, rect.width, rect.height); } }
point = new mxPoint(opposite.getCenterX(), opposite.getCenterY());
point = new mxPoint(opposite.getCenterX(), opposite.getCenterY());
/** * Returns the x-coordinate of the center point for automatic routing. * * @return Returns the x-coordinate of the routing center point. */ public double getRoutingCenterX(mxCellState state) { float f = (state.getStyle() != null) ? mxUtils.getFloat( state.getStyle(), mxConstants.STYLE_ROUTING_CENTER_X) : 0; return state.getCenterX() + f * state.getWidth(); }
/** * Returns the x-coordinate of the center point for automatic routing. * * @return Returns the x-coordinate of the routing center point. */ public double getRoutingCenterX(mxCellState state) { float f = (state.getStyle() != null) ? mxUtils.getFloat( state.getStyle(), mxConstants.STYLE_ROUTING_CENTER_X) : 0; return state.getCenterX() + f * state.getWidth(); }
int cx = (int) Math.round(state.getCenterX()); int cy = (int) Math.round(state.getCenterY()); int width = (int) Math.round(state.getWidth());
int cx = (int) Math.round(state.getCenterX()); int cy = (int) Math.round(state.getCenterY()); int width = (int) Math.round(state.getWidth());
e.getPoint(), graphComponent.getGraphControl()); double cx = currentState.getCenterX(); double cy = currentState.getCenterY(); double dx = pt.getX() - cx;
e.getPoint(), graphComponent.getGraphControl()); double cx = currentState.getCenterX(); double cy = currentState.getCenterY(); double dx = pt.getX() - cx;
int x = (int)(state.getCenterX() - state.getWidth() / 2); int y = (int)(state.getCenterY()); Image img = Toolkit.getDefaultToolkit().getImage(<PATH TO YOUR IMAGE>);
/** * */ public mxPoint[] createPoints(mxGraphics2DCanvas canvas, mxCellState state) { String direction = mxUtils.getString(state.getStyle(), mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST); mxPoint p0, pe; if (direction.equals(mxConstants.DIRECTION_EAST) || direction.equals(mxConstants.DIRECTION_WEST)) { double mid = state.getCenterY(); p0 = new mxPoint(state.getX(), mid); pe = new mxPoint(state.getX() + state.getWidth(), mid); } else { double mid = state.getCenterX(); p0 = new mxPoint(mid, state.getY()); pe = new mxPoint(mid, state.getY() + state.getHeight()); } mxPoint[] points = new mxPoint[2]; points[0] = p0; points[1] = pe; return points; }
/** * */ public mxPoint[] createPoints(mxGraphics2DCanvas canvas, mxCellState state) { String direction = mxUtils.getString(state.getStyle(), mxConstants.STYLE_DIRECTION, mxConstants.DIRECTION_EAST); mxPoint p0, pe; if (direction.equals(mxConstants.DIRECTION_EAST) || direction.equals(mxConstants.DIRECTION_WEST)) { double mid = state.getCenterY(); p0 = new mxPoint(state.getX(), mid); pe = new mxPoint(state.getX() + state.getWidth(), mid); } else { double mid = state.getCenterX(); p0 = new mxPoint(mid, state.getY()); pe = new mxPoint(mid, state.getY() + state.getHeight()); } mxPoint[] points = new mxPoint[2]; points[0] = p0; points[1] = pe; return points; }
/** * Updates the style of the edge preview from the incoming edge */ public void start(MouseEvent e, mxCellState startState, String style) { mxGraph graph = graphComponent.getGraph(); sourceState = startState; startPoint = transformScreenPoint(startState.getCenterX(), startState.getCenterY()); Object cell = createCell(startState, style); graph.getView().validateCell(cell); previewState = graph.getView().getState(cell); fireEvent(new mxEventObject(mxEvent.START, "event", e, "state", previewState)); }
/** * Updates the style of the edge preview from the incoming edge */ public void start(MouseEvent e, mxCellState startState, String style) { mxGraph graph = graphComponent.getGraph(); sourceState = startState; startPoint = transformScreenPoint(startState.getCenterX(), startState.getCenterY()); Object cell = createCell(startState, style); graph.getView().validateCell(cell); previewState = graph.getView().getState(cell); fireEvent(new mxEventObject(mxEvent.START, "event", e, "state", previewState)); }
int x = (int) source.getCenterX() - imgWidth / 2; int y = (int) source.getCenterY() - imgHeight / 2;
int x = (int) source.getCenterX() - imgWidth / 2; int y = (int) source.getCenterY() - imgHeight / 2;
canvas.rotate(rotation, flipH, flipV, state.getCenterX(), state.getCenterY());
double x = state.getCenterX(); double y = state.getCenterY();
double x = state.getCenterX(); double y = state.getCenterY();