Creates a new Envelope which is the geometrical union of a generic enumerable set of existing Envelopes.

Namespace:  ESRI.ArcGISExplorer.Geometry

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public static Envelope Union(
	IEnumerable<Envelope> envelopes
)
Visual Basic (Declaration)
Public Shared Function Union ( _
	envelopes As IEnumerable(Of Envelope) _
) As Envelope

Parameters

envelopes
Type: System.Collections.Generic..::.IEnumerable<(Of <(Envelope>)>)

A generic enumerable set of Envelopes.

Return Value

A new Envelope.

Remarks

A common use of the Union operation is to create an Envelope representing the extent of multiple notes.

Examples

The code below demonstrates how you can use the Union method to create a Viewpoint to look at multiple geometries. The code adds a note to represent each row in a spatial Table (the spatialTable variable), and uses the Union method create a Viewpoint based on the unioned Envelope of all the geometries. A Folder containing a Note representing each geometry in the Table is added, and the Folder Viewpoint is set from the unioned geometries.
CopyC#
// Ensure the spatialTable variable points to a valid spatial table.
RowCollection allRows = spatialTable.GetRows();

// Create a new Folder.
Folder newNoteFolder = new Folder();

// Collect the Extents of the geometries in the spatial table, and add a Note for each geometry 
// as a child of the Folder.
System.Collections.Generic.IList<Envelope> allNotesExtents = new System.Collections.Generic.List<Envelope>();
foreach (Row rw in allRows)
{
  Geometry newNoteGeom = rw.Geometry;
  allNotesExtents.Add(newNoteGeom.GetEnvelope());
  newNoteFolder.ChildItems.Add(new Note(rw.Values["FieldName"].ToString(),
          newNoteGeom));
}

// Union the extents.
Envelope extentUnion = GeometryOperations.Union(allNotesExtents);

// Set the viewpoint of the new Folder to the unioned extent, and add the Folder.
newNoteFolder.Viewpoint = new Viewpoint(extentUnion);
ESRI.ArcGISExplorer.Mapping.MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
disp.Map.ChildItems.Add(newNoteFolder);
CopyVB.NET
' Ensure the spatialTable variable points to a valid spatial table.
Dim allRows As RowCollection = spatialTable.GetRows()

' Create a new Folder.
Dim newNoteFolder As Folder = New Folder()

' Collect the Extents of the geometries in the spatial table, and add a Note for each geometry 
' as a child of the Folder.
Dim allNotesExtents As System.Collections.Generic.IList(Of Envelope) = New System.Collections.Generic.List(Of Envelope)()
For Each rw As Row In allRows
    Dim newNoteGeom As Geometry = rw.Geometry
    allNotesExtents.Add(newNoteGeom.GetEnvelope())
    newNoteFolder.ChildItems.Add(New Note(rw.Values("FieldName").ToString(), newNoteGeom))
Next rw

' Union the extents.
Dim extentUnion As Envelope = GeometryOperations.Union(allNotesExtents)

' Set the viewpoint of the new Folder to the unioned extent, and add the Folder.
newNoteFolder.Viewpoint = New Viewpoint(extentUnion)
Dim disp As MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
disp.Map.ChildItems.Add(newNoteFolder)

See Also