Freehand draw mode may not be working

2726
3
06-11-2013 12:48 PM
LuisGarcia2
Occasional Contributor II
I am using a Draw object to allow my clients to mark some graphics on a map. I set up the draw mode to work as DrawMode.Freehand. The idea is to allow the client to draw a freehand shape on tight spaces (clutter graphics) so they can select what they are interested in. Of course the result is an asymmetric polygon. Now, I have noticed that when I process the DrawComplete event I may not end up exactly with the graphics I had "lasso." It looks more like if the geometry was interpreted as a rectangle. Please, take a look at the pictures I am attaching and let me know if I need to do any other setting to process my event correctly. In the pictures you can see the difference between what I selected (with the freehand drawing) and what ended up selected (in green).
If there is an example of this somewhere, please, let me know.
Thanks!
0 Kudos
3 Replies
by Anonymous User
Not applicable
Original User: lgarcia3

I think I got my answer (partially at least) after using the debugger and seeing the DraxComplete event handler. from the line:
myDrawObject_DrawComplete(object sender, DrawEventArgs args)


The args object contains the geometry which in my case is a Polyline. When I see the polyline, it may have up to 500 lines that make the geometry. This geometry also has an extent which is what I am processing... and in that case, yes, the result is a rectangle/square kind of thing; not the exact shape I was hoping for. So, point being how can I convert this to a shape that I can process and find only the markers inside it so I can mark them.

Thanks!
0 Kudos
LuisGarcia2
Occasional Contributor II
I tried creating a Polygon out of the polyline created with the freehand draw. Still the extent is exactly the same as before. Here is the code:

               if (args.DrawMode == DrawMode.Freehand) {
                    
                    ESRI.ArcGIS.Client.Geometry.Polyline polyline = (ESRI.ArcGIS.Client.Geometry.Polyline)args.Geometry;
                    ESRI.ArcGIS.Client.Geometry.Polygon polygon = new ESRI.ArcGIS.Client.Geometry.Polygon();
                    polygon.Rings = polyline.Paths;
                    
                    ESRI.ArcGIS.Client.Geometry.Envelope envelope= polygon.Extent;
                    
               }


So, (please, correct me if I am wrong and there is a different way I don't know) that tells me that for this to work the way I intend it there has to be a different Envelope object that accepts polygons??

Thanks!
0 Kudos
by Anonymous User
Not applicable
Original User: lgarcia3

I found something HERE about buffer areas that look similar to what I want to do. Any one familiar with this buffer area? Anyone knows if this could help me solve my problem?
Thanks!
0 Kudos