How to track event when datum transformation changes

71
1
10-04-2018 02:19 AM
Highlighted
New Contributor II

Is there a event in ArcGIS Pro SDK for .NET (C#) which occurs whenever a datum transformation is changed?#

Reply
0 Kudos
1 Reply
Highlighted
Esri Regular Contributor

Hi

You can use the MapPropertyChangedEvent.  When you change the datum transformation on a map, this event is fired. You can subscribe to this event in your module class. Below is a code snippet that subscribes to the event, and an event handler that is called when it triggers. In the event handler, we check the Map Definition's DatumTransforms or HVDatumTransforms property to get the changed value.  

Note: Store the current (previous) values for the Datum also in the module class to compare with the changed value you get from the event handler.

Thanks

Uma

protected override bool Initialize(){
      MapPropertyChangedEvent.Subscribe(OnMapPropertyChanged);
      return base.Initialize();
}

private void OnMapPropertyChanged(MapPropertyChangedEventArgs obj){
       if (obj.EventHints.Any())
          {
            if (MapView.Active.Map is null)
                 return;
             var cimMapDefinition = MapView.Active.Map.GetDefinition();

             var datumTransformations = cimMapDefinition.DatumTransforms; // use if map's sr does not have a vertical coordinate system
             var hvDatumTransformations = cimMapDefinition.HVDatumTransforms;    // use if map's sr has a vertical coordinate system

            }
}‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍
Reply
0 Kudos