com::mxgraph::mxGraphView Class Reference

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...

List of all members.

Public Member Functions

 mxGraphView (mxGraph graph)
 Constructs a new view for the given graph.
mxRectangle GetBounds (Object[] cells)
 Returns the bounding box for an array of cells or null, if no cells are specified.
mxRectangle GetBoundingBox (Object[] cells)
 Returns the bounding box for an array of cells or null, if no cells are specified.
mxRectangle GetBounds (Object[] cells, bool boundingBox)
 Returns the bounding box for an array of cells or null, if no cells are specified.
void Revalidate ()
 First invalidates, then validates all cell states.
void Invalidate ()
 Invalidates all cell states.
void Validate ()
 First validates all bounds and then validates all points recursively on all visible cells.
void ValidateBounds (mxCellState parentState, Object cell)
 Validates the bounds of the given parent's child using the given parent state as the origin for the child. The validation is carried out recursively for all non-collapsed descendants.
void UpdateVertexLabelOffset (mxCellState state)
 Updates the absoluteOffset of the given vertex cell state. This takes into account the label position styles.
mxRectangle ValidatePoints (mxCellState parentState, Object cell)
 Validates the points for the state of the given cell recursively if the cell is not collapsed and returns the bounding box of all visited states as a rectangle.
void childMoved (mxCellState parent, mxCellState child)
 Invoked when a child state was moved as a result of late evaluation of its position. This is invoked for relative edge children whose position can only be determined after the points of the parent edge are updated in validatePoints, and validates the bounds of all descendants of the child using validateBounds.
void UpdateLabelBounds (mxCellState state)
 Updates the label bounds in the given state.
mxRectangle UpdateBoundingBox (mxCellState state)
 Updates the bounding box in the given cell state.
void UpdateFixedTerminalPoints (mxCellState edge, mxCellState source, mxCellState target)
 Sets the initial absolute terminal points in the given state before the edge style is computed.
void UpdateFixedTerminalPoint (mxCellState edge, mxCellState terminal, bool source, mxConnectionConstraint constraint)
 Sets the fixed source or target terminal point on the given edge.
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.
mxPoint TransformControlPoint (mxCellState state, mxPoint pt)
 Transforms the given control point to an absolute point.
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.
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.
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.
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.
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.
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.
double GetRoutingCenterX (mxCellState state)
 Returns the x-coordinate of the center point for automatic routing.
double GetRoutingCenterY (mxCellState state)
 Returns the y-coordinate of the center point for automatic routing.
mxRectangle GetPerimeterBounds (mxCellState terminal, double border)
 Returns the perimeter bounds for the given terminal, edge pair.
mxPerimeterFunction GetPerimeterFunction (mxCellState state)
 Returns the perimeter function for the given state.
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.
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.
void UpdateEdgeBounds (mxCellState state)
 Updates the given state using the bounding box of the absolute points. Also updates terminal distance, length and segments.
mxPoint GetPoint (mxCellState state)
 Returns the absolute center point along the given edge.
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.
mxCellState GetState (Object cell)
 Returns the state for the given cell or null if no state is defined for the cell.
Dictionary< Object, mxCellStateGetStates (Object[] cells)
 Returns the object that maps from cells to states.
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.
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.
mxCellState RemoveState (Object cell)
 Removes and returns the mxCellState for the given cell.
mxCellState CreateState (Object cell)
 Creates and returns a cell state for the given cell.

Protected Attributes

mxGraph graph
 Reference to the enclosing graph.
mxRectangle graphBounds = new mxRectangle()
 Caches the current bounds of the graph.
double scale = 1
 Specifies the scale. Default is 1 (100%).
mxPoint translate = new mxPoint(0, 0)
 Point that specifies the current translation. Default is a new empty point.
Dictionary< Object, mxCellStatestates = new Dictionary<Object, mxCellState>()
 Maps from cells to cell states.
bool eventsEnabled = true
 Specifies if the view should be revalidated if the scale or translation changes.

Properties

mxGraph Graph [get]
 Returns the enclosing graph.
mxRectangle GraphBounds [get, set]
 Returns the cached diagram bounds.
double Scale [get, set]
 Sets or returns the current scale.
mxPoint Translate [get, set]
 Sets or returns the current translation.
Dictionary< Object, mxCellStateStates [get, set]
 Sets or returns the current translation.
bool IsEventsEnabled [get, set]
 Sets or returns the current scale.

Detailed Description

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.


Constructor & Destructor Documentation

com::mxgraph::mxGraphView::mxGraphView ( mxGraph  graph  )  [inline]

Constructs a new view for the given graph.

Parameters:
graph Reference to the enclosing graph.

Member Function Documentation

void com::mxgraph::mxGraphView::childMoved ( mxCellState  parent,
mxCellState  child 
) [inline]

Invoked when a child state was moved as a result of late evaluation of its position. This is invoked for relative edge children whose position can only be determined after the points of the parent edge are updated in validatePoints, and validates the bounds of all descendants of the child using validateBounds.

Parameters:
parent State that represents the parent.
child State that represents the child.
mxCellState com::mxgraph::mxGraphView::CreateState ( Object  cell  )  [inline]

Creates and returns a cell state for the given cell.

Parameters:
cell Cell for which a new state should be created.
Returns:
Returns a new state for the given cell.
mxRectangle com::mxgraph::mxGraphView::GetBoundingBox ( Object[]  cells  )  [inline]

Returns the bounding box for an array of cells or null, if no cells are specified.

Parameters:
cells 
Returns:
mxRectangle com::mxgraph::mxGraphView::GetBounds ( Object[]  cells,
bool  boundingBox 
) [inline]

Returns the bounding box for an array of cells or null, if no cells are specified.

mxRectangle com::mxgraph::mxGraphView::GetBounds ( Object[]  cells  )  [inline]

Returns the bounding box for an array of cells or null, if no cells are specified.

Parameters:
cells 
Returns:
mxCellState [] com::mxgraph::mxGraphView::GetCellStates ( Object[]  cells  )  [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.

mxEdgeStyleFunction com::mxgraph::mxGraphView::GetEdgeStyle ( mxCellState  edge,
List< mxPoint points,
Object  source,
Object  target 
) [inline]

Returns the edge style function to be used to render the given edge state.

mxPoint com::mxgraph::mxGraphView::GetNextPoint ( mxCellState  edge,
mxCellState  opposite,
bool  source 
) [inline]

Returns the nearest point in the list of absolute points or the center of the opposite terminal.

Parameters:
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.
mxRectangle com::mxgraph::mxGraphView::GetPerimeterBounds ( mxCellState  terminal,
double  border 
) [inline]

Returns the perimeter bounds for the given terminal, edge pair.

mxPerimeterFunction com::mxgraph::mxGraphView::GetPerimeterFunction ( mxCellState  state  )  [inline]

Returns the perimeter function for the given state.

mxPoint com::mxgraph::mxGraphView::GetPerimeterPoint ( mxCellState  terminal,
mxPoint  next,
bool  orthogonal,
double  border 
) [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.

Parameters:
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.
mxPoint com::mxgraph::mxGraphView::GetPerimeterPoint ( mxCellState  terminal,
mxPoint  next,
bool  orthogonal 
) [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.

mxPoint com::mxgraph::mxGraphView::GetPoint ( mxCellState  state,
mxGeometry  geometry 
) [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.

Parameters:
state Represents the state of the parent edge.
geometry Represents the relative location.
mxPoint com::mxgraph::mxGraphView::GetPoint ( mxCellState  state  )  [inline]

Returns the absolute center point along the given edge.

double com::mxgraph::mxGraphView::GetRoutingCenterX ( mxCellState  state  )  [inline]

Returns the x-coordinate of the center point for automatic routing.

Returns:
Returns the x-coordinate of the routing center point.
double com::mxgraph::mxGraphView::GetRoutingCenterY ( mxCellState  state  )  [inline]

Returns the y-coordinate of the center point for automatic routing.

Returns:
Returns the y-coordinate of the routing center point.
mxCellState com::mxgraph::mxGraphView::GetState ( Object  cell,
bool  create 
) [inline]

Returns the cell state for the given cell. If create is true, then the state is created if it does not yet exist.

Parameters:
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.
Returns:
Returns the state for the given cell.
mxCellState com::mxgraph::mxGraphView::GetState ( Object  cell  )  [inline]

Returns the state for the given cell or null if no state is defined for the cell.

Parameters:
cell Cell whose state should be returned.
Returns:
Returns the state for the given cell.
Dictionary<Object, mxCellState> com::mxgraph::mxGraphView::GetStates ( Object[]  cells  )  [inline]

Returns the object that maps from cells to states.

mxCellState com::mxgraph::mxGraphView::GetTerminalPort ( mxCellState  state,
mxCellState  terminal,
bool  source 
) [inline]

Returns the given terminal or the port defined in the given edge state if a cell state exists for that port.

Object com::mxgraph::mxGraphView::GetVisibleTerminal ( Object  edge,
bool  source 
) [inline]

Returns the nearest ancestor terminal that is visible. The edge appears to be connected to this terminal on the display.

Parameters:
edge Cell whose visible terminal should be returned.
source Boolean that specifies if the source or target terminal should be returned.
Returns:
Returns the visible source or target terminal.
void com::mxgraph::mxGraphView::Invalidate (  )  [inline]

Invalidates all cell states.

mxCellState com::mxgraph::mxGraphView::RemoveState ( Object  cell  )  [inline]

Removes and returns the mxCellState for the given cell.

Parameters:
cell mxCell for which the mxCellState should be removed.
Returns:
Returns the mxCellState that has been removed.
void com::mxgraph::mxGraphView::Revalidate (  )  [inline]

First invalidates, then validates all cell states.

mxPoint com::mxgraph::mxGraphView::TransformControlPoint ( mxCellState  state,
mxPoint  pt 
) [inline]

Transforms the given control point to an absolute point.

mxRectangle com::mxgraph::mxGraphView::UpdateBoundingBox ( mxCellState  state  )  [inline]

Updates the bounding box in the given cell state.

Parameters:
state Cell state whose bounding box should be updated.
Returns:
void com::mxgraph::mxGraphView::UpdateEdgeBounds ( mxCellState  state  )  [inline]

Updates the given state using the bounding box of the absolute points. Also updates terminal distance, length and segments.

Parameters:
state Cell state whose bounds should be updated.
void com::mxgraph::mxGraphView::UpdateFixedTerminalPoint ( mxCellState  edge,
mxCellState  terminal,
bool  source,
mxConnectionConstraint  constraint 
) [inline]

Sets the fixed source or target terminal point on the given edge.

Parameters:
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.
void com::mxgraph::mxGraphView::UpdateFixedTerminalPoints ( mxCellState  edge,
mxCellState  source,
mxCellState  target 
) [inline]

Sets the initial absolute terminal points in the given state before the edge style is computed.

Parameters:
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.
void com::mxgraph::mxGraphView::UpdateFloatingTerminalPoint ( mxCellState  edge,
mxCellState  start,
mxCellState  end,
bool  source 
) [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.

Parameters:
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.
void com::mxgraph::mxGraphView::UpdateFloatingTerminalPoints ( mxCellState  state,
mxCellState  source,
mxCellState  target 
) [inline]

Updates the terminal points in the given state after the edge style was computed for the edge.

Parameters:
state State whose terminal points should be updated.
source State that represents the source terminal.
target State that represents the target terminal.
void com::mxgraph::mxGraphView::UpdateLabelBounds ( mxCellState  state  )  [inline]

Updates the label bounds in the given state.

Parameters:
state 
void com::mxgraph::mxGraphView::UpdatePoints ( mxCellState  edge,
List< mxPoint points,
mxCellState  source,
mxCellState  target 
) [inline]

Updates the absolute points in the given state using the specified array of points as the relative points.

Parameters:
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.
void com::mxgraph::mxGraphView::UpdateVertexLabelOffset ( mxCellState  state  )  [inline]

Updates the absoluteOffset of the given vertex cell state. This takes into account the label position styles.

Parameters:
state Cell state whose absolute offset should be updated.
void com::mxgraph::mxGraphView::Validate (  )  [inline]

First validates all bounds and then validates all points recursively on all visible cells.

void com::mxgraph::mxGraphView::ValidateBounds ( mxCellState  parentState,
Object  cell 
) [inline]

Validates the bounds of the given parent's child using the given parent state as the origin for the child. The validation is carried out recursively for all non-collapsed descendants.

Parameters:
parentState Cell state for the given parent.
cell Cell for which the bounds in the state should be updated.
mxRectangle com::mxgraph::mxGraphView::ValidatePoints ( mxCellState  parentState,
Object  cell 
) [inline]

Validates the points for the state of the given cell recursively if the cell is not collapsed and returns the bounding box of all visited states as a rectangle.


Member Data Documentation

Specifies if the view should be revalidated if the scale or translation changes.

Reference to the enclosing graph.

Caches the current bounds of the graph.

double com::mxgraph::mxGraphView::scale = 1 [protected]

Specifies the scale. Default is 1 (100%).

Dictionary<Object, mxCellState> com::mxgraph::mxGraphView::states = new Dictionary<Object, mxCellState>() [protected]

Maps from cells to cell states.

Point that specifies the current translation. Default is a new empty point.


Property Documentation

mxGraph com::mxgraph::mxGraphView::Graph [get]

Returns the enclosing graph.

mxRectangle com::mxgraph::mxGraphView::GraphBounds [get, set]

Returns the cached diagram bounds.

bool com::mxgraph::mxGraphView::IsEventsEnabled [get, set]

Sets or returns the current scale.

double com::mxgraph::mxGraphView::Scale [get, set]

Sets or returns the current scale.

Dictionary<Object, mxCellState> com::mxgraph::mxGraphView::States [get, set]

Sets or returns the current translation.

mxPoint com::mxgraph::mxGraphView::Translate [get, set]

Sets or returns the current translation.


The documentation for this class was generated from the following file:
Generated on Mon Oct 29 20:11:50 2012 for mxGraph by  doxygen 1.6.3