Click here to view all files
 
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.900 (2.0.0.900)

Syntax

C#
public CoordinateSystem CurrentCoordinateSystem { get; }
Visual Basic (Declaration)
Public ReadOnly Property CurrentCoordinateSystem As CoordinateSystem

Field Value

The current coordinate system used by the MapDisplay.

Remarks

The MapDisplay may use a different coordinate system to display the Map in 2D compared to 3D. You can use this property as a shortcut to determine the coordinate system of the current DisplayMode, as an alternative to using the separate CoordinateSystem2D or CoordinateSystem3D properties.

If MapItems in the Map have spatial data with a different CoordinateSystem to that of the MapDisplay, then the MapItems will be automatically reprojected into the CoordinateSystem of the display. Geographic transformations can be used to increase the accuracy of data reprojection; see the GeographicTransformation class for more information.

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#
// Identify the CoordinateSystem of the current DisplayMode using the shortcut property.
ESRI.ArcGISExplorer.Mapping.MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay;
CoordinateSystem dispCS = disp.CurrentCoordinateSystem;

// Iterate all Layers in the Map.
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)
{
  // Show information about the CoordinateSystem using the overloaded ToString method.
  string info = lyr.Name + ": " + lyr.CoordinateSystem.ToString();
  // Compare the systems using the Id property.
  if (lyr.CoordinateSystem.Id == dispCS.Id)
    sameCs.AppendLine(info);
  else
    diffCs.AppendLine(info);
}

// Show the results.
MessageBox.Show("Layers which are automatically reprojected: " + diffCs.ToString() + Environment.NewLine +
  "Layers which do not require reprojecting: " + sameCs.ToString(), "Layer Coordinate Systems");
CopyVB.NET
' Identify the CoordinateSystem of the current DisplayMode using the shortcut property.
Dim disp As ESRI.ArcGISExplorer.Mapping.MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay
Dim dispCS As CoordinateSystem = disp.CurrentCoordinateSystem

' Iterate all Layers in the Map.
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
  ' Show information about the CoordinateSystem using the overloaded ToString method.
  Dim info As String = lyr.Name & ": " & lyr.CoordinateSystem.ToString()
  ' Compare the systems using the Id property.
  If lyr.CoordinateSystem.Id = dispCS.Id Then
    sameCs.AppendLine(info)
  Else
    diffCs.AppendLine(info)
  End If
Next lyr

' Show the results.
MessageBox.Show("Layers which are automatically reprojected: " + diffCs.ToString() + Environment.NewLine + _
                "Layers which do not require reprojecting: " + sameCs.ToString(), _
                "Layer Coordinate Systems")

See Also

Relate Topics:
  Altitude Property
  AnimateMovement Property
  CoordinateSystem2D Property
  CoordinateSystem3D Property
  CurrentGeographicTransformations Property
  DisplayMode Property
  Extent Property
  GeographicTransformations2D Property
  GeographicTransformations3D Property
  Graphics Property
  IsNavigating Property
  IsStreaming Property
  IsTracking Property
  IsUpdating Property
  Map Property
  MapScale Property
  Observer Property
  Rotation Property
  Size Property
  Target Property
  TiltAngle Property
  ZoomLevel Property
Created by Atop CHM to web converter,© 2009 all right reserved.