ArcGIS Pro 3.7 API Reference Guide
ArcGIS.Core.Data.NetworkDiagrams Namespace / DiagramElementQueryByExtent Class / AddContents Property
Example

In This Topic
    AddContents Property (DiagramElementQueryByExtent)
    In This Topic
    Indicates whether or not the "searching" envelope must be enlarged to include the extent of any containers that are partially within the specified envelope. False to return the diagram features which strictly intersect the specified envelope(default). True to enlarge the "searching" envelope so it includes the extent of any containers that are partially within the specified envelope.
    Syntax
    Public Property AddContents As Boolean
    public bool AddContents {get; set;}
    Example
    Get Diagram Elements
    {
      // Get the diagram elements whose extent intersects the active map extent
      static void GetDiagramElements(MapView mapView, NetworkDiagram networkDiagram)
      {
        // Create a DiagramElementQueryByExtent to retrieve diagram element junctions whose extent
        // intersects the active map extent
    
        DiagramElementQueryByExtent elementQuery = new DiagramElementQueryByExtent();
        elementQuery.ExtentOfInterest = MapView.Active.Extent;
        elementQuery.AddContents = false;
        elementQuery.QueryDiagramJunctionElement = true;
        elementQuery.QueryDiagramEdgeElement = false;
        elementQuery.QueryDiagramContainerElement = false;
    
        // Use this DiagramElementQueryByExtent as an argument to the QueryDiagramElements method
        DiagramElementQueryResult result = networkDiagram.QueryDiagramElements(elementQuery);
    
        // Get the container, junction, edge elements. 
    
        IReadOnlyList<DiagramContainerElement> containerElements = result.DiagramContainerElements;
    
        // In this case result.DiagramJunctionElements and result.DiagramEdgeElements will be empty
        // because elementQuery.QueryDiagramEdgeElement and elementQuery.QueryDiagramContainerElement are set to 'false'
        IReadOnlyList<DiagramJunctionElement> junctionElements = result.DiagramJunctionElements;
    
        IReadOnlyList<DiagramEdgeElement> edgeElements = result.DiagramEdgeElements;
      }
    }
    Requirements

    Target Platforms: Windows 11 Home, Pro, Enterprise (64 bit)

    ArcGIS Pro version: 3.0 or higher.
    See Also