<divid=Content><divclass="CClass"><divclass=CTopicid=MainTopic><h1class=CTitle><aname="mxGeometry"></a>mxGeometry</h1><divclass=CBody><p>Extends <ahref="../util/mxRectangle-js.html#mxRectangle"class=LClassid=link24onMouseOver="ShowTip(event, 'tt1', 'link24')"onMouseOut="HideTip('tt1')">mxRectangle</a> to represent the geometry of a cell.</p><p>For vertices, the geometry consists of the x- and y-location, and the width and height. For edges, the geometry consists of the optional terminal- and control points. The terminal points are only required if an edge is unconnected, and are stored in the sourcePoint> and <ahref="#mxGeometry.targetPoint"class=LVariableid=link25onMouseOver="ShowTip(event, 'tt7', 'link25')"onMouseOut="HideTip('tt7')">targetPoint</a> variables, respectively.</p><h4class=CHeading>Example</h4><p>If an edge is unconnected, that is, it has no source or target terminal, then a geometry with terminal points for a new edge can be defined as follows.</p><blockquote><preclass="prettyprint">geometry.setTerminalPoint(new mxPoint(x1, y1), true);
geometry.setTerminalPoint(new mxPoint(x3, y3), false);</pre></blockquote><p>Control points are used regardless of the connected state of an edge and may be ignored or interpreted differently depending on the edge’s <ahref="../view/mxEdgeStyle-js.html#mxEdgeStyle"class=LClassid=link26onMouseOver="ShowTip(event, 'tt16', 'link26')"onMouseOut="HideTip('tt16')">mxEdgeStyle</a>.</p><p>To disable automatic reset of control points after a cell has been moved or resized, the the <mxGraph.resizeEdgesOnMove> and <ahref="../view/mxGraph-js.html#mxGraph.resetEdgesOnResize"class=LVariableid=link27onMouseOver="ShowTip(event, 'tt17', 'link27')"onMouseOut="HideTip('tt17')">mxGraph.resetEdgesOnResize</a> may be used.</p><h4class=CHeading>Edge Labels</h4><p>Using the x- and y-coordinates of a cell’s geometry, it is possible to position the label on edges on a specific location on the actual edge shape as it appears on the screen. The x-coordinate of an edge’s geometry is used to describe the distance from the center of the edge from -1 to 1 with 0 being the center of the edge and the default value. The y-coordinate of an edge’s geometry is used to describe the absolute, orthogonal distance in pixels from that point. In addition, the <ahref="#mxGeometry.offset"class=LVariableid=link28onMouseOver="ShowTip(event, 'tt9', 'link28')"onMouseOut="HideTip('tt9')">mxGeometry.offset</a> is used as an absolute offset vector from the resulting point.</p><p>This coordinate system is applied if <ahref="#mxGeometry.relative"class=LVariableid=link29onMouseOver="ShowTip(event, 'tt10', 'link29')"onMouseOut="HideTip('tt10')">relative</a> is true, otherwise the offset defines the absolute vector from the edge’s center point to the label.</p><p>The width and height parameter for edge geometries can be used to set the label width and height (eg. for word wrapping).</p><h4class=CHeading>Ports</h4><p>The term “port” refers to a relatively positioned, connectable child cell, which is used to specify the connection between the parent and another cell in the graph. Ports are typically modeled as vertices with relative geometries.</p><h4class=CHeading>Offsets</h4><p>The <ahref="#mxGeometry.offset"class=LVariableid=link30onMouseOver="ShowTip(event, 'tt9', 'link30')"onMouseOut="HideTip('tt9')">offset</a> field is interpreted in 3 different ways, depending on the cell and the geometry. For edges, the offset defines the absolute offset for the edge label. For relative geometries, the offset defines the absolute offset for the origin (top, left corner) of the vertex, otherwise the offset defines the absolute offset for the label inside the vertex or group.</p><!--START_ND_SUMMARY--><divclass=Summary><divclass=STitle>Summary</div><divclass=SBorder><tableborder=0cellspacing=0cellpadding=0class=STable><trclass="SMain"><tdclass=SEntry><ahref="#mxGeometry">mxGeometry</a></td><tdclass=SDescription>Extends <ahref="../util/mxRectangle-js.html#mxRectangle"class=LClassid=link1onMouseOver="ShowTip(event, 'tt1', 'link1')"onMouseOut="HideTip('tt1')">mxRectangle</a> to represent the geometry of a cell.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxGeometry.Functions">Functions</a></td><tdclass=SDescription></td></tr><trclass="SFunction SIndent2 SMarked"><tdclass=SEntry><ahref="#mxGeometry.mxGeometry"id=link2onMouseOver="ShowTip(event, 'tt2', 'link2')"onMouseOut="HideTip('tt2')">mxGeometry</a></td><tdclass=SDescription>Constructs a new object to describe the size and location of a vertex or the control points of an edge.</td></tr><trclass="SGroup SIndent1"><tdclass=SEntry><ahref="#mxGeometry.Variables">Variables</a></td><tdclass=SDescription></td></tr><trclass="SVariable SIndent2 SMarked"><tdclass=SEntry><ahref="#mxGeometry.TRANSLATE_CONTROL_POINTS"id=link3onMouseOver="ShowTip(event, 'tt3', 'link3')"onMouseOut="HideTip('tt3')">TRANSLATE_CONTROL_POINTS</a></td><tdclass=SDescription>Global switch to translate the points i
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.mxGeometry"></a>mxGeometry</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function mxGeometry(</td><tdclass=PParameternowrap>x,</td></tr><tr><td></td><tdclass=PParameternowrap>y,</td></tr><tr><td></td><tdclass=PParameternowrap>width,</td></tr><tr><td></td><tdclass=PParameternowrap>height</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Constructs a new object to describe the size and location of a vertex or the control points of an edge.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.TRANSLATE_CONTROL_POINTS"></a>TRANSLATE_CONTROL_POINTS</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.TRANSLATE_CONTROL_POINTS</td></tr></table></blockquote><p>Global switch to translate the points in translate. Default is true.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.alternateBounds"></a>alternateBounds</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.alternateBounds</td></tr></table></blockquote><p>Stores alternate values for x, y, width and height in a rectangle. See <ahref="#mxGeometry.swap"class=LFunctionid=link31onMouseOver="ShowTip(event, 'tt11', 'link31')"onMouseOut="HideTip('tt11')">swap</a> to exchange the values. Default is null.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.sourcePoint"></a>sourcePoint</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.sourcePoint</td></tr></table></blockquote><p>Defines the source <ahref="../util/mxPoint-js.html#mxPoint"class=LClassid=link32onMouseOver="ShowTip(event, 'tt6', 'link32')"onMouseOut="HideTip('tt6')">mxPoint</a> of the edge. This is used if the corresponding edge does not have a source vertex. Otherwise it is ignored. Default is null.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.targetPoint"></a>targetPoint</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.targetPoint</td></tr></table></blockquote><p>Defines the target <ahref="../util/mxPoint-js.html#mxPoint"class=LClassid=link33onMouseOver="ShowTip(event, 'tt6', 'link33')"onMouseOut="HideTip('tt6')">mxPoint</a> of the edge. This is used if the corresponding edge does not have a target vertex. Otherwise it is ignored. Default is null.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.points"></a>points</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.points</td></tr></table></blockquote><p>Array of <ahref="../util/mxPoint-js.html#mxPoint"class=LClassid=link34onMouseOver="ShowTip(event, 'tt6', 'link34')"onMouseOut="HideTip('tt6')">mxPoints</a> which specifies the control points along the edge. These points are the intermediate points on the edge, for the endpoints use <ahref="#mxGeometry.targetPoint"class=LVariableid=link35onMouseOver="ShowTip(event, 'tt7', 'link35')"onMouseOut="HideTip('tt7')">targetPoint</a> and <ahref="#mxGeometry.sourcePoint"class=LVariableid=link36onMouseOver="ShowTip(event, 'tt5', 'link36')"onMouseOut="HideTip('tt5')">sourcePoint</a> or set the terminals of the edge to a non-null value. Default is null.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.offset"></a>offset</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.offset</td></tr></table></blockquote><p>For edges, this holds the offset (in pixels) from the position defined by <x> and <y> on the edge. For relative geometries (for vertices), this defines the absolute offset from the point defined by the relative coordinates. For absolute geometries (for vertices), this defines the offset for the label. Default is null.</p></div></div></div>
<divclass="CVariable"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.relative"></a>relative</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.relative</td></tr></table></blockquote><p>Specifies if the coordinates in the geometry are to be interpreted as relative coordinates. For edges, this is used to define the location of the edge label relative to the edge as rendered on the display. For vertices, this specifies the relative location inside the bounds of the parent cell.</p><p>If this is false, then the coordinates are relative to the origin of the parent cell or, for edges, the edge label position is relative to the center of the edge as rendered on screen.</p><p>Default is false.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.swap"></a>swap</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.swap = function()</td></tr></table></blockquote><p>Swaps the x, y, width and height with the values stored in <ahref="#mxGeometry.alternateBounds"class=LVariableid=link37onMouseOver="ShowTip(event, 'tt4', 'link37')"onMouseOut="HideTip('tt4')">alternateBounds</a> and puts the previous values into <ahref="#mxGeometry.alternateBounds"class=LVariableid=link38onMouseOver="ShowTip(event, 'tt4', 'link38')"onMouseOut="HideTip('tt4')">alternateBounds</a> as a rectangle. This operation is carried-out in-place, that is, using the existing geometry instance. If this operation is called during a graph model transactional change, then the geometry should be cloned before calling this method and setting the geometry of the cell using <ahref="mxGraphModel-js.html#mxGraphModel.setGeometry"class=LFunctionid=link39onMouseOver="ShowTip(event, 'tt18', 'link39')"onMouseOut="HideTip('tt18')">mxGraphModel.setGeometry</a>.</p></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.getTerminalPoint"></a>getTerminalPoint</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxGeometry.prototype.getTerminalPoint = function(</td><tdclass=PParameternowrap>isSource</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns the <ahref="../util/mxPoint-js.html#mxPoint"class=LClassid=link40onMouseOver="ShowTip(event, 'tt6', 'link40')"onMouseOut="HideTip('tt6')">mxPoint</a> representing the source or target point of this edge. This is only used if the edge has no source or target vertex.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>isSource</td><tdclass=CDLDescription>Boolean that specifies if the source or target point should be returned.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.setTerminalPoint"></a>setTerminalPoint</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxGeometry.prototype.setTerminalPoint = function(</td><tdclass=PParameternowrap>point,</td></tr><tr><td></td><tdclass=PParameternowrap>isSource</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Sets the <ahref="#mxGeometry.sourcePoint"class=LVariableid=link41onMouseOver="ShowTip(event, 'tt5', 'link41')"onMouseOut="HideTip('tt5')">sourcePoint</a> or <ahref="#mxGeometry.targetPoint"class=LVariableid=link42onMouseOver="ShowTip(event, 'tt7', 'link42')"onMouseOut="HideTip('tt7')">targetPoint</a> to the given <ahref="../util/mxPoint-js.html#mxPoint"class=LClassid=link43onMouseOver="ShowTip(event, 'tt6', 'link43')"onMouseOut="HideTip('tt6')">mxPoint</a> and returns the new point.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>point</td><tdclass=CDLDescription>Point to be used as the new source or target point.</td></tr><tr><tdclass=CDLEntry>isSource</td><tdclass=CDLDescription>Boolean that specifies if the source or target point should be set.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.translate"></a>translate</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxGeometry.prototype.translate = function(</td><tdclass=PParameternowrap>dx,</td></tr><tr><td></td><tdclass=PParameternowrap>dy</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Translates the geometry by the specified amount. That is, <x> and <y> of the geometry, the <ahref="#mxGeometry.sourcePoint"class=LVariableid=link44onMouseOver="ShowTip(event, 'tt5', 'link44')"onMouseOut="HideTip('tt5')">sourcePoint</a>, <ahref="#mxGeometry.targetPoint"class=LVariableid=link45onMouseOver="ShowTip(event, 'tt7', 'link45')"onMouseOut="HideTip('tt7')">targetPoint</a> and all elements of <ahref="#mxGeometry.points"class=LVariableid=link46onMouseOver="ShowTip(event, 'tt8', 'link46')"onMouseOut="HideTip('tt8')">points</a> are translated by the given amount. <x> and <y> are only translated if <ahref="#mxGeometry.relative"class=LVariableid=link47onMouseOver="ShowTip(event, 'tt10', 'link47')"onMouseOut="HideTip('tt10')">relative</a> is false. If <ahref="#mxGeometry.TRANSLATE_CONTROL_POINTS"class=LVariableid=link48onMouseOver="ShowTip(event, 'tt3', 'link48')"onMouseOut="HideTip('tt3')">TRANSLATE_CONTROL_POINTS</a> is false, then <ahref="#mxGeometry.points"class=LVariableid=link49onMouseOver="ShowTip(event, 'tt8', 'link49')"onMouseOut="HideTip('tt8')">points</a> are not modified by this function.</p><h4class=CHeading>Parameters</h4><tableborder=0cellspacing=0cellpadding=0class=CDescriptionList><tr><tdclass=CDLEntry>dx</td><tdclass=CDLDescription>Integer that specifies the x-coordinate of the translation.</td></tr><tr><tdclass=CDLEntry>dy</td><tdclass=CDLDescription>Integer that specifies the y-coordinate of the translation.</td></tr></table></div></div></div>
<divclass="CFunction"><divclass=CTopic><h3class=CTitle><aname="mxGeometry.equals"></a>equals</h3><divclass=CBody><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxGeometry.prototype.equals = function(</td><tdclass=PParameternowrap>obj</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote><p>Returns true if the given object equals this geometry.</p></div></div></div>
<divclass=CToolTipid="tt1"><divclass=CClass>Extends mxPoint to implement a 2-dimensional rectangle with double precision coordinates.</div></div><divclass=CToolTipid="tt2"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>function mxGeometry(</td><tdclass=PParameternowrap>x,</td></tr><tr><td></td><tdclass=PParameternowrap>y,</td></tr><tr><td></td><tdclass=PParameternowrap>width,</td></tr><tr><td></td><tdclass=PParameternowrap>height</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Constructs a new object to describe the size and location of a vertex or the control points of an edge.</div></div><divclass=CToolTipid="tt3"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.TRANSLATE_CONTROL_POINTS</td></tr></table></blockquote>Global switch to translate the points in translate. </div></div><divclass=CToolTipid="tt4"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.alternateBounds</td></tr></table></blockquote>Stores alternate values for x, y, width and height in a rectangle. </div></div><divclass=CToolTipid="tt5"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.sourcePoint</td></tr></table></blockquote>Defines the source mxPoint of the edge. </div></div><divclass=CToolTipid="tt6"><divclass=CClass>Implements a 2-dimensional vector with double precision coordinates.</div></div><divclass=CToolTipid="tt7"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.targetPoint</td></tr></table></blockquote>Defines the target mxPoint of the edge. </div></div><divclass=CToolTipid="tt8"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.points</td></tr></table></blockquote>Array of mxPoints which specifies the control points along the edge. </div></div><divclass=CToolTipid="tt9"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.offset</td></tr></table></blockquote>For edges, this holds the offset (in pixels) from the position defined by x and y on the edge. </div></div><divclass=CToolTipid="tt10"><divclass=CVariable><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.relative</td></tr></table></blockquote>Specifies if the coordinates in the geometry are to be interpreted as relative coordinates. </div></div><divclass=CToolTipid="tt11"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td>mxGeometry.prototype.swap = function()</td></tr></table></blockquote>Swaps the x, y, width and height with the values stored in alternateBounds and puts the previous values into alternateBounds as a rectangle. </div></div><divclass=CToolTipid="tt12"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxGeometry.prototype.getTerminalPoint = function(</td><tdclass=PParameternowrap>isSource</td><tdclass=PAfterParametersnowrap>)</td></tr></table></td></tr></table></blockquote>Returns the mxPoint representing the source or target point of this edge. </div></div><divclass=CToolTipid="tt13"><divclass=CFunction><blockquote><tableborder=0cellspacing=0cellpadding=0class="Prototype prettyprint"><tr><td><tableborder=0cellspacing=0cellpadding=0><tr><tdclass=PBeforeParametersnowrap>mxGeometry.prototype.setTerminalPoint = function(</td><tdclass=PParameternowrap>poin