Interface ITopologyGraph

Namespace
ESRI.ArcGIS.Geodatabase
Assembly
ESRI.Server.Geodatabase.dll

Provides access to members that control the topology graph.

[Guid("4ADC1017-3C78-434B-A32C-1817A42EB857")]
[InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
public interface ITopologyGraph

Remarks

Use the ITopologyGraph::Build method to construct the topology elements (topology nodes and topology edges). After a TopologyGraph is built, the spatial relationships between features are discovered, analyzed, and established to form an in-memory graph of topological elements. The TopologyGraph should create before accessing properties or calling other methods on this interface.

[C#]

void OpenTopologyGraph(ITopology topology, IGeoDataset geoDataset)

{

  //Open the topology graph.

  ITopologyGraph topologyGraph = topology.Cache;

  //Check to see if an existing graph is built for the area of interest.

  IEnvelope existingGraphEnv = topologyGraph.BuildExtent;

  //Build the cache using the geodatasets extent 

  topologyGraph.Build(geoDataset.Extent, false);

  // Get edges

  IEnumTopologyEdge enumEdges = topologyGraph.Edges;

  // Get Nodes

  IEnumTopologyNode enumNodes = topologyGraph.Nodes;

}

Properties

BuildExtent

The extent used to build the graph.

IEnvelope BuildExtent { get; }

Property Value

IEnvelope

BuildPolygonExtent

The polygon used to determine the contents of the topology graph. The topology graph maintains ownership of this reference.

IPolygon BuildPolygonExtent { get; }

Property Value

IPolygon

EdgeSelection

The enumerator for the selected edges of the topology.

IEnumTopologyEdge EdgeSelection { get; }

Property Value

IEnumTopologyEdge

Edges

The enumerator that provides access to all the edges.

IEnumTopologyEdge Edges { get; }

Property Value

IEnumTopologyEdge

Extent

The current extent of all topological elements in the graph. This may be different than the extent used to build the graph.

IEnvelope Extent { get; }

Property Value

IEnvelope

HasElement[ITopologyElement]

Indicates if the topology graph contains the specified element.

bool HasElement[ITopologyElement Element] { get; }

Parameters

Element ITopologyElement

Property Value

bool

HasPseudoNodes

Indicates if the topology graph contains pseudo nodes.

bool HasPseudoNodes { get; }

Property Value

bool

IsPosting

Indicates if the topology graph is posting.

bool IsPosting { get; }

Property Value

bool

NodeSelection

The enumerator for the selected nodes of the topology.

IEnumTopologyNode NodeSelection { get; }

Property Value

IEnumTopologyNode

Nodes

The enumerator that provides access to all the nodes.

IEnumTopologyNode Nodes { get; }

Property Value

IEnumTopologyNode

SelectionCount[int]

The count of selected elements of the specified types; whichElements is a bitwise combination of esriTopologyElement values.

int SelectionCount[int whichElements] { get; }

Parameters

whichElements int

Property Value

int

Remarks

whichElements is a bitwise combination of esriTopologyElement values.

SelectionExtent[int, bool]

The extent of the selected subset of the graph, optionally includes extent of all edges incident on selected nodes (or on nodes incident on selected edges); whichElements is a bitwise combination of esriTopologyElement values.

IEnvelope SelectionExtent[int whichElements, bool includeAdjacent] { get; }

Parameters

whichElements int
includeAdjacent bool

Property Value

IEnvelope

Remarks

whichElements is a bitwise combination of esriTopologyElement values.

SelectionParents

The feature class and oid of each parent of the selected set of elements.

IEnumTopologyParent SelectionParents { get; }

Property Value

IEnumTopologyParent

Methods

Build(IEnvelope, bool)

Creates topo elements from all topology feature classes covering the specified map extent.

void Build(IEnvelope Extent, bool preserveSelection)

Parameters

Extent IEnvelope
preserveSelection bool

BuildFromPolygon(IPolygon, bool)

Creates topo elements from all topology feature classes intersecting the specified polygon. The topology graph takes ownership of the input polygon.

void BuildFromPolygon(IPolygon Extent, bool preserveSelection)

Parameters

Extent IPolygon
preserveSelection bool

Remarks

The ITopologyGraph::BuildFromPolygon method is very similar to ITopologyGraph::Build, except the extent of the build isn't restricted to a rectangular envelope; any polygon can be used to define the build area.

[C#]

bool BuildTopoGraph(IGeometry buildGeom, ITopologyGraph topoGraph, bool

  keepSelection)

{

  if (buildGeom == null || topoGraph == null)

    return false;

  switch (buildGeom.GeometryType)

  {

    case esriGeometryType.esriGeometryPolygon:

      {

        ITopologyGraph4 topoGraph4 = topoGraph as ITopologyGraph4;

        topoGraph4.BuildFromPolygon((IPolygon)buildGeom, keepSelection);

        return true;

      }

    case esriGeometryType.esriGeometryEnvelope:

      {

        topoGraph.Build((IEnvelope)buildGeom, keepSelection);

        return true;

      }

    default:

      return false;

  }

}

[Visual Basic .NET]

Private Function BuildTopoGraph(ByVal buildGeom As IGeometry, ByVal topoGraph As ITopologyGraph, ByVal keepSelection As Boolean) As Boolean

    If buildGeom Is Nothing OrElse topoGraph Is Nothing Then

        Return False

    End If

    Select Case buildGeom.GeometryType

        Case esriGeometryType.esriGeometryPolygon

            Dim topoGraph4 As ITopologyGraph4 = TryCast(topoGraph, ITopologyGraph4)

            topoGraph4.BuildFromPolygon(CType(buildGeom, IPolygon), keepSelection)

            Return True

        Case esriGeometryType.esriGeometryEnvelope

            topoGraph.Build(CType(buildGeom, IEnvelope), keepSelection)

            Return True

        Case Else

            Return False

    End Select

End Function

DeleteEdge(ITopologyEdge)

Deletes the specified edge from its containing topology graph.

void DeleteEdge(ITopologyEdge Edge)

Parameters

Edge ITopologyEdge

DeletePseudoNodesFromSelection()

Removes pseudo-nodes by combining edges incident on such nodes. Edges and nodes in the current selection are considered.

void DeletePseudoNodesFromSelection()

DetermineNodeDegree()

Nodes located outside a polygonal build extent do not have a known degree (valence). Apply this method before using the Degree or IsDegreeKnown properties of a topology node from this graph.

void DetermineNodeDegree()

EnumHitTest(int, IPoint, double, out IEnumTGHitInfo)

Locates all elements of the graph within searchRadius units of the query point; whichElements is a bitwise combination of esriTopologyElement values.

bool EnumHitTest(int whichElements, IPoint QueryPoint, double searchRadius, out IEnumTGHitInfo hitInfo)

Parameters

whichElements int
QueryPoint IPoint
searchRadius double
hitInfo IEnumTGHitInfo

Returns

bool

Remarks

Note: whichElements is a bitwise combination of esriTopologyElement values

GetParentEdges(IFeatureClass, long)

Returns the set of edges corresponding to the specified polyline or polygon feature.

IEnumTopologyEdge GetParentEdges(IFeatureClass FeatureClass, long OID)

Parameters

FeatureClass IFeatureClass
OID long

Returns

IEnumTopologyEdge

Remarks

Note: The sub-tolerance features or features that become sub-tolerance during the "cracking and clustering" process are excluded from the topology graph. For example, the returned edges enumerator will be empty if you try to find the topology elements associated with a sub-tolerance feature using the ITopologyGraph::GetParentEdges method.

GetParentGeometry(IFeatureClass, long)

Creates a geometry corresponding to the current set of edges/nodes owned by the specified parent.

IGeometry GetParentGeometry(IFeatureClass FeatureClass, long OID)

Parameters

FeatureClass IFeatureClass
OID long

Returns

IGeometry

GetParentNodes(IFeatureClass, long)

Returns the set of nodes corresponding to the specified point or multipoint feature.

IEnumTopologyNode GetParentNodes(IFeatureClass FeatureClass, long OID)

Parameters

FeatureClass IFeatureClass
OID long

Returns

IEnumTopologyNode

HitTest(int, IPoint, double, IPoint, out double, out ITopologyElement)

Locates an element of the graph nearest to the query point that is also within searchRadius units of it; whichElements is a bitwise combination of esriTopologyElement values.

bool HitTest(int whichElements, IPoint QueryPoint, double searchRadius, IPoint hitPoint, out double hitDistance, out ITopologyElement hitElement)

Parameters

whichElements int
QueryPoint IPoint
searchRadius double
hitPoint IPoint
hitDistance double
hitElement ITopologyElement

Returns

bool

Remarks

Note: whichElements is a bitwise combination of esriTopologyElementType values

HitTestSelection(int, IPoint, double, IPoint, out double, out ITopologyElement)

Locates an element of the graph's selection nearest to the query point that is also within searchRadius units of it; whichElements is a bitwise combination of esriTopologyElement values.

bool HitTestSelection(int whichElements, IPoint QueryPoint, double searchRadius, IPoint hitPoint, out double hitDistance, out ITopologyElement hitElement)

Parameters

whichElements int
QueryPoint IPoint
searchRadius double
hitPoint IPoint
hitDistance double
hitElement ITopologyElement

Returns

bool

Remarks

Note: whichElements is a bitwise combination of esriTopologyElement values.

MergeSelectedEdges()

Merge a connected sequence of selected edges that has the same feature parent set.

void MergeSelectedEdges()

Post(out IEnvelope)

Posts changes to topology elements back to their originating features. Must be used within an edit session and edit operation.

void Post(out IEnvelope InvalidArea)

Parameters

InvalidArea IEnvelope

ReshapeEdgeGeometry(ITopologyEdge, IPath)

Reshapes (and possibly reinterpolates) the geometry of the specified edge.

bool ReshapeEdgeGeometry(ITopologyEdge Edge, IPath reshapeGeometry)

Parameters

Edge ITopologyEdge
reshapeGeometry IPath

Returns

bool

Remarks

Normally, this method can not reposition the From and To nodes of the edge. However, an exception is made when the edge is closed and doesn't interact with other edges from its From/To node. In that case, edge reshaping is done by delegating to IRing::Reshape rather than IPolyline::Reshape.

Select(esriTopologySelectionResultEnum, ITopologyElement)

Adds the specified element to the selected subset of the graph.

bool Select(esriTopologySelectionResultEnum selectHow, ITopologyElement Element)

Parameters

selectHow esriTopologySelectionResultEnum
Element ITopologyElement

Returns

bool

Remarks

If a topology element selected programmatically has to be moved using the Topology Edit Tool, the selection anchor has to be set to a valid location on the topology element.

SelectByGeometry(int, esriTopologySelectionResultEnum, IGeometry)

Selects nodes and/or edges that intersect the specified geometry; whichElements is a bitwise combination of esriTopologyElement values.

void SelectByGeometry(int whichElements, esriTopologySelectionResultEnum selectHow, IGeometry Geometry)

Parameters

whichElements int
selectHow esriTopologySelectionResultEnum
Geometry IGeometry

Remarks

Only geometry types that implement the IRelationalOperator interface are valid for the pGeometry parameter. This method uses the IRelationalOperator::Disjoint (opposite of intersect) to determine if TopologyElements have to be selected. Therefore this method may select TopologyEdges that are not completely overlapping with the input geometry if the input is of type polygon or polyline. Using a point as the input geometry is a valid way to select only one edge.

whichElements is a bitwise combination of esriTopologyElement values.

If a TopologyElement selected programmatically has to be moved using the Topology Edit Tool, the selection anchor has to be set to a valid location on the topology element.

[C#]

// For example, to move a node the selection anchor can be set to the location of the node.

ESRI.ArcGIS.Display.IAnchorPoint anchorPoint = editor.SelectionAnchor;

anchorPoint.MoveTo(topologyNode.Geometry, activeDisplay);

SetEdgeGeometry(ITopologyEdge, IPath)

Assigns the path geometry to the specified edge. Reinterpolatex vertex attributes for the edge if any exist.

void SetEdgeGeometry(ITopologyEdge Edge, IPath Geometry)

Parameters

Edge ITopologyEdge
Geometry IPath

SetEmpty()

Removes all topological elements from the graph. Any client-side references to topo elements that came from this graph should be released.

void SetEmpty()

Remarks

A topology element (TopologyNode or TopologyEdge) should not be used once the TopologyGraph has been set empty. All references to this object should be released.

SetParentSelected(IFeatureClass, long, bool)

Selects parents of edges. SUbsequent edits to those edges will only be posted back to selected parents.

bool SetParentSelected(IFeatureClass FeatureClass, long OID, bool selected)

Parameters

FeatureClass IFeatureClass
OID long
selected bool

Returns

bool

Remarks

A topology parent is a feature associated with a topology element (a topology node or topology edge). A parent can have two states; selected or unselected. This state determines if the feature will be affected by the next topology graph operation.

There is a difference between the topology selection and the parent selection. The topology selection is all the selected topology elements (Ex: ITopologyGraph::EdgeSelection or ITopologyGraph::NodeSelection). The parent selection is the state of the parent features and is independent of the topology selection. By default, for a given topology element, all of its parents are selected. However, it is possible to unselect one or more parents explicitly, so the element is still selected, but not all of the parents are. After any operation on the topology graph, the parent selection will be reset to the default state (all parents selected).

SetSelectionEmpty(int)

Clears the specified selection set: whichType is a bitwise combination of esriTopologyNode, esriTopologyEdge.

void SetSelectionEmpty(int whichType)

Parameters

whichType int

SplitEdgeAtDistance(ITopologyEdge, double, bool, double, out ITopologyEdge, out ITopologyNode, out ITopologyEdge)

Adds a pseudo-node to the edge at the specified distance along the edge. The node gets created at an existing vertex if one is located within the specified tolerance.

void SplitEdgeAtDistance(ITopologyEdge Edge, double distance, bool asRatio, double tolerance, out ITopologyEdge from, out ITopologyNode mid, out ITopologyEdge to)

Parameters

Edge ITopologyEdge
distance double
asRatio bool
tolerance double
from ITopologyEdge
mid ITopologyNode
to ITopologyEdge

SplitEdgeAtPoint(ITopologyEdge, IPoint, double, out ITopologyEdge, out ITopologyNode, out ITopologyEdge)

Adds a pseudo-node to the edge at the point on the edge closest to the input point. The node gets created at an existing vertex if one is located within the specified tolerance of the split point.

void SplitEdgeAtPoint(ITopologyEdge Edge, IPoint splitPoint, double tolerance, out ITopologyEdge from, out ITopologyNode mid, out ITopologyEdge to)

Parameters

Edge ITopologyEdge
splitPoint IPoint
tolerance double
from ITopologyEdge
mid ITopologyNode
to ITopologyEdge

SplitMoveNode(ITopologyNode, IPoint, bool)

Change graph connectivity: Moves the specified node, along with any selected edges incident on it. A copy of the node, along with unselected edges, remains in the original location.

void SplitMoveNode(ITopologyNode nodeToSplit, IPoint moveTo, bool proportionalStretch)

Parameters

nodeToSplit ITopologyNode
moveTo IPoint
proportionalStretch bool

TransformSelection(esriTransformDirection, ITransformation, bool)

Applies the specified transformation to the selected elements of the graph.

void TransformSelection(esriTransformDirection Direction, ITransformation transformation, bool proportionalStretch)

Parameters

Direction esriTransformDirection
transformation ITransformation
proportionalStretch bool