ArcObjects Library Reference (GeoDatabase)  

ITopologyGraph.Build Method

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

[Visual Basic .NET]
Public Sub Build ( _
    ByVal Extent As IEnvelope, _
    ByVal preserveSelection As Boolean _
)
[C#]
public void Build (
    IEnvelope Extent,
    bool preserveSelection
);
[C++]
HRESULT Build(
  IEnvelope* Extent,
  VARIANT_BOOL preserveSelection
);
[C++]

Parameters

Extent

  Extent is a parameter of type IEnvelope

preserveSelection   preserveSelection is a parameter of type VARIANT_BOOL

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

Use the ITopologyGraph::Build method to construct the Topology Elements (TopologyNodes and TopologyEdges). Once "Build" is performed the Topology Elements are cached in memory and can be used. The elements have to be built before they can be used with other methods.

[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

See Also

ITopologyGraph Interface