DotSpatial Library : MapWindow Discussion Forum
I'm using the DotSpatial .NET 4.0 implementation of the ShapeEditor... I can make a vector layer and draw some polygons, but I can't figure out how to turn off the drawing finger. Once I start drawing, I can't stop... even if I use the 'puzzle piece' to disable ShapeEditor.
ShapeEditor howto?
Posted by: davecove ()
Date: September 14, 2010 09:51PM

I'm using the DotSpatial .NET 4.0 implementation of the ShapeEditor...

I can make a vector layer and draw some polygons, but I can't figure out how to turn off the drawing finger. Once I start drawing, I can't stop... even if I use the 'puzzle piece' to disable ShapeEditor.

How about some regular polygons? Rectangles, ellipse, pie-wedge? Are those in the works somewhere?

Can I set the transparency of a shaded polygon I made with the ShapeEditor?

Thank you for your time,
Dave

Re: ShapeEditor howto?
Posted by: Shade1974 ()
Date: September 15, 2010 09:03AM

Try right clicking. I think ArcGIS works like this as well. You just right click and choose whether you are finishing a part or finishing the whole shape. That lets you do multipart stuff as well as simple polygons.

Yes, as to the other features, this area is woefully underdeveloped right now. I think even more important than adding rectangles or circles would be a feature that lets you "trace" existing shapes. Even in the very brief time I have had where I actually had to use ArcGIS for work, that functionality was very important for the work I was doing. So much time and energy has been going into the underlying core of the framework, that not as much time has been spent on things that depend on the framework, like more elegant drawing functions as well as more geoprocessing tools etc. Obviously we have a fair amount of work ahead of us.

If, however, you know what you want to do and are brave enough to take a look at the shape editor to see how it does its magic, it is not that hard to design a custom function that does whatever you want, and you can do it without reworking the framework itself. If your tool is good, and you and are willing to contribute some code to make our shape editor better, we are definitely willing to allow contributions. I'd recommend setting up a "Fork" so you can issue a pull request at some point and I can pull in your contributions.

Shade1974 (Ted)
Dr. Harold A Dunsford Jr.
MapWindow 6.0 & DotSpatial Initial Developer
GEI Consultants

Re: ShapeEditor howto?
Posted by: davecove ()
Date: September 15, 2010 01:04PM

I got the right-click thing, and that does allow you to finish off a shape or a part, but the pointer remains in draw mode... I can't get it to go back to select mode or measure mode.

Actually it is a bit more odd than that. After finishing a shape, you can select the measure tool, and the measure dialog will appear, and you can draw what appears to be a path of rubber-band lines and get a total distance, but you are actually still drawing a shape... the right click dialog is still available even in measure mode.

I am no ubercoder, but I think I up to the task of adding to shape editor... after a series of stupid questions while I get my bearings within the code. I'll make a fork as you suggest.

Didn't I see regular polygons and transparency somewhere in this project already? Where could I get a peek at how it was done before? Buried somewhere in the MW project?

Dave

Re: ShapeEditor howto?
Posted by: Shade1974 ()
Date: September 15, 2010 02:17PM

The bugs you are uncovering, I think, are new. I recently overhauled the way that the MapFunctions work in order to support a new kind of MapFunction which basically draws an icon that works like a button and sits on top of the map. But in getting everything to work correctly for that context I may have broken the ability for the shape editor to turn off correctly. It should turn off automatically if anything uses the same buttons (that is either the left or right mouse buttons). But it uses a [Flags] enum to control it, and it can be very easy to make a mistake there. I will post this as an issue, and check it out when I get a chance.

Shade1974 (Ted)
Dr. Harold A Dunsford Jr.
MapWindow 6.0 & DotSpatial Initial Developer
GEI Consultants

Re: ShapeEditor howto?
Posted by: davecove ()
Date: September 15, 2010 05:45PM

Another fun 'how do I'...

How do I save a shape layer created by ShapeEditor as a file so that I can admire my art later?

Didn't I see regular polygons and transparency somewhere in this project already? Where could I get a peek at how it was done before? Buried somewhere in the MW project?

Dave

Re: ShapeEditor howto?
Posted by: Shade1974 ()
Date: September 15, 2010 06:00PM

Either add this line at the very end of f_PolygonFinished:

result.SaveAs("filename", true);

Or else use a class level variable to store the FeatureSet instead of a local variable, and then when someone presses a button call the SaveAs method.

Shade1974 (Ted)
Dr. Harold A Dunsford Jr.
MapWindow 6.0 & DotSpatial Initial Developer
GEI Consultants

Re: ShapeEditor howto?
Posted by: davecove ()
Date: September 15, 2010 11:08PM

That went pretty well... it took me about 2 hours to figure out how to add a 'Save Layer to File' selection in the layer context menu (alongside 'Remove Layer' and 'Zoom to Layer') and then implement a SaveLayerToFile handler for it (complete with file selection dialog of course).

I can now save and reload the shape files that I make with ShapeEditor...

...happy happy joy joy...

(Now... back to figuring out how to draw regular polygons)

Dave

Sorry, you do not have permission to post/reply in this forum.





Banner Exchange




GISCP.com




Send us your banner logo (160x120) for the space above, and add this MapWindow banner ad to your site:

Just paste this text in your page: