Hi,
I am getting following exception when trying to add GraticuleAdornmentLayer with WrapDateline mode.
Am I doing something wrong?
Thanks,<br/ >
Vicky
private void wpfMap1_Loaded(object sender, RoutedEventArgs e)
{
wpfMap1.MapUnit = GeographyUnit.Meter;
string sMapShapeFileName = AppDomain.CurrentDomain.BaseDirectory + @"Resources\map\world.shp";
string sMapShapeIndexFileName = AppDomain.CurrentDomain.BaseDirectory + @"Resources\map\world.idx";
ShapeFileFeatureLayer worldLayer = new ShapeFileFeatureLayer(sMapShapeFileName, sMapShapeIndexFileName);
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultAreaStyle = AreaStyles.Country1;
worldLayer.ZoomLevelSet.ZoomLevel01.DefaultLineStyle = LineStyles.InternationalBorder1;
worldLayer.ZoomLevelSet.ZoomLevel01.ApplyUntilZoomLevel = ApplyUntilZoomLevel.Level20;
Proj4Projection proj4 = new Proj4Projection();
proj4.InternalProjectionParametersString = Proj4Projection.GetEpsgParametersString(4326);
proj4.ExternalProjectionParametersString = Proj4Projection.GetGoogleMapParametersString();
worldLayer.FeatureSource.Projection = proj4;
worldLayer.Open();
wpfMap1.CurrentExtent = worldLayer.GetBoundingBox();
worldLayer.Close();
LayerOverlay staticOverlay = new LayerOverlay();
staticOverlay.TileType = TileType.SingleTile;
staticOverlay.Layers.Add(new BackgroundLayer(new GeoSolidBrush(GeoColor.GeographicColors.ShallowOcean)));
staticOverlay.Layers.Add("WorldLayer", worldLayer);
staticOverlay.WrappingMode = WrappingMode.WrapDateline;
wpfMap1.Overlays.Add(staticOverlay);
GraticuleAdornmentLayer graticuleAdornmentLayer = new GraticuleAdornmentLayer();
graticuleAdornmentLayer.GraticuleLineStyle = LineStyles.DegreeLine1;
graticuleAdornmentLayer.WrappingMode = WrappingMode.WrapDateline;
graticuleAdornmentLayer.Projection = proj4;
wpfMap1.AdornmentOverlay.Layers.Add("graticule", graticuleAdornmentLayer);
wpfMap1.Refresh();
}
Exception:
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=WpfDesktopEdition
StackTrace:
at ThinkGeo.MapSuite.WpfDesktopEdition.Tile.<>c__DisplayClass2.<DrawException>b__0()
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.DispatcherOperation.InvokeImpl()
at System.Windows.Threading.DispatcherOperation.InvokeInSecurityContext(Object state)
at System.Threading.ExecutionContext.runTryCode(Object userData)
at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Windows.Threading.DispatcherOperation.Invoke()
at System.Windows.Threading.Dispatcher.ProcessQueue()
at System.Windows.Threading.Dispatcher.WndProcHook(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndWrapper.WndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam, Boolean& handled)
at MS.Win32.HwndSubclass.DispatcherCallbackOperation(Object o)
at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
at System.Windows.Threading.Dispatcher.InvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
at MS.Win32.UnsafeNativeMethods.DispatchMessage(MSG& msg)
at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
at System.Windows.Application.RunDispatcher(Object ignore)
at System.Windows.Application.RunInternal(Window window)
at System.Windows.Application.Run(Window window)
at System.Windows.Application.Run()
at TestShapeFile.App.Main() in C:\_Development\VS2010\Apps\TestMapSuiteWPF\TestShapeFile\obj\x86\Debug\App.g.cs:line 0
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException: