ArcGIS Explorer Component Help |
MapDisplay..::.CurrentGeographicTransformations Property |
MapDisplay Class Example See Also |
Assembly: ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)
Syntax
C# |
---|
public GeographicTransformationCollection CurrentGeographicTransformations { get; } |
Visual Basic (Declaration) |
---|
Public ReadOnly Property CurrentGeographicTransformations As GeographicTransformationCollection |
Field Value
The current set of GeographicTransformations used by the MapDisplay.Remarks
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; transformations added to this collection will be used where appropriate in data reprojection for the current DisplayMode. Refer to the GeographicTransformation and GeographicTransformationCollection classes for more information about using transformations.
The MapDisplay may use a different coordinate system to display the Map in 2D compared to 3D, and therefore a separate set of transformations is available for each DisplayMode. You can use this property as a shortcut to determine the current set of transformations in use for the current DisplayMode, as an alternative to using the separate GeographicTransformations2D or GeographicTransformations3D properties.
Examples
// Get the current CoordinateSystem of the display (for 3D this is always WGS 1984). ESRI.ArcGISExplorer.Mapping.MapDisplay disp = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay; CoordinateSystem csDisp = disp.CurrentCoordinateSystem; // Get the coordinate system of the layer. CoordinateSystem csLayer = newLayer.CoordinateSystem; // Find out if a transformation is already available between the CoordinateSystem of the new data and the // CoordinateSystem of the 2D display. GeographicTransformationCollection transforms = disp.CurrentGeographicTransformations; GeographicTransformation existingTransform = transforms.FindCurrentTransform(csDisp, csLayer); if (existingTransform == null) { // No current transformation specified, so get suitable transformations between the two coordinate systems. System.Collections.Generic.IList<GeographicTransformation> suitableTrans = GeographicTransformation.GetTransformations(csDisp, csLayer); if (suitableTrans.Count > 0) { // Choose a transformation to use. The code below is hardcoded to use the first // transformation found, but there may be more than one suitable transformation. transforms.Add(suitableTrans[0]); MessageBox.Show("Added the transformation " + suitableTrans[0].Name + Environment.NewLine + " between " + csLayer.Name + " and " + csDisp.Name, "Using New GeographicTransformation", MessageBoxButtons.OK, MessageBoxIcon.Information); // Alternatively, inform the user of the suitable transformations and let them choose. } else { // If no transformations are returned, there may be no transformation // required between the systems - they may have the same underlying geographic CS. MessageBox.Show("No GeographicTransformations found between " + csLayer.Name + " and " + csDisp.Name, "No Suitable GeographicTransformations", MessageBoxButtons.OK, MessageBoxIcon.Information); } } else { MessageBox.Show("Already using the transformation " + existingTransform.Name + Environment.NewLine + " between " + csLayer.Name + " and " + csDisp.Name, "Existing GeographicTransformation", MessageBoxButtons.OK, MessageBoxIcon.Information); }
' Get the current CoordinateSystem of the display (for 3D this is always WGS 1984). Dim disp As ESRI.ArcGISExplorer.Mapping.MapDisplay = ESRI.ArcGISExplorer.Application.Application.ActiveMapDisplay Dim csDisp As CoordinateSystem = disp.CurrentCoordinateSystem ' Get the coordinate system of the layer. Dim csLayer As CoordinateSystem = newLayer.CoordinateSystem ' Find out if a transformation is already available between the CoordinateSystem of the new data and the 'CoordinateSystem of the 2D display. Dim transforms As GeographicTransformationCollection = disp.CurrentGeographicTransformations Dim existingTransform As GeographicTransformation = transforms.FindCurrentTransform(csDisp, csLayer) If existingTransform Is Nothing Then ' No current transformation specified, so get suitable transformations between the two coordinate systems. Dim suitableTrans As System.Collections.Generic.IList(Of GeographicTransformation) = GeographicTransformation.GetTransformations(csDisp, csLayer) If suitableTrans.Count > 0 Then ' Choose a transformation to use. The code below is hardcoded to use the first ' transformation found, but there may be more than one suitable transformation. transforms.Add(suitableTrans(0)) MessageBox.Show("Added the transformation " & suitableTrans(0).Name & Environment.NewLine & _ " between " & csLayer.Name & " and " & csDisp.Name, "Using New GeographicTransformation", MessageBoxButtons.OK, MessageBoxIcon.Information) ' Alternatively, inform the user of the suitable transformations and let them choose. Else ' If no transformations are returned, there may be no transformation ' required between the systems - they may have the same underlying geographic CS. MessageBox.Show("No GeographicTransformations found between " & csLayer.Name & " and " & csDisp.Name, _ "No Suitable GeographicTransformations", MessageBoxButtons.OK, MessageBoxIcon.Information) End If Else MessageBox.Show("Already using the transformation " & existingTransform.Name & Environment.NewLine & _ " between " & csLayer.Name & " and " & csDisp.Name, _ "Existing GeographicTransformation", MessageBoxButtons.OK, MessageBoxIcon.Information) End If