mxGraphView

Implements a view for the graph.  Fires scale and translate events if one of the values change.

This class fires the following events

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.

Summary
mxGraphViewImplements a view for the graph.
Variables
EMPTY_POINTAn empty mxPoint instance.
graphHolds the mxGraph.
graphBoundsHolds the bounds of the current view.
scaleHolds the current scale.
translateHolds the current translate.
statesMaps from cells to states.
Functions
mxGraphViewConstructs a new view for the specified mxGraph.
setScaleSets the scale, revalidates the view and fires a scale event.
setTranslateSets the translation, revalidates the view and fires a translate event.
getGraphBoundsReturns graphBounds.
setGraphBoundsSets graphBounds.
getBoundingBoxReturns the bounding for for an array of cells or null, if no cells are specified.
getBoundsReturns the bounding for for an array of cells or null, if no cells are specified.
invalidate
invalidateInvalidates the cached cell states.
validateCalls validateBounds followed by validatePoints on the root cell if the cache is invalid.
validateBoundsValidates the bounds of the cell state for the specified cell recursively, for all children if the cell is not collapsed.
updateVertexLabelOffsetUpdates the absoluteOffset of the given vertex cell state.
validatePointsValidates the points of the cell state for the specified cell recursively, for all children if the cell is not collapsed.
childMovedInvoked when a child state was moved as a result of late evaluation of its position.
updateBoundingBoxUpdates the label bounds in the given state.
updateBoundingBoxUpdates the bounding box in the given cell state.
updateFixedTerminalPointsSets the initial absolute terminal points in the given state before the edge style is computed.
updateFixedTerminalPointSets the fixed source or target terminal point on the given edge.
updatePointsUpdates the absolute points in the given state using the specified array of mxPoints as the relative points.
transformControlPointTransforms the given control point to an absolute point.
getEdgeStyleReturns the edge style function to be used to render the given edge state.
updateFloatingTerminalPointsUpdates the terminal points in the given state after the edge style was computed for the edge.
updateFloatingTerminalPointUpdates the absolute terminal point in the given state for the given start and end state, where start is the source if source is true.
getTerminalPortReturns an mxCellState that represents the source or target terminal or port for the given edge.
getPerimeterPointReturns 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.
getRoutingCenterXReturns the x-coordinate of the center point for automatic routing.
getRoutingCenterYReturns the y-coordinate of the center point for automatic routing.
getPerimeterBoundsReturns the perimeter bounds for the given terminal, edge pair as an mxRectangle.
getPerimeterFunctionReturns the perimeter function for the given state.
getNextPointReturns the nearest point in the list of absolute points or the center of the opposite terminal.
getVisibleTerminalReturns the nearest ancestor terminal that is visible.
updateEdgeBoundsUpdates the bounds of the specified state based on the absolute points in the state.
getPointReturns the absolute point on the edge for the given relative mxGeometry as an mxPoint.
getStateReturns the cell state for the specified cell.
getHashCodeReturns a unique string that represents the given instance.
getStatesReturns the mxCellStates for the given array of mxCells.
getStatesReturns the mxCellStates for the given array of mxCells.
removeStateRemoves and returns the mxCellState for the given cell.
createStateCreates the state for the specified cell.

Variables

EMPTY_POINT

var $EMPTY_POINT

An empty mxPoint instance.

graph

var $graph

Holds the mxGraph.

graphBounds

var $graphBounds

Holds the bounds of the current view.

scale

var $scale

Holds the current scale.

translate

var $translate

Holds the current translate.

states

var $states

Maps from cells to states.

Functions

mxGraphView

function mxGraphView($graph)

Constructs a new view for the specified mxGraph.

setScale

function setScale($scale)

Sets the scale, revalidates the view and fires a scale event.

setTranslate

function setTranslate($translate)

Sets the translation, revalidates the view and fires a translate event.

getGraphBounds

function getGraphBounds()

Returns graphBounds.

setGraphBounds

function setGraphBounds($value)

Sets graphBounds.

getBoundingBox

function getBoundingBox($cells)

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

getBounds

function getBounds($cells,  
$boundingBox =  false)

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

invalidate

invalidate

function invalidate()

Invalidates the cached cell states.

validate

function validate($cell =  null)

Calls validateBounds followed by validatePoints on the root cell if the cache is invalid.

validateBounds

function validateBounds($parentState,
$cell)

Validates the bounds of the cell state for the specified cell recursively, for all children if the cell is not collapsed.

updateVertexLabelOffset

function updateVertexLabelOffset($state)

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

Parameters

statemxCellState whose absolute offset should be updated.

validatePoints

function validatePoints($parentState,
$cell)

Validates the points of the cell state for the specified cell recursively, for all children if the cell is not collapsed.

childMoved

function childMoved($parent,
$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.

Parameters

parentmxCellState that represents the parent state.
childmxCellState that represents the child state.

updateBoundingBox

Updates the label bounds in the given state.

updateBoundingBox

function updateBoundingBox($state)

Updates the bounding box in the given cell state.

updateFixedTerminalPoints

function updateFixedTerminalPoints($edge,
$source,
$target)

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

Parameters

edgemxCellState whose initial terminal points should be updated.
sourcemxCellState which represents the source terminal.
targetmxCellState which represents the target terminal.

updateFixedTerminalPoint

function updateFixedTerminalPoint($edge,
$terminal,
$source,
$constraint)

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

Parameters

edgemxCellState whose terminal point should be updated.
terminalmxCellState which represents the actual terminal.
sourceBoolean that specifies if the terminal is the source.
constraintmxConnectionConstraint that specifies the connection.

updatePoints

function updatePoints($edge,
$points,
$source,
$target)

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

Parameters

edgemxCellState whose absolute points should be updated.
pointsArray of mxPoints that constitute the relative points.
sourcemxCellState that represents the source terminal.
targetmxCellState that represents the target terminal.

transformControlPoint

function transformControlPoint($state,
$pt)

Transforms the given control point to an absolute point.

getEdgeStyle

function getEdgeStyle($edge,
$points,
$source,
$target)

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

updateFloatingTerminalPoints

function updateFloatingTerminalPoints($state,
$source,
$target)

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

Parameters

statemxCellState whose terminal points should be updated.
sourcemxCellState that represents the source terminal.
targetmxCellState that represents the target terminal.

updateFloatingTerminalPoint

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.

Parameters

edgemxCellState whose terminal point should be updated.
startmxCellState for the terminal on “this” side of the edge.
endmxCellState for the terminal on the other side of the edge.
sourceBoolean indicating if start is the source terminal state.

getTerminalPort

function getTerminalPort($state,
$terminal,
$source)

Returns an mxCellState that represents the source or target terminal or port for the given edge.

Parameters

statemxCellState that represents the state of the edge.
terminalmxCellState that represents the terminal.
sourceBoolean indicating if the given terminal is the source terminal.

getPerimeterPoint

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.

Parameters

terminalmxCellState for the source or target terminal.
nextmxPoint that lies outside of the given terminal.
orthogonalBoolean 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.
borderOptional border between the perimeter and the shape.

getRoutingCenterX

function getRoutingCenterX($state)

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

getRoutingCenterY

function getRoutingCenterY($state)

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

getPerimeterBounds

function getPerimeterBounds($terminal,  
$border =  0)

Returns the perimeter bounds for the given terminal, edge pair as an mxRectangle.

Parameters

terminalmxCellState that represents the terminal.
borderNumber that adds a border between the shape and the perimeter.

getPerimeterFunction

function getPerimeterFunction($state)

Returns the perimeter function for the given state.

getNextPoint

function getNextPoint($edge,
$opposite,
$source)

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

Parameters

edgemxCellState that represents the edge.
oppositemxCellState that represents the opposite terminal.
sourceBoolean indicating if the next point for the source or target should be returned.

getVisibleTerminal

function getVisibleTerminal($edge,
$source)

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

Parameters

edgemxCell whose visible terminal should be returned.
sourceBoolean that specifies if the source or target terminal should be returned.

updateEdgeBounds

function updateEdgeBounds($state)

Updates the bounds of the specified state based on the absolute points in the state.

getPoint

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.

Parameters

statemxCellState that represents the state of the parent edge.
geometrymxGeometry that represents the relative location.

getState

function getState($cell,  
$create =  false)

Returns the cell state for the specified cell.  If create is true then the state is created and added to the cache if it does not yet exist.

getHashCode

function getHashCode($cell)

Returns a unique string that represents the given instance.

getStates

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.

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.

removeState

function removeState($cell)

Removes and returns the mxCellState for the given cell.

createState

function createState($cell)

Creates the state for the specified cell.

var $EMPTY_POINT
An empty mxPoint instance.
Implements a 2-dimensional point with double precision coordinates.
var $graph
Holds the mxGraph.
Implements a graph component.
var $graphBounds
Holds the bounds of the current view.
var $scale
Holds the current scale.
var $translate
Holds the current translate.
var $states
Maps from cells to states.
function mxGraphView($graph)
Constructs a new view for the specified mxGraph.
function setScale($scale)
Sets the scale, revalidates the view and fires a scale event.
function setTranslate($translate)
Sets the translation, revalidates the view and fires a translate event.
function getGraphBounds()
Returns graphBounds.
function setGraphBounds($value)
Sets graphBounds.
function getBoundingBox($cells)
Returns the bounding for for an array of cells or null, if no cells are specified.
function getBounds($cells,  
$boundingBox =  false)
Returns the bounding for for an array of cells or null, if no cells are specified.
function invalidate()
Invalidates the cached cell states.
function validate($cell =  null)
Calls validateBounds followed by validatePoints on the root cell if the cache is invalid.
function validateBounds($parentState,
$cell)
Validates the bounds of the cell state for the specified cell recursively, for all children if the cell is not collapsed.
function validatePoints($parentState,
$cell)
Validates the points of the cell state for the specified cell recursively, for all children if the cell is not collapsed.
function updateVertexLabelOffset($state)
Updates the absoluteOffset of the given vertex cell state.
function childMoved($parent,
$child)
Invoked when a child state was moved as a result of late evaluation of its position.
function updateBoundingBox($state)
Updates the bounding box in the given cell state.
function updateFixedTerminalPoints($edge,
$source,
$target)
Sets the initial absolute terminal points in the given state before the edge style is computed.
function updateFixedTerminalPoint($edge,
$terminal,
$source,
$constraint)
Sets the fixed source or target terminal point on the given edge.
function updatePoints($edge,
$points,
$source,
$target)
Updates the absolute points in the given state using the specified array of mxPoints as the relative points.
function transformControlPoint($state,
$pt)
Transforms the given control point to an absolute point.
function getEdgeStyle($edge,
$points,
$source,
$target)
Returns the edge style function to be used to render the given edge state.
function updateFloatingTerminalPoints($state,
$source,
$target)
Updates the terminal points in the given state after the edge style was computed for the edge.
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.
function getTerminalPort($state,
$terminal,
$source)
Returns an mxCellState that represents the source or target terminal or port for the given edge.
Represents the current state of a cell in a given mxGraphView.
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.
function getRoutingCenterX($state)
Returns the x-coordinate of the center point for automatic routing.
function getRoutingCenterY($state)
Returns the y-coordinate of the center point for automatic routing.
function getPerimeterBounds($terminal,  
$border =  0)
Returns the perimeter bounds for the given terminal, edge pair as an mxRectangle.
Implements a 2-dimensional rectangle with double precision coordinates.
function getPerimeterFunction($state)
Returns the perimeter function for the given state.
function getNextPoint($edge,
$opposite,
$source)
Returns the nearest point in the list of absolute points or the center of the opposite terminal.
function getVisibleTerminal($edge,
$source)
Returns the nearest ancestor terminal that is visible.
function updateEdgeBounds($state)
Updates the bounds of the specified state based on the absolute points in the state.
function getPoint($state,  
$geometry =  null)
Returns the absolute point on the edge for the given relative mxGeometry as an mxPoint.
Represents the geometry of a cell.
function getState($cell,  
$create =  false)
Returns the cell state for the specified cell.
function getHashCode($cell)
Returns a unique string that represents the given instance.
function getStates()
Returns the mxCellStates for the given array of mxCells.
Cells are the elements of the graph model.
function removeState($cell)
Removes and returns the mxCellState for the given cell.
function createState($cell)
Creates the state for the specified cell.
Defines an object that contains the constraints about how to connect one side of an edge to its terminal.
Close