/** * Returns the absolute center point along the given edge. */ public mxPoint getPoint(mxCellState state) { return getPoint(state, null); }
/** * Returns the absolute center point along the given edge. */ public mxPoint getPoint(mxCellState state) { return getPoint(state, null); }
/** * */ public Rectangle getFoldingIconBounds(mxCellState state, ImageIcon icon) { mxIGraphModel model = graph.getModel(); boolean isEdge = model.isEdge(state.getCell()); double scale = getGraph().getView().getScale(); int x = (int) Math.round(state.getX() + 4 * scale); int y = (int) Math.round(state.getY() + 4 * scale); int w = (int) Math.max(8, icon.getIconWidth() * scale); int h = (int) Math.max(8, icon.getIconHeight() * scale); if (isEdge) { mxPoint pt = graph.getView().getPoint(state); x = (int) pt.getX() - w / 2; y = (int) pt.getY() - h / 2; } return new Rectangle(x, y, w, h); }
/** * */ public Rectangle getFoldingIconBounds(mxCellState state, ImageIcon icon) { mxIGraphModel model = graph.getModel(); boolean isEdge = model.isEdge(state.getCell()); double scale = getGraph().getView().getScale(); int x = (int) Math.round(state.getX() + 4 * scale); int y = (int) Math.round(state.getY() + 4 * scale); int w = (int) Math.max(8, icon.getIconWidth() * scale); int h = (int) Math.max(8, icon.getIconHeight() * scale); if (isEdge) { mxPoint pt = graph.getView().getPoint(state); x = (int) pt.getX() - w / 2; y = (int) pt.getY() - h / 2; } return new Rectangle(x, y, w, h); }
point = getPoint(terminal);
point = getPoint(terminal);
/** * Moves the label to the given position. */ protected void moveLabelTo(mxCellState edgeState, double x, double y) { mxGraph graph = graphComponent.getGraph(); mxIGraphModel model = graph.getModel(); mxGeometry geometry = model.getGeometry(state.getCell()); if (geometry != null) { geometry = (mxGeometry) geometry.clone(); // Resets the relative location stored inside the geometry mxPoint pt = graph.getView().getRelativePoint(edgeState, x, y); geometry.setX(pt.getX()); geometry.setY(pt.getY()); // Resets the offset inside the geometry to find the offset // from the resulting point double scale = graph.getView().getScale(); geometry.setOffset(new mxPoint(0, 0)); pt = graph.getView().getPoint(edgeState, geometry); geometry.setOffset(new mxPoint(Math.round((x - pt.getX()) / scale), Math.round((y - pt.getY()) / scale))); model.setGeometry(edgeState.getCell(), geometry); } }
/** * Moves the label to the given position. */ protected void moveLabelTo(mxCellState edgeState, double x, double y) { mxGraph graph = graphComponent.getGraph(); mxIGraphModel model = graph.getModel(); mxGeometry geometry = model.getGeometry(state.getCell()); if (geometry != null) { geometry = (mxGeometry) geometry.clone(); // Resets the relative location stored inside the geometry mxPoint pt = graph.getView().getRelativePoint(edgeState, x, y); geometry.setX(pt.getX()); geometry.setY(pt.getY()); // Resets the offset inside the geometry to find the offset // from the resulting point double scale = graph.getView().getScale(); geometry.setOffset(new mxPoint(0, 0)); pt = graph.getView().getPoint(edgeState, geometry); geometry.setOffset(new mxPoint(Math.round((x - pt.getX()) / scale), Math.round((y - pt.getY()) / scale))); model.setGeometry(edgeState.getCell(), geometry); } }
state.setAbsoluteOffset(getPoint(state, geo));
state.setAbsoluteOffset(getPoint(state, geo));
mxPoint orig = getPoint(pState, geo);
mxPoint orig = getPoint(pState, geo);