You need to log in before you can comment on or make changes to this bug.
For our customer we want to implement 2 new widgets, one to zoom to the previous extent, and one to zoom to the next extent. These widgets should provide easy navigation to switch between map extents in a map session. I want to use this bugreport to discuss the implementation and the name of the widgets. ZoomToPreviousExtent - should ideally be disabled when the map session starts. ZoomToNextExtent - should ideally be disabled if there is no next extent. The most logical place to implement this behaviour is IMHO map_session.php in common/wrapper. Maybe the savestate function can fill an extent value into an array member variable when the extent changes, and the map session can keep a pointer to the current index of this array. When a layer is removed from the map, this also results in a new map file saved into the session, but the extent is unchanged. So there should be some logic to see which extents are equal, in order to have them excluded from the array member variable. Any more thoughts?
I really like the conept of this type of widget, I have been wanting to implemtent something like this myself for a while. Here's my 2 cents: IMHO there is no need to change or add anything to the common/wrapper code because everything can be done inside the widget itself. I would suggest creating 2 widgets as well, but instead make an ExtentHistory widget and ExtentNav widget. The ExtentHistory widget is essentially a large session queue of map extents. It will monitor and record changes in map extent. It will also be smart enough to know if extent has changed by ExtentNav or by normal navigation. This will allow it to know when to begin overwrtting the queue, etc. The ExtentNav widget will simply navigate forward or backward in the queue. The ExtentNav widget can have a mode parameter to indicate forward or backward. One other thing to consider is map projection. This would have to be tracked in the extent history along with the extent.
Bart, I'm with Bill in not putting this capability into the wrappers, it doesn't really have a place there and will only end up bloating the map file, making it slower to load over time. I'd rather see the information stored in the session. I did some experimentation with an 'undo' and 'redo' capability for Studio that involved managing the keys returned by 'saveState()'. This actually worked fairly well but I never finished it due to time constraints. The capability worked by moving forward and backward through the map files saved in the session directory. This had the effect of zoom next/previous but also tracked changes such as layers getting deleted or added ... I mention this in case your requirements might include such a feature. If you are looking for just extents, then I would prefer a solution closer to Bill's suggestion, although I am not convinced about the names ... but they must be pretty good since I can't think of anything better ;) In fact, the way things have been going, I would say that there should be only one widget, the ExtentHistory widget. It would expose a javascript API with ZoomToPreviousExtent() and ZoomToNextExtent() functions and they can be called from Link widgets. So a basic implementation would be: <cwc2 type="ExtentHistory" /> <cwc2 type="Link" type="javascript" jsfunction="ZoomToPreviousExtent" ... /> <cwc2 type="Link" type="javascript" jsfunction="ZoomToNextExtent" ... />
Changed target to FUTURE.
Resolving this bug as this is the ExtentHistory widget in the standard Chameleon distro.