Implements a view for the graph. Fires scale and translate events if one of the values change.
mxEvent.SCALE fires after the scale was changed in setScale. The <code>scale</code> and <code>previousScale</code> arguments contain the new and previous scale.
mxEvent.TRANSLATE fires after the translate was changed in setTranslate. The <code>translate</code> and <code>previousTranslate</code> arguments contain the new and previous value for translate.
mxGraphView | Implements a view for the graph. |
Variables | |
EMPTY_POINT | An empty mxPoint instance. |
graph | Holds the mxGraph. |
graphBounds | Holds the bounds of the current view. |
scale | Holds the current scale. |
translate | Holds the current translate. |
states | Maps from cells to states. |
Functions | |
mxGraphView | Constructs a new view for the specified mxGraph. |
setScale | Sets the scale, revalidates the view and fires a scale event. |
setTranslate | Sets the translation, revalidates the view and fires a translate event. |
getGraphBounds | Returns graphBounds. |
setGraphBounds | Sets graphBounds. |
getBounds | Returns the bounding for for an array of cells or null, if no cells are specified. |
invalidate | |
invalidate | Invalidates the cached cell states. |
validate | Calls validateCell and <validateCellState> and updates the graphBounds using getBoundingBox. |
getBoundingBox | Returns the bounding box of the shape and the label for the given mxCellState and its children if recurse is true. |
validateCell | Recursively creates the cell state for the given cell if visible is true and the given cell is visible. |
validateCellStates | Validates and repaints the mxCellState for the given mxCell. |
updateCellState | Updates the given mxCellState. |
updateVertexState | Validates the given cell state. |
updateEdgeState | Validates the given cell state. |
updateVertexLabelOffset | Updates the absoluteOffset of the given vertex cell state. |
updateLabelBounds | Updates the label bounds in the given state. |
updateBoundingBox | Updates the bounding box in the given cell state. |
updateFixedTerminalPoints | Sets the initial absolute terminal points in the given state before the edge style is computed. |
updateFixedTerminalPoint | Sets the fixed source or target terminal point on the given edge. |
updatePoints | Updates the absolute points in the given state using the specified array of mxPoints as the relative points. |
transformControlPoint | Transforms the given control point to an absolute point. |
getEdgeStyle | Returns the edge style function to be used to render the given edge state. |
updateFloatingTerminalPoints | Updates the terminal points in the given state after the edge style was computed for the edge. |
updateFloatingTerminalPoint | 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. |
getTerminalPort | Returns an mxCellState that represents the source or target terminal or port for the given edge. |
getPerimeterPoint | Returns an mxPoint that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point. |
getRoutingCenterX | Returns the x-coordinate of the center point for automatic routing. |
getRoutingCenterY | Returns the y-coordinate of the center point for automatic routing. |
getPerimeterBounds | Returns the perimeter bounds for the given terminal, edge pair as an mxRectangle. |
getPerimeterFunction | Returns the perimeter function for the given state. |
getNextPoint | Returns the nearest point in the list of absolute points or the center of the opposite terminal. |
getVisibleTerminal | Returns the nearest ancestor terminal that is visible. |
updateEdgeBounds | Updates the bounds of the specified state based on the absolute points in the state. |
getPoint | Returns the absolute point on the edge for the given relative mxGeometry as an mxPoint. |
getState | Returns the cell state for the specified cell. |
getHashCode | Returns a unique string that represents the given instance. |
getStates | Returns the mxCellStates for the given array of mxCells. |
getStates | Returns the mxCellStates for the given array of mxCells. |
removeState | Removes and returns the mxCellState for the given cell. |
createState | Creates the state for the specified cell. |
var $EMPTY_POINT
An empty mxPoint instance.
var $graph
Holds the mxGraph.
function mxGraphView( $graph )
Constructs a new view for the specified mxGraph.
function getGraphBounds()
Returns graphBounds.
function setGraphBounds( $value )
Sets graphBounds.
function validate( $cell = null )
Calls validateCell and <validateCellState> and updates the graphBounds using getBoundingBox. Finally the background is validated using <validateBackground>.
cell | Optional mxCell to be used as the root of the validation. Default is the root of the model. |
function getBoundingBox( $state, $recurse = true )
Returns the bounding box of the shape and the label for the given mxCellState and its children if recurse is true.
state | mxCellState whose bounding box should be returned. |
recurse | Optional boolean indicating if the children should be included. Default is true. |
function validateCell( $cell, $visible = true )
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 | mxCell whose mxCellState should be created. |
visible | Optional boolean indicating if the cell should be visible. Default is true. |
Validates and repaints the mxCellState for the given mxCell.
cell | mxCell whose mxCellState should be validated. |
recurse | Optional boolean indicating if the children of the cell should be validated. Default is true. |
function updateCellState( $state, $source, $target )
Updates the given mxCellState.
state | mxCellState to be updated. |
source | mxCellState that represents the visible source. |
target | mxCellState that represents the visible target. |
function updateVertexLabelOffset( $state )
Updates the absoluteOffset of the given vertex cell state. This takes into account the label position styles.
state | mxCellState whose absolute offset should be updated. |
function updateFixedTerminalPoints( $edge, $source, $target )
Sets the initial absolute terminal points in the given state before the edge style is computed.
edge | mxCellState whose initial terminal points should be updated. |
source | mxCellState which represents the source terminal. |
target | mxCellState which represents the target terminal. |
function updateFixedTerminalPoint( $edge, $terminal, $source, $constraint )
Sets the fixed source or target terminal point on the given edge.
edge | mxCellState whose terminal point should be updated. |
terminal | mxCellState which represents the actual terminal. |
source | Boolean that specifies if the terminal is the source. |
constraint | mxConnectionConstraint that specifies the connection. |
function updatePoints( $edge, $points, $source, $target )
Updates the absolute points in the given state using the specified array of mxPoints as the relative points.
edge | mxCellState whose absolute points should be updated. |
points | Array of mxPoints that constitute the relative points. |
source | mxCellState that represents the source terminal. |
target | mxCellState that represents the target terminal. |
function updateFloatingTerminalPoints( $state, $source, $target )
Updates the terminal points in the given state after the edge style was computed for the edge.
state | mxCellState whose terminal points should be updated. |
source | mxCellState that represents the source terminal. |
target | mxCellState that represents the target terminal. |
function updateFloatingTerminalPoint( $edge, $start, $end, $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.
edge | mxCellState whose terminal point should be updated. |
start | mxCellState for the terminal on “this” side of the edge. |
end | mxCellState for the terminal on the other side of the edge. |
source | Boolean indicating if start is the source terminal state. |
function getTerminalPort( $state, $terminal, $source )
Returns an mxCellState that represents the source or target terminal or port for the given edge.
state | mxCellState that represents the state of the edge. |
terminal | mxCellState that represents the terminal. |
source | Boolean indicating if the given terminal is the source terminal. |
function getPerimeterPoint( $terminal, $next, $orthogonal, $border = null )
Returns an mxPoint 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 | mxCellState for the source or target terminal. |
next | mxPoint that lies outside of the given terminal. |
orthogonal | Boolean that 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. |
function getPerimeterBounds( $terminal, $border = 0 )
Returns the perimeter bounds for the given terminal, edge pair as an mxRectangle.
terminal | mxCellState that represents the terminal. |
border | Number that adds a border between the shape and the perimeter. |
function getNextPoint( $edge, $opposite, $source )
Returns the nearest point in the list of absolute points or the center of the opposite terminal.
edge | mxCellState that represents the edge. |
opposite | mxCellState that represents the opposite terminal. |
source | Boolean indicating if the next point for the source or target should be returned. |
function getVisibleTerminal( $edge, $source )
Returns the nearest ancestor terminal that is visible. The edge appears to be connected to this terminal on the display.
edge | mxCell whose visible terminal should be returned. |
source | Boolean that specifies if the source or target terminal should be returned. |
function getPoint( $state, $geometry = null )
Returns the absolute point on the edge for the given relative mxGeometry as an mxPoint. The edge is represented by the given mxCellState.
state | mxCellState that represents the state of the parent edge. |
geometry | mxGeometry that represents the relative location. |
function getStates()
Returns the mxCellStates for the given array of mxCells. The array contains all states that are not null, that is, the returned array may have less elements than the given array.
Returns the mxCellStates for the given array of mxCells. The array contains all states that are not null, that is, the returned array may have less elements than the given array.
An empty mxPoint instance.
var $EMPTY_POINT
Holds the mxGraph.
var $graph
Holds the bounds of the current view.
var $graphBounds
Holds the current scale.
var $scale
Holds the current translate.
var $translate
Maps from cells to states.
var $states
Constructs a new view for the specified mxGraph.
function mxGraphView( $graph )
Sets the scale, revalidates the view and fires a scale event.
function setScale( $scale )
Sets the translation, revalidates the view and fires a translate event.
function setTranslate( $translate )
Returns graphBounds.
function getGraphBounds()
Sets graphBounds.
function setGraphBounds( $value )
Returns the bounding for for an array of cells or null, if no cells are specified.
function getBounds( $cells, $boundingBox = false )
Invalidates the cached cell states.
function invalidate()
Calls validateCell and validateCellState and updates the graphBounds using getBoundingBox.
function validate( $cell = null )
Recursively creates the cell state for the given cell if visible is true and the given cell is visible.
function validateCell( $cell, $visible = true )
Returns the bounding box of the shape and the label for the given mxCellState and its children if recurse is true.
function getBoundingBox( $state, $recurse = true )
Updates the given mxCellState.
function updateCellState( $state, $source, $target )
Validates the given cell state.
function updateVertexState( $state, $geo )
Validates the given cell state.
function updateEdgeState( $state, $geo, $source, $target )
Updates the absoluteOffset of the given vertex cell state.
function updateVertexLabelOffset( $state )
Updates the label bounds in the given state.
function updateLabelBounds( $state )
Updates the bounding box in the given cell state.
function updateBoundingBox( $state )
Sets the initial absolute terminal points in the given state before the edge style is computed.
function updateFixedTerminalPoints( $edge, $source, $target )
Sets the fixed source or target terminal point on the given edge.
function updateFixedTerminalPoint( $edge, $terminal, $source, $constraint )
Updates the absolute points in the given state using the specified array of mxPoints as the relative points.
function updatePoints( $edge, $points, $source, $target )
Transforms the given control point to an absolute point.
function transformControlPoint( $state, $pt )
Returns the edge style function to be used to render the given edge state.
function getEdgeStyle( $edge, $points, $source, $target )
Updates the terminal points in the given state after the edge style was computed for the edge.
function updateFloatingTerminalPoints( $state, $source, $target )
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.
function updateFloatingTerminalPoint( $edge, $start, $end, $source )
Returns an mxCellState that represents the source or target terminal or port for the given edge.
function getTerminalPort( $state, $terminal, $source )
Returns an mxPoint that defines the location of the intersection point between the perimeter and the line between the center of the shape and the given point.
function getPerimeterPoint( $terminal, $next, $orthogonal, $border = null )
Returns the x-coordinate of the center point for automatic routing.
function getRoutingCenterX( $state )
Returns the y-coordinate of the center point for automatic routing.
function getRoutingCenterY( $state )
Returns the perimeter bounds for the given terminal, edge pair as an mxRectangle.
function getPerimeterBounds( $terminal, $border = 0 )
Returns the perimeter function for the given state.
function getPerimeterFunction( $state )
Returns the nearest point in the list of absolute points or the center of the opposite terminal.
function getNextPoint( $edge, $opposite, $source )
Returns the nearest ancestor terminal that is visible.
function getVisibleTerminal( $edge, $source )
Updates the bounds of the specified state based on the absolute points in the state.
function updateEdgeBounds( $state )
Returns the absolute point on the edge for the given relative mxGeometry as an mxPoint.
function getPoint( $state, $geometry = null )
Returns the cell state for the specified cell.
function getState( $cell, $create = false )
Returns a unique string that represents the given instance.
function getHashCode( $cell )
Returns the mxCellStates for the given array of mxCells.
function getStates()
Removes and returns the mxCellState for the given cell.
function removeState( $cell, $recurse = false )
Creates the state for the specified cell.
function createState( $cell )