Gets the current CoordinateSystem of the MapDisplay; this is a shortcut to either the CoordinateSystem2D or
CoordinateSystem3D property, depending on the current DisplayMode.
Namespace:
ESRI.ArcGISExplorer.Mapping
Assembly:
ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
Visual Basic (Declaration) |
---|
Public ReadOnly Property CurrentCoordinateSystem As CoordinateSystem |
Field Value
The current coordinate system used by the MapDisplay.
Remarks
Examples
The code below shows how you can identify any layers in the current MapDisplay with a CoordinateSystem
that is different to that of the MapDisplay. A list of all Layers is created, showing which use the same
CoordinateSystem as the MapDisplay, and which use a different CoordinateSystem (and are therefore
reprojected automatically when drawn), and creates a list of these layers.
The code assumes you have imported the Geometry and Mapping namespaces.
CopyC#
ESRI.ArcGISExplorer.Mapping.MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
CoordinateSystem dispCS = disp.CurrentCoordinateSystem;
StringBuilder sameCs = new StringBuilder(Environment.NewLine);
StringBuilder diffCs = new StringBuilder(Environment.NewLine);
System.Collections.ObjectModel.ReadOnlyCollection<Layer> layers = disp.Map.GetMapItems<Layer>();
foreach (Layer lyr in layers)
{
string info = lyr.Name + ": " + lyr.CoordinateSystem.ToString();
if (lyr.CoordinateSystem.Id == dispCS.Id)
sameCs.AppendLine(info);
else
diffCs.AppendLine(info);
}
MessageBox.Show("Layers which are automatically reprojected: " + diffCs.ToString() + Environment.NewLine +
"Layers which do not require reprojecting: " + sameCs.ToString(), "Layer Coordinate Systems");
CopyVB.NET
Dim disp As ESRI.ArcGISExplorer.Mapping.MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
Dim dispCS As CoordinateSystem = disp.CurrentCoordinateSystem
Dim sameCs As New StringBuilder(Environment.NewLine)
Dim diffCs As New StringBuilder(Environment.NewLine)
Dim layers As System.Collections.ObjectModel.ReadOnlyCollection(Of Layer) = disp.Map.GetMapItems(Of Layer)()
Dim lyr As Layer
For Each lyr In layers
Dim info As String = lyr.Name & ": " & lyr.CoordinateSystem.ToString()
If lyr.CoordinateSystem.Id = dispCS.Id Then
sameCs.AppendLine(info)
Else
diffCs.AppendLine(info)
End If
Next lyr
MessageBox.Show("Layers which are automatically reprojected: " + diffCs.ToString() + Environment.NewLine + _
"Layers which do not require reprojecting: " + sameCs.ToString(), _
"Layer Coordinate Systems")
See Also