Deactivate toolbar functions

Nov 8, 2010 at 2:13 PM

I notice that a SpatialToolStrip button doesn't attempt to deactivate the functions of ShapeEditor.  That is, then you click a function on the SpatialToolStrip, part of ActivateMapFunction steps thru all the MapFunctions and calls Deactivate on each one that is not marked as 'always on'. However the members of MapFunctions in foreach (MapFunction f in MapFunctions) does not contain the functions from ShapeEditor and so those do not get Deactivate called on them.

How can I get to the function collection of the ShapeEditor so that I can step thru them in a similar manner? (ie foreach (MapFunction f in ShapeEditor_MapFunctions))

Thank you,

Dave

Developer
Nov 8, 2010 at 3:30 PM
Hey Dave, thanks for getting involved. Are you observing this as a behavior problem, as in, you are actively editing a shape, then switch to pan mode, and the shape continues to draw? If so I will add it as an issue. There is no separate tracking for shape editor MapFunctions. If you look at the code for cycling through MapFunctions on the MouseMove handler in the map, you will see that it only checks the maps list of MapFunctions, and there is no alternate list. At some point, either when you activate the app or else when you start using a map function, the specialized map function is added to the map's list of MapFunctions. That way, any deactivate calls that get called to the Map's list are being applied to the shape editor functions as well. A "MapFunction" does nothing unless it is in that list. That being said, there are always situations where I might have overlooked some combination of button pressing that breaks things, so if you see it not behaving correctly we will add an issue. Thanks.

Ted


On Mon, Nov 8, 2010 at 7:13 AM, davecove <notifications@codeplex.com> wrote:

From: davecove

I notice that a SpatialToolStrip button doesn't attempt to deactivate the functions of ShapeEditor. That is, then you click a function on the SpatialToolStrip, part of ActivateMapFunction steps thru all the MapFunctions and calls Deactivate on each one that is not marked as 'always on'. However the members of MapFunctions in foreach (MapFunction f in MapFunctions) does not contain the functions from ShapeEditor and so those do not get Deactivate called on them.

How can I get to the function collection of the ShapeEditor so that I can step thru them in a similar manner? (ie foreach (MapFunction f in ShapeEditor_MapFunctions))

Thank you,

Dave

Read the full discussion online.

To add a post to this discussion, reply to this email (DotSpatial@discussions.codeplex.com)

To start a new discussion for this project, email DotSpatial@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe or change your settings on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com


Nov 8, 2010 at 3:44 PM

I am actually trying to switch between Move Vertex and the Select function. When I click on the Select tool, Deactivate is not called on Move Vertex, so it stays active... you wind up in a Select/Vertex hybrid with both getting MouseMove events.  But I am sure that pretty much any combination of a Shape tool followed by a Map tool would have the same issue... the MapFunction list available to the SpatialToolStrip simple does not have any of the ShapeEditor functions in it so they miss out on the foreach - deactivate

I'll look at the MapFunctions in MouseMove and see if it is different than the MapFunctions in SpatialToolStrip, it would almost have to be since MouseMove can 'see' the functions from ShapeEditor.
It is as if ShapeEditor is adding items to SpatialToolStrip without adding anything to MapFunctions...
Dave