This issue was imported from CodePlex
valentinedwv wrote 2010-09-08 at 17:40
For Hydrodesktop, What would cause a failure in MapPointLayer conversion.
"I created a theme based on search for air temperature in the area around Aberdeen, Scotland. Downloaded one data series. CLosed HD. Next day opened HD. Right clicked on Aberdeen theme and chose "Zoom to Layer". HD threw exception (but I was
able to continue. Tried again; threw same exception. Could continue using program.
Here are details::
See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.OverflowException: Value was either too large or too small for an Int32.
at System.Convert.ToInt32(Double value)
at DotSpatial.Map.MapPointLayer.DrawFeatures(MapArgs e, IEnumerable1 indices)
at DotSpatial.Map.MapPointLayer.DrawFeatures(MapArgs args, List
1 indices, List1 clipRectangles, Boolean useChunks)
at DotSpatial.Map.MapPointLayer.DrawRegions(MapArgs args, List
1 regions)
at DotSpatial.Map.MapGroup.DrawRegions(MapArgs args, List1 regions)
at DotSpatial.Map.MapFrame.Initialize(List
1 regions)
at DotSpatial.Map.MapFrame.Initialize()
at DotSpatial.Map.MapFrame.ResetBuffer()
at DotSpatial.Map.MapFrame.set_Extents(IEnvelope value)
at DotSpatial.Map.MapFrame.Layers_ZoomToLayer(Object sender, EnvelopeArgs e)
at System.EventHandler1.Invoke(Object sender, TEventArgs e)
at DotSpatial.Drawing.LayerEventList
1.OnZoomToLayer(Object sender, EnvelopeArgs e)
at DotSpatial.Drawing.LayerEventList1.Layer_ZoomToLayer(Object sender, EnvelopeArgs e)
at DotSpatial.Drawing.Layer.OnZoomToLayer(IEnvelope env)
at DotSpatial.Drawing.Group.Layers_ZoomToLayer(Object sender, EnvelopeArgs e)
at DotSpatial.Drawing.LayerEventList
1.OnZoomToLayer(Object sender, EnvelopeArgs e)
at DotSpatial.Drawing.LayerEventList`1.Layer_ZoomToLayer(Object sender, EnvelopeArgs e)
at DotSpatial.Drawing.Layer.OnZoomToLayer()
at DotSpatial.Drawing.Layer.ZoomToLayerClick(Object sender, EventArgs e)
at System.Windows.Forms.MenuItem.OnClick(EventArgs e)
at System.Windows.Forms.MenuItem.MenuItemData.Execute()
at System.Windows.Forms.Command.Invoke()
at System.Windows.Forms.Command.DispatchID(Int32 id)
at System.Windows.Forms.Control.WmCommand(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
valentinedwv wrote 2010-09-08 at 17:40
http://hydrodesktop.codeplex.com/workitem/7134
Shade1974 wrote 2010-09-08 at 19:19
Hmm. If you point layer has no points, zoom to layer might not work without an extent. If your layer has one point, then there is no really good way to know how close to zoom in, and maybe the zoom scale it picked didn't work for the conversion when it
came to converting the values to pixel coordinates. Can you export the specified data layer to a shapefile, zip those files and then attach it to this thread? That way I could try to track it down in code. Thanks.
mattgerg wrote 2010-09-11 at 00:26
When following the tutorial from the MapWindow6 page, I receive a NullReferenceException when the MapPointList tries to redraw itself during the .Invalidate() method.
http://mapwindow6.codeplex.com/wikipage?title=AddMarkersVB
This occurs during the first mouse click. So the FeatureSet has gone from zero points to one point, and then fails thereafter during the first redraw.
Here is the exception detail from Visual Studio:
System.NullReferenceException was unhandled
Message=Object reference not set to an instance of an object.
Source=DotSpatial.Desktop
StackTrace:
at DotSpatial.Maps.MapPointLayer.DrawFeatures(MapArgs e, IEnumerable`1 features) in C:\Dev\DotSpatial\Framework 4.0\DotSpatial.Desktop\Maps\Drawing\Vectors\MapPointLayer.cs:line 599
at DotSpatial.Maps.MapPointLayer.DrawFeatures(MapArgs args, List`1 features, List`1 clipRectangles, Boolean useChunks) in C:\Dev\DotSpatial\Framework 4.0\DotSpatial.Desktop\Maps\Drawing\Vectors\MapPointLayer.cs:line 200
at DotSpatial.Maps.MapPointLayer.DrawRegions(MapArgs args, List`1 regions) in C:\Dev\DotSpatial\Framework 4.0\DotSpatial.Desktop\Maps\Drawing\Vectors\MapPointLayer.cs:line 275
at DotSpatial.Maps.MapFrame.Initialize(List`1 regions) in C:\Dev\DotSpatial\Framework 4.0\DotSpatial.Desktop\Maps\Drawing\MapFrame.cs:line 399
at DotSpatial.Maps.MapFrame.Initialize() in C:\Dev\DotSpatial\Framework 4.0\DotSpatial.Desktop\Maps\Drawing\MapFrame.cs:line 446
at DotSpatial.Maps.MapFrame.Invalidate() in C:\Dev\DotSpatial\Framework 4.0\DotSpatial.Desktop\Maps\Drawing\MapFrame.cs:line 652
at WindowsApplication1.Form1.OnScrollWheelClick(Object sender, MouseEventArgs e) in C:\Users\________\documents\visual studio 2010\Projects\WindowsApplication1\WindowsApplication1\Form1.vb:line 58
at System.Windows.Forms.Control.OnMouseClick(MouseEventArgs e)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.UserControl.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at WindowsApplication1.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
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:
valentinedwv wrote 2010-10-02 at 08:06
tag hydrodesktop
jirikadlec2 wrote 2010-10-08 at 01:09
This issue occurs when the point layer has more than one point, but the [x, y] coordinates of all points are identical. For example, the layer represents a soil probe and each point represents a soil sample at a different depth.
jirikadlec2 wrote 2010-11-26 at 05:35
I believe these errors that result from a point layer with only one point have been resolved by adding an envelope around the point. This should no longer be an issue.
** Closed by jirikadlec2 11/25/2010 7:35PM
jirikadlec2 wrote 2011-02-24 at 03:39
This is still an issue in DotSpatial 65eacceecd6b (23 Feb 2011). Attached is a point shapefile ("letiste.shp") with one point. Add the attached shapefile to the map, right-click on the layer in the legend and select "Zoom to Layer".
The same OverflowException is thrown.
jirikadlec2 wrote 2011-03-09 at 06:48
Fixed in latest source code by adding an error check. If the layer extent is zero, zoom to 10% of current view extent instead of zooming to the layer extent.