ThinkGeo.com    |     Documentation    |     Premium Support

Draggable map shapes

I am using a combination of the EditOverlay (for drawing) and a layer called MapShapeLayer that is modeled off the MapShapes sample project. When the user finishes drawing a shape and the TrackOverlay_TrackEnded event is called, I add the shape to the MapShapeLayer.MapShapes collection.


In order to allow the end-user to drag, rotate or resize the MapShape objects, I added the features to the EditOverlay.EditShapesLayer.InternalFeatures collection, but the map started throwing GDI errors (you know, the ones with the red X through the map). What's the best way for me to allow edits on features that I have stored in the MapShapeLayer?


Thanks!



Well, I solved the red X problem but I am not getting the behavior I’d like. Copying the MapShape features into the EditOverlay makes a copy of the feature, so the user is editing the feature that is copied into the EditOverlay. What’s the best way for me to allow the user to edit shapes that are stored in the MapShapeLayer?

Bump! 
  
 I’m really looking forward to your feedback to figure out how to best integrate mapshapes with the EditLayer. This will help me preserve the functionality I had in Desktop edition 2.0… 
  
 Thanks!

Greg, 
  
   Things have been busy around here as next Monday is the big release day for most of our products going to full production.  I apologize that there way no response until now.   
  
   I think I understand what you want to do.  The thing that first comes to my mind is that when you want to edit a map shape you need to make a copy and copy it into the edit interactive overlay for editing.  You could on the map shapes side remoe it temporarly or set it to IsActive or IsVisible false to stop drawing that map shape.  When the editing is finished then you would move it back down to the Map Shape and replace just the feature. 
  
   If on the other hand what you are trying to do is to keep the same look and feel of the map shape and edit that in place then I think there is not a direct way to do that.  Map Shapes are just a concept and really not integrated into the editing system.  Editing is its own system at the moment and you need to do the glue work to move things back and forth between the display and editing systems. 
  
 Having said all of that let me think about this a little and see if there would be some slick way to move the things in between them without allot of work. 
  
 David

David, your initial assessment is correct! As you’ve said, I can set the IsVisible flag of the selected mapshape object to false and then copy the object’s feature into the edit interactive overlay. When the user is done editing I can then copy the feature from the edit interactive overlay back into the mapshape object. Sounds pretty easy! I’ll let you know how well it works… 
  
 Thanks! 
  
 Greg

Greg, 
  
   Hope ti works for you.  I just wish there was a better way to edit in place however we have not thought of a better way yet.  The issue is that there are so many ways to edit and so many kinds of layer and data where shapes can come from.  We will in the future try and think up some better ways to ease the process of moving features around between overlays. 
  
 Looking forward to see you get it working. 
  
 David

Sorry I didn’t follow up on this sooner. I followed the suggestion for copying features from the MapShape collection into the EditLayer and it works extremely well! Thanks for the suggestion.

Greg, 
  
   Good to hear that works!  Let me know if you have any other issues. 
  
 David