AnsweredAssumed Answered

Setting AutoPanMode with Custom LocationDataSource Error

Question asked by mmorton75 on Aug 31, 2017
Latest reply on Sep 11, 2017 by GDeStigter-esristaff

Hello,

 

So we're using WPF Runtime 100.1 SDK.  We want to make use of the LocationDisplay on a map view to track locations on the map.  By default the datasource of the LocationDisplay is of type SystemLocationDataSource which works as expected.  SystemLocationDataSource inherits from LocationDataSource which is an abstract class.  Instead of using SystemLocationDataSource we have created our own custom class which inherits from LocationDataSource.  Upon setting a valid location, we want to change the AutoPanMode.   LocationDisplayAutoPanMode.Recenter and LocationDisplayAutoPanMode.Off works as expected.  However, setting auto pan mode to LocationDisplayAutoPanMode.Navigation results in the following error:

 

System.ArgumentException occurred
HResult=0x80070057
Message=Invalid argument: Target Extent is empty.
Source=Esri.ArcGISRuntime
StackTrace:
at Esri.ArcGISRuntime.ArcGISException.HandleCoreError(CoreError error, Boolean throwException)
at RuntimeCoreNet.GeneratedWrappers.Interop.CheckError(IntPtr errorHandle, Boolean throwOnFailure, GCHandle wrapperHandle)
at RuntimeCoreNet.GeneratedWrappers.CoreGeoView.GetCurrentViewpoint(CoreViewpointType viewpointType)
at Esri.ArcGISRuntime.UI.Controls.GeoView.GetCurrentViewpoint(ViewpointType viewpointType)
at Esri.ArcGISRuntime.UI.Controls.GeoView.<ArrangeViewOverlays>b__179_0()
at Esri.ArcGISRuntime.UI.Controls.GeoView.RunOnDispatcher(Action action)
at Esri.ArcGISRuntime.UI.Controls.GeoView.ArrangeViewOverlays()
at Esri.ArcGISRuntime.UI.Controls.GeoView.OnRaiseViewpointChanged()
at Esri.ArcGISRuntime.UI.Controls.MapView.OnRaiseViewpointChanged()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate
catchHandler)

 

I have tried this in a sample ESRI has provided on how to use the LocationDisplay property on a map view.  The only thing I changed was the datasource on the LocationDisplay from SystemLocationDataSource to our custom class derived from LocationDataSource.  Based on the error above, behind the scenes the LocationDisplay appears to be using the GetCurrentViewpoint method which is a method on the map view.  I have tried calling this method as the map view has changed going to the navigation auto pan mode.  I get the exact same error.  Are there any special conditions that need to be set on a derived LocationDataSource class?

 

Thank you

 

 

Mike

Outcomes