mxGraph
|
Implements a view for the graph. This class is in charge of computing the absolute coordinates for the relative child geometries, the points for perimeters and edge styles and keeping them cached in mxCellStates for faster retrieval. The states are updated whenever the model or the view state (translate, scale) changes. The scale and translate are honoured in the bounds. More...
Public Member Functions | |
mxGraphView (mxGraph graph) | |
Constructs a new view for the given graph. More... | |
mxRectangle | GetBounds (Object[] cells) |
Returns the bounding box for an array of cells or null, if no cells are specified. More... | |
mxRectangle | GetBoundingBox (Object[] cells) |
Returns the bounding box for an array of cells or null, if no cells are specified. More... | |
mxRectangle | GetBounds (Object[] cells, bool boundingBox) |
Returns the bounding box for an array of cells or null, if no cells are specified. More... | |
void | Revalidate () |
First invalidates, then validates all cell states. More... | |
void | Invalidate () |
Invalidates all cell states. More... | |
void | Validate () |
First validates all bounds and then validates all points recursively on all visible cells. More... | |
mxRectangle | GetBoundingBox (mxCellState state) |
Shortcut to validateCell with visible set to true. More... | |
mxRectangle | GetBoundingBox (mxCellState state, Boolean recurse) |
Returns the bounding box of the shape and the label for the given cell state and its children if recurse is true. More... | |
Object | ValidateCell (Object cell) |
Shortcut to validateCell with visible set to true. More... | |
Object | ValidateCell (Object cell, Boolean visible) |
Recursively creates the cell state for the given cell if visible is true and the given cell is visible. If the cell is not visible but the state exists then it is removed using removeState. More... | |
mxCellState | ValidateCellState (Object cell) |
Shortcut to validateCellState with recurse set to true. More... | |
mxCellState | ValidateCellState (Object cell, Boolean recurse) |
Validates the cell state for the given cell. More... | |
void | UpdateCellState (mxCellState state, mxCellState source, mxCellState target) |
Updates the given cell state. More... | |
void | UpdateVertexState (mxCellState state, mxGeometry geo) |
Validates the given cell state. More... | |
void | UpdateEdgeState (mxCellState state, mxGeometry geo, mxCellState source, mxCellState target) |
Validates the given cell state. More... | |
void | UpdateVertexLabelOffset (mxCellState state) |
Updates the absoluteOffset of the given vertex cell state. This takes into account the label position styles. More... | |
void | UpdateLabelBounds (mxCellState state) |
Updates the label bounds in the given state. More... | |
mxRectangle | UpdateBoundingBox (mxCellState state) |
Updates the bounding box in the given cell state. More... | |
void | UpdateFixedTerminalPoints (mxCellState edge, mxCellState source, mxCellState target) |
Sets the initial absolute terminal points in the given state before the edge style is computed. More... | |
void | UpdateFixedTerminalPoint (mxCellState edge, mxCellState terminal, bool source, mxConnectionConstraint constraint) |
Sets the fixed source or target terminal point on the given edge. More... | |
void | UpdatePoints (mxCellState edge, List< mxPoint > points, mxCellState source, mxCellState target) |
Updates the absolute points in the given state using the specified array of points as the relative points. More... | |
mxPoint | TransformControlPoint (mxCellState state, mxPoint pt) |
Transforms the given control point to an absolute point. More... | |
mxEdgeStyleFunction | GetEdgeStyle (mxCellState edge, List< mxPoint > points, Object source, Object target) |
Returns the edge style function to be used to render the given edge state. More... | |
void | UpdateFloatingTerminalPoints (mxCellState state, mxCellState source, mxCellState target) |
Updates the terminal points in the given state after the edge style was computed for the edge. More... | |
void | UpdateFloatingTerminalPoint (mxCellState edge, mxCellState start, mxCellState end, bool source) |
Updates the absolute terminal point in the given state for the given start and end state, where start is the source if source is true. More... | |
mxCellState | GetTerminalPort (mxCellState state, mxCellState terminal, bool source) |
Returns the given terminal or the port defined in the given edge state if a cell state exists for that port. More... | |
mxPoint | GetPerimeterPoint (mxCellState terminal, mxPoint next, bool orthogonal) |
Returns a point that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point. More... | |
mxPoint | GetPerimeterPoint (mxCellState terminal, mxPoint next, bool orthogonal, double border) |
Returns a point that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point. More... | |
double | GetRoutingCenterX (mxCellState state) |
Returns the x-coordinate of the center point for automatic routing. More... | |
double | GetRoutingCenterY (mxCellState state) |
Returns the y-coordinate of the center point for automatic routing. More... | |
mxRectangle | GetPerimeterBounds (mxCellState terminal, double border) |
Returns the perimeter bounds for the given terminal, edge pair. More... | |
mxPerimeterFunction | GetPerimeterFunction (mxCellState state) |
Returns the perimeter function for the given state. More... | |
mxPoint | GetNextPoint (mxCellState edge, mxCellState opposite, bool source) |
Returns the nearest point in the list of absolute points or the center of the opposite terminal. More... | |
Object | GetVisibleTerminal (Object edge, bool source) |
Returns the nearest ancestor terminal that is visible. The edge appears to be connected to this terminal on the display. More... | |
void | UpdateEdgeBounds (mxCellState state) |
Updates the given state using the bounding box of the absolute points. Also updates terminal distance, length and segments. More... | |
mxPoint | GetPoint (mxCellState state) |
Returns the absolute center point along the given edge. More... | |
mxPoint | GetPoint (mxCellState state, mxGeometry geometry) |
Returns the absolute point on the edge for the given relative geometry as a point. The edge is represented by the given cell state. More... | |
mxCellState | GetState (Object cell) |
Returns the state for the given cell or null if no state is defined for the cell. More... | |
Dictionary< Object, mxCellState > | GetStates (Object[] cells) |
Returns the object that maps from cells to states. More... | |
mxCellState[] | GetCellStates (Object[] cells) |
Returns the states for the given array of cells. The array contains all states that are not null, that is, the returned array may have less elements than the given array. More... | |
mxCellState | GetState (Object cell, bool create) |
Returns the cell state for the given cell. If create is true, then the state is created if it does not yet exist. More... | |
mxCellState | RemoveState (Object cell) |
Shortcut to removeState with recurse set to false. More... | |
mxCellState | RemoveState (Object cell, Boolean recurse) |
Removes and returns the mxCellState for the given cell. More... | |
mxCellState | CreateState (Object cell) |
Creates and returns a cell state for the given cell. More... | |
Protected Attributes | |
mxGraph | graph |
Reference to the enclosing graph. More... | |
mxRectangle | graphBounds = new mxRectangle() |
Caches the current bounds of the graph. More... | |
double | scale = 1 |
Specifies the scale. Default is 1 (100%). More... | |
mxPoint | translate = new mxPoint(0, 0) |
Point that specifies the current translation. Default is a new empty point. More... | |
Dictionary< Object, mxCellState > | states = new Dictionary<Object, mxCellState>() |
Maps from cells to cell states. More... | |
bool | eventsEnabled = true |
Specifies if the view should be revalidated if the scale or translation changes. More... | |
Properties | |
mxGraph | Graph [get] |
Returns the enclosing graph. More... | |
mxRectangle | GraphBounds [get, set] |
Returns the cached diagram bounds. More... | |
double | Scale [get, set] |
Sets or returns the current scale. More... | |
mxPoint | Translate [get, set] |
Sets or returns the current translation. More... | |
Dictionary< Object, mxCellState > | States [get, set] |
Sets or returns the current translation. More... | |
bool | IsEventsEnabled [get, set] |
Sets or returns the current scale. More... | |
Implements a view for the graph. This class is in charge of computing the absolute coordinates for the relative child geometries, the points for perimeters and edge styles and keeping them cached in mxCellStates for faster retrieval. The states are updated whenever the model or the view state (translate, scale) changes. The scale and translate are honoured in the bounds.
|
inline |
Constructs a new view for the given graph.
graph | Reference to the enclosing graph. |
|
inline |
Creates and returns a cell state for the given cell.
cell | Cell for which a new state should be created. |
|
inline |
Returns the bounding box for an array of cells or null, if no cells are specified.
cells |
|
inline |
Shortcut to validateCell with visible set to true.
|
inline |
Returns the bounding box of the shape and the label for the given cell state and its children if recurse is true.
state | Cell state whose bounding box should be returned. |
recurse | Boolean indicating if the children should be included. |
References com.mxgraph.mxRectangle.Add(), com.mxgraph.mxCellState.BoundingBox, com.mxgraph.mxCellState.Cell, com.mxgraph.mxRectangle.Clone(), com.mxgraph.mxIGraphModel.GetChildAt(), and com.mxgraph.mxIGraphModel.GetChildCount().
|
inline |
Returns the bounding box for an array of cells or null, if no cells are specified.
cells |
|
inline |
Returns the bounding box for an array of cells or null, if no cells are specified.
References com.mxgraph.mxRectangle.Add(), com.mxgraph.mxCellState.BoundingBox, com.mxgraph.mxIGraphModel.IsEdge(), and com.mxgraph.mxIGraphModel.IsVertex().
|
inline |
Returns the states for the given array of cells. The array contains all states that are not null, that is, the returned array may have less elements than the given array.
|
inline |
Returns the edge style function to be used to render the given edge state.
References com.mxgraph.mxUtils.Eval(), com.mxgraph.mxStyleRegistry.GetValue(), com.mxgraph.mxUtils.IsTrue(), com.mxgraph.mxEdgeStyleFunction(), com.mxgraph.mxCellState.Style, com.mxgraph.mxConstants.STYLE_EDGE, com.mxgraph.mxConstants.STYLE_LOOP, and com.mxgraph.mxConstants.STYLE_NOEDGESTYLE.
|
inline |
Returns the nearest point in the list of absolute points or the center of the opposite terminal.
edge | State that represents the edge. |
opposite | State that represents the opposite terminal. |
source | Boolean indicating if the next point for the source or target should be returned. |
References com.mxgraph.mxCellState.AbsolutePoints, com.mxgraph.mxRectangle.GetCenterX(), and com.mxgraph.mxRectangle.GetCenterY().
|
inline |
Returns the perimeter bounds for the given terminal, edge pair.
References com.mxgraph.mxUtils.GetDouble(), com.mxgraph.mxCellState.GetPerimeterBounds(), com.mxgraph.mxCellState.Style, and com.mxgraph.mxConstants.STYLE_PERIMETER_SPACING.
|
inline |
Returns the perimeter function for the given state.
References com.mxgraph.mxUtils.Eval(), com.mxgraph.mxStyleRegistry.GetValue(), com.mxgraph.mxPerimeterFunction(), com.mxgraph.mxCellState.Style, and com.mxgraph.mxConstants.STYLE_PERIMETER.
|
inline |
Returns a point that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point.
|
inline |
Returns a point that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point.
terminal | State for the source or target terminal. |
next | Point that lies outside of the given terminal. |
orthogonal | Specifies if the orthogonal projection onto the perimeter should be returned. If this is false then the intersection of the perimeter and the line between the next and the center point is returned. |
border | Optional border between the perimeter and the shape. |
References com.mxgraph.mxRectangle.Height, com.mxgraph.mxPerimeterFunction(), and com.mxgraph.mxRectangle.Width.
|
inline |
Returns the absolute center point along the given edge.
|
inline |
Returns the absolute point on the edge for the given relative geometry as a point. The edge is represented by the given cell state.
state | Represents the state of the parent edge. |
geometry | Represents the relative location. |
References com.mxgraph.mxCellState.AbsolutePoints, com.mxgraph.mxRectangle.GetCenterX(), com.mxgraph.mxRectangle.GetCenterY(), com.mxgraph.mxCellState.Length, com.mxgraph.mxGeometry.Offset, com.mxgraph.mxGeometry.Relative, com.mxgraph.mxCellState.Segments, com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inline |
Returns the x-coordinate of the center point for automatic routing.
References com.mxgraph.mxRectangle.GetCenterX(), com.mxgraph.mxUtils.GetFloat(), com.mxgraph.mxCellState.Style, com.mxgraph.mxConstants.STYLE_ROUTING_CENTER_X, and com.mxgraph.mxRectangle.Width.
|
inline |
Returns the y-coordinate of the center point for automatic routing.
References com.mxgraph.mxRectangle.GetCenterY(), com.mxgraph.mxUtils.GetFloat(), com.mxgraph.mxRectangle.Height, com.mxgraph.mxCellState.Style, and com.mxgraph.mxConstants.STYLE_ROUTING_CENTER_Y.
|
inline |
Returns the state for the given cell or null if no state is defined for the cell.
cell | Cell whose state should be returned. |
|
inline |
Returns the cell state for the given cell. If create is true, then the state is created if it does not yet exist.
cell | Cell for which a new state should be returned. |
create | Boolean indicating if a new state should be created if it does not yet exist. |
|
inline |
Returns the object that maps from cells to states.
|
inline |
Returns the given terminal or the port defined in the given edge state if a cell state exists for that port.
References com.mxgraph.mxUtils.GetString(), com.mxgraph.mxCellState.Style, com.mxgraph.mxConstants.STYLE_SOURCE_PORT, and com.mxgraph.mxConstants.STYLE_TARGET_PORT.
|
inline |
Returns the nearest ancestor terminal that is visible. The edge appears to be connected to this terminal on the display.
edge | Cell whose visible terminal should be returned. |
source | Boolean that specifies if the source or target terminal should be returned. |
References com.mxgraph.mxIGraphModel.GetParent(), com.mxgraph.mxIGraphModel.GetTerminal(), and com.mxgraph.mxIGraphModel.Root.
|
inline |
Invalidates all cell states.
|
inline |
Shortcut to removeState with recurse set to false.
|
inline |
Removes and returns the mxCellState for the given cell.
cell | mxCell for which the mxCellState should be removed. |
References com.mxgraph.mxIGraphModel.GetChildAt(), and com.mxgraph.mxIGraphModel.GetChildCount().
|
inline |
First invalidates, then validates all cell states.
|
inline |
Transforms the given control point to an absolute point.
References com.mxgraph.mxCellState.Origin, com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inline |
Updates the bounding box in the given cell state.
state | Cell state whose bounding box should be updated. |
References com.mxgraph.mxRectangle.Add(), com.mxgraph.mxConstants.ALIGN_BOTTOM, com.mxgraph.mxConstants.ALIGN_CENTER, com.mxgraph.mxConstants.ALIGN_LEFT, com.mxgraph.mxConstants.ALIGN_MIDDLE, com.mxgraph.mxConstants.ALIGN_RIGHT, com.mxgraph.mxConstants.ALIGN_TOP, com.mxgraph.mxConstants.ARROW_WIDTH, com.mxgraph.mxCellState.BoundingBox, com.mxgraph.mxCellState.Cell, com.mxgraph.mxConstants.DEFAULT_IMAGESIZE, com.mxgraph.mxConstants.DEFAULT_MARKERSIZE, com.mxgraph.mxUtils.GetBoundingBox(), com.mxgraph.mxUtils.GetDouble(), com.mxgraph.mxUtils.GetInt(), com.mxgraph.mxRectangle.GetRectangle(), com.mxgraph.mxUtils.GetString(), com.mxgraph.mxRectangle.Grow(), com.mxgraph.mxRectangle.Height, com.mxgraph.mxUtils.IsTrue(), com.mxgraph.mxCellState.LabelBounds, com.mxgraph.mxConstants.SHADOW_OFFSETX, com.mxgraph.mxConstants.SHADOW_OFFSETY, com.mxgraph.mxConstants.SHAPE_ARROW, com.mxgraph.mxConstants.SHAPE_LABEL, com.mxgraph.mxCellState.Style, com.mxgraph.mxConstants.STYLE_ENDARROW, com.mxgraph.mxConstants.STYLE_IMAGE, com.mxgraph.mxConstants.STYLE_IMAGE_ALIGN, com.mxgraph.mxConstants.STYLE_IMAGE_HEIGHT, com.mxgraph.mxConstants.STYLE_IMAGE_VERTICAL_ALIGN, com.mxgraph.mxConstants.STYLE_IMAGE_WIDTH, com.mxgraph.mxConstants.STYLE_OVERFLOW, com.mxgraph.mxConstants.STYLE_ROTATION, com.mxgraph.mxConstants.STYLE_SHADOW, com.mxgraph.mxConstants.STYLE_SHAPE, com.mxgraph.mxConstants.STYLE_STARTARROW, com.mxgraph.mxConstants.STYLE_STROKEWIDTH, com.mxgraph.mxRectangle.Width, com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inline |
Updates the given cell state.
state |
References com.mxgraph.mxCellState.AbsoluteOffset, com.mxgraph.mxCellState.Cell, com.mxgraph.mxIGraphModel.GetParent(), com.mxgraph.mxRectangle.Height, com.mxgraph.mxIGraphModel.IsEdge(), com.mxgraph.mxIGraphModel.IsVertex(), com.mxgraph.mxCellState.Length, com.mxgraph.mxGeometry.Offset, com.mxgraph.mxCellState.Origin, com.mxgraph.mxGeometry.Relative, com.mxgraph.mxRectangle.Width, com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inline |
Updates the given state using the bounding box of the absolute points. Also updates terminal distance, length and segments.
state | Cell state whose bounds should be updated. |
References com.mxgraph.mxCellState.AbsolutePoints, com.mxgraph.mxCellState.Cell, com.mxgraph.mxRectangle.Height, com.mxgraph.mxCellState.Length, com.mxgraph.mxCellState.Segments, com.mxgraph.mxCellState.TerminalDistance, com.mxgraph.mxRectangle.Width, com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inline |
Validates the given cell state.
References com.mxgraph.mxCellState.AbsoluteOffset, com.mxgraph.mxCellState.AbsolutePointCount(), com.mxgraph.mxCellState.AbsolutePoints, com.mxgraph.mxCellState.Cell, com.mxgraph.mxGeometry.GetTerminalPoint(), and com.mxgraph.mxGeometry.Points.
|
inline |
Sets the fixed source or target terminal point on the given edge.
edge | State whose terminal point should be updated. |
terminal | State which represents the actual terminal. |
source | Boolean that specifies if the terminal is the source. |
constraint | Constraint that specifies the connection. |
References com.mxgraph.mxCellState.Cell, com.mxgraph.mxGeometry.GetTerminalPoint(), com.mxgraph.mxCellState.Origin, com.mxgraph.mxCellState.SetAbsoluteTerminalPoint(), com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inline |
Sets the initial absolute terminal points in the given state before the edge style is computed.
edge | Cell state whose initial terminal points should be updated. |
source | Cell state which represents the source terminal. |
target | Cell state which represents the target terminal. |
|
inline |
Updates the absolute terminal point in the given state for the given start and end state, where start is the source if source is true.
edge | State whose terminal point should be updated. |
start | for the terminal on "this" side of the edge. |
end | for the terminal on the other side of the edge. |
source | Boolean indicating if start is the source terminal state. |
References com.mxgraph.mxUtils.GetDouble(), com.mxgraph.mxCellState.SetAbsoluteTerminalPoint(), com.mxgraph.mxCellState.Style, com.mxgraph.mxConstants.STYLE_PERIMETER_SPACING, com.mxgraph.mxConstants.STYLE_SOURCE_PERIMETER_SPACING, and com.mxgraph.mxConstants.STYLE_TARGET_PERIMETER_SPACING.
|
inline |
Updates the terminal points in the given state after the edge style was computed for the edge.
state | State whose terminal points should be updated. |
source | State that represents the source terminal. |
target | State that represents the target terminal. |
References com.mxgraph.mxCellState.AbsolutePointCount(), and com.mxgraph.mxCellState.AbsolutePoints.
|
inline |
Updates the label bounds in the given state.
state |
References com.mxgraph.mxCellState.AbsoluteOffset, com.mxgraph.mxCellState.Cell, com.mxgraph.mxUtils.GetLabelPaintBounds(), com.mxgraph.mxUtils.GetString(), com.mxgraph.mxCellState.LabelBounds, com.mxgraph.mxCellState.Style, and com.mxgraph.mxConstants.STYLE_OVERFLOW.
|
inline |
Updates the absolute points in the given state using the specified array of points as the relative points.
edge | Cell state whose absolute points should be updated. |
points | Array of points that constitute the relative points. |
source | Cell that represents the source terminal. |
target | Cell that represents the target terminal. |
References com.mxgraph.mxCellState.AbsolutePoints, and com.mxgraph.mxEdgeStyleFunction().
|
inline |
Updates the absoluteOffset of the given vertex cell state. This takes into account the label position styles.
state | Cell state whose absolute offset should be updated. |
References com.mxgraph.mxCellState.AbsoluteOffset, com.mxgraph.mxConstants.ALIGN_BOTTOM, com.mxgraph.mxConstants.ALIGN_CENTER, com.mxgraph.mxConstants.ALIGN_LEFT, com.mxgraph.mxConstants.ALIGN_MIDDLE, com.mxgraph.mxConstants.ALIGN_RIGHT, com.mxgraph.mxConstants.ALIGN_TOP, com.mxgraph.mxUtils.GetString(), com.mxgraph.mxRectangle.Height, com.mxgraph.mxCellState.Style, com.mxgraph.mxConstants.STYLE_LABEL_POSITION, com.mxgraph.mxConstants.STYLE_VERTICAL_LABEL_POSITION, com.mxgraph.mxRectangle.Width, com.mxgraph.mxPoint.X, and com.mxgraph.mxPoint.Y.
|
inline |
Validates the given cell state.
|
inline |
First validates all bounds and then validates all points recursively on all visible cells.
|
inline |
Shortcut to validateCell with visible set to true.
Referenced by com.mxgraph.mxCellRenderer.DrawCells().
|
inline |
Recursively creates the cell state for the given cell if visible is true and the given cell is visible. If the cell is not visible but the state exists then it is removed using removeState.
cell | Cell whose cell state should be created. |
visible | Boolean indicating if the cell should be visible. |
References com.mxgraph.mxIGraphModel.GetChildAt(), and com.mxgraph.mxIGraphModel.GetChildCount().
|
inline |
Shortcut to validateCellState with recurse set to true.
Referenced by com.mxgraph.mxCellRenderer.DrawCells().
|
inline |
Validates the cell state for the given cell.
cell | Cell whose cell state should be validated. |
recurse | Boolean indicating if the children of the cell should be validated. |
References com.mxgraph.mxIGraphModel.GetChildAt(), com.mxgraph.mxIGraphModel.GetChildCount(), com.mxgraph.mxIGraphModel.GetParent(), com.mxgraph.mxCellState.Invalid, com.mxgraph.mxIGraphModel.IsEdge(), and com.mxgraph.mxIGraphModel.IsVertex().
|
protected |
Specifies if the view should be revalidated if the scale or translation changes.
|
protected |
Reference to the enclosing graph.
|
protected |
Caches the current bounds of the graph.
|
protected |
Specifies the scale. Default is 1 (100%).
|
protected |
Maps from cells to cell states.
Point that specifies the current translation. Default is a new empty point.
|
get |
Returns the enclosing graph.
|
getset |
Returns the cached diagram bounds.
|
getset |
Sets or returns the current scale.
Referenced by com.mxgraph.mxCellRenderer.DrawCells().
|
getset |
Sets or returns the current scale.
Referenced by com.mxgraph.mxCellRenderer.DrawCells(), com.mxgraph.mxStencil.DrawShape(), and com.mxgraph.mxStencil.PaintShape().
|
getset |
Sets or returns the current translation.
Referenced by com.mxgraph.mxCellRenderer.DrawCells().
|
getset |
Sets or returns the current translation.