ThinkGeo.com    |     Documentation    |     Premium Support

EditOverlay - The parameter you supplied may not be null

Hi,


We are allowing our user to select and draw shapes, and holding these in an InMemoryFeatureLayer.


They can then go into Edit mode, which means we union all of the shapes they wanted, and copy this into the EditOverlay.EditShapesLayer, and call Create Control points. 


(so far I think this follows your sample code)


Now, we want the user to be able to move back into select and draw mode.. so we tried copying the shape back into the InMemoryFeatureLayer.


However now we get the following error after (a seemingly random number) of clicks on the map.  Strangely it only appears to happen if the user did not actually do anything (like move/rotate etc) while in edit mode.


We have checked IsValid() = true on all the Features involved.


 


Application Exception


The parameter you supplied may not be null.

Parameter name: wellKnownBinary  


at ThinkGeo.MapSuite.Core.x6d719af406ea4c2c.xddc71efc9badd3c7(Object xf85c38ac7d1447ea, String x34decc57f0820440)

   at ThinkGeo.MapSuite.Core.BaseShape.CreateShapeFromWellKnownData(Byte[] wellKnownBinary)

   at ThinkGeo.MapSuite.Core.Feature.GetShape()

   at ThinkGeo.MapSuite.DesktopEdition.EditInteractiveOverlay.DragFeatureCore(Feature sourceFeature, PointShape sourceControlPoint, PointShape targetControlPoint)

   at ThinkGeo.MapSuite.DesktopEdition.EditInteractiveOverlay.DragFeature(Feature sourceFeature, PointShape sourceControlPoint, PointShape targetControlPoint)

   at ThinkGeo.MapSuite.DesktopEdition.EditInteractiveOverlay.MouseMoveCore(InteractionArguments interactionArguments)

   at ThinkGeo.MapSuite.DesktopEdition.InteractiveOverlay.MouseMove(InteractionArguments interactionArguments)

   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xae767d6c6f6af1ca(InteractionArguments x195facd4ef5d753d)

   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.xfeca3317d3c75bbb(Object xd9272088e65bd176, x6a8380ab1a7ebb4c xc2fd4c0ed406cdb7)

   at ThinkGeo.MapSuite.DesktopEdition.x5cd462d41be2f68a.OnMouseEvent(x6a8380ab1a7ebb4c e)

   at ThinkGeo.MapSuite.DesktopEdition.x5cd462d41be2f68a.AnalyseMouseMove(Double screenX, Double screenY, Double worldX, Double worldY)

   at ThinkGeo.MapSuite.DesktopEdition.WinformsMap.x7df2db1d74504263(Object xd9272088e65bd176, MouseEventArgs xc2fd4c0ed406cdb7)

   at System.Windows.Forms.Control.OnMouseMove(MouseEventArgs e)

   at System.Windows.Forms.Control.WmMouseMove(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)


 


From this point on, the exception is thrown whenever the mouse moves over the map.


Can you help?


 


Kind Regards,


Gordon



Gordon,


Thanks for your post!
 
Try the following code to see whether it can solve your problem, I think we ignore some minor things in our HowDoI samples which will misguide users, this is exactly one of them.
 
The main change is adding only one line of Code in the try statement which is to recalculate the control points.
 

winformMap1.TrackOverlay.Lock.EnterWriteLock();
try
{
   foreach (Feature feature in winformMap1.EditOverlay.EditLayer.InternalFeatures)
   {
      winformMap1.TrackOverlay.TrackShapeLayer.InternalFeatures.Add(feature);
   }
}
finally
{
   winformMap1.TrackOverlay.Lock.ExitWriteLock();
}

winformMap1.EditOverlay.Lock.EnterWriteLock();
try
{
   winformMap1.EditOverlay.EditLayer.InternalFeatures.Clear();
   winformMap1.EditOverlay.CalculateAllControlPoints();
}
finally
{
   winformMap1.EditOverlay.Lock.ExitWriteLock();
}
winformMap1.Refresh();

 

Any more questions just let me know.
 
Thanks.
 
Yale


That appears to have fixed it, many thanks.



Gordon, 
  
 You are welcome! 
  
 Any more questions just let me know. 
  
  
 Thanks. 
  
 Yale