double height = bounds.getHeight() + size.getHeight() - bounds.getY() + 2 * y0; g = (mxGeometry) g.clone();
/** * Resets the control points of the given edge. */ public Object resetEdge(Object edge) { mxGeometry geo = model.getGeometry(edge); if (geo != null) { // Resets the control points List<mxPoint> points = geo.getPoints(); if (points != null && !points.isEmpty()) { geo = (mxGeometry) geo.clone(); geo.setPoints(null); model.setGeometry(edge, geo); } } return edge; }
/** * Resets the control points of the given edge. */ public Object resetEdge(Object edge) { mxGeometry geo = model.getGeometry(edge); if (geo != null) { // Resets the control points List<mxPoint> points = geo.getPoints(); if (points != null && !points.isEmpty()) { geo = (mxGeometry) geo.clone(); geo.setPoints(null); model.setGeometry(edge, geo); } } return edge; }
/** * Swaps the alternate and the actual bounds in the geometry of the given * cell invoking updateAlternateBounds before carrying out the swap. * * @param cell Cell for which the bounds should be swapped. * @param willCollapse Boolean indicating if the cell is going to be collapsed. */ public void swapBounds(Object cell, boolean willCollapse) { if (cell != null) { mxGeometry geo = model.getGeometry(cell); if (geo != null) { geo = (mxGeometry) geo.clone(); updateAlternateBounds(cell, geo, willCollapse); geo.swap(); model.setGeometry(cell, geo); } } }
/** * Swaps the alternate and the actual bounds in the geometry of the given * cell invoking updateAlternateBounds before carrying out the swap. * * @param cell Cell for which the bounds should be swapped. * @param willCollapse Boolean indicating if the cell is going to be collapsed. */ public void swapBounds(Object cell, boolean willCollapse) { if (cell != null) { mxGeometry geo = model.getGeometry(cell); if (geo != null) { geo = (mxGeometry) geo.clone(); updateAlternateBounds(cell, geo, willCollapse); geo.swap(); model.setGeometry(cell, geo); } } }
try geometry = (mxGeometry) geometry.clone();
g = (mxGeometry) g.clone();
dy += offset.getY(); geometry = (mxGeometry) geometry.clone(); geometry.setOffset(new mxPoint(Math.round(dx), Math.round(dy))); graph.getModel().setGeometry(state.getCell(), geometry);
dy += offset.getY(); geometry = (mxGeometry) geometry.clone(); geometry.setOffset(new mxPoint(Math.round(dx), Math.round(dy))); graph.getModel().setGeometry(state.getCell(), geometry);
/** * Resizes the parents recursively so that they contain the complete area * of the resized child cell. * * @param cell <mxCell> that has been resized. */ public void extendParent(Object cell) { if (cell != null) { Object parent = model.getParent(cell); mxGeometry p = model.getGeometry(parent); if (parent != null && p != null && !isCellCollapsed(parent)) { mxGeometry geo = model.getGeometry(cell); if (geo != null && (p.getWidth() < geo.getX() + geo.getWidth() || p .getHeight() < geo.getY() + geo.getHeight())) { p = (mxGeometry) p.clone(); p.setWidth(Math.max(p.getWidth(), geo.getX() + geo.getWidth())); p.setHeight(Math.max(p.getHeight(), geo.getY() + geo.getHeight())); cellsResized(new Object[] { parent }, new mxRectangle[] { p }); } } } }
/** * Resizes the parents recursively so that they contain the complete area * of the resized child cell. * * @param cell <mxCell> that has been resized. */ public void extendParent(Object cell) { if (cell != null) { Object parent = model.getParent(cell); mxGeometry p = model.getGeometry(parent); if (parent != null && p != null && !isCellCollapsed(parent)) { mxGeometry geo = model.getGeometry(cell); if (geo != null && (p.getWidth() < geo.getX() + geo.getWidth() || p .getHeight() < geo.getY() + geo.getHeight())) { p = (mxGeometry) p.clone(); p.setWidth(Math.max(p.getWidth(), geo.getX() + geo.getWidth())); p.setHeight(Math.max(p.getHeight(), geo.getY() + geo.getHeight())); cellsResized(new Object[] { parent }, new mxRectangle[] { p }); } } } }
/** * 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); } }
geo = (mxGeometry) geo.clone(); geo.translate(dx, dy);
geo = (mxGeometry) geo.clone(); geo.translate(dx, dy);
/** * 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); } }
/** * Returns a clone of the cell. */ public Object clone() throws CloneNotSupportedException { mxCell clone = (mxCell) super.clone(); clone.setValue(cloneValue()); clone.setStyle(getStyle()); clone.setCollapsed(isCollapsed()); clone.setConnectable(isConnectable()); clone.setEdge(isEdge()); clone.setVertex(isVertex()); clone.setVisible(isVisible()); clone.setParent(null); clone.setSource(null); clone.setTarget(null); clone.children = null; clone.edges = null; mxGeometry geometry = getGeometry(); if (geometry != null) { clone.setGeometry((mxGeometry) geometry.clone()); } return clone; }
/** * Returns a clone of the cell. */ public Object clone() throws CloneNotSupportedException { mxCell clone = (mxCell) super.clone(); clone.setValue(cloneValue()); clone.setStyle(getStyle()); clone.setCollapsed(isCollapsed()); clone.setConnectable(isConnectable()); clone.setEdge(isEdge()); clone.setVertex(isVertex()); clone.setVisible(isVisible()); clone.setParent(null); clone.setSource(null); clone.setTarget(null); clone.children = null; clone.edges = null; mxGeometry geometry = getGeometry(); if (geometry != null) { clone.setGeometry((mxGeometry) geometry.clone()); } return clone; }
geometry = (mxGeometry) geometry.clone();
geometry = (mxGeometry) geometry.clone();
geometry = (mxGeometry) geometry.clone();