How do you save and restore a view for a Map component?
To save the current state of the view, you can get the current visible rectangle of the map by calling getVisibleRectangle() on the map component's Scroller skin part:
visibleRect = map.scroller.getVisibleRectangle();
To restore the view to a previous state, you can get the map component's Scroller skin part then call fitRectangle(rectangle:Rectangle, animate:Boolean = false) with the visible rectangle that you've obtained from the above call:
Here is a sample that demonstrates the above technique:
The sample allows you to save the current state of the view then restore the view to its saved state after making some modifications to the view. The sample contains four buttons located at the top left corner of the map. The first two buttons are for zooming in and out of the map. The third button is for saving the current state of the map. The last button is for restoring the previous saved state of the map. Also note that to pan the map hold down the "Shift" key then click and drag the map.
|Business Integration||IBM ILOG Elixir||General||Linux, Mac OS X, Windows||3.0||All Editions|
Rate this page:
Copyright and trademark information
IBM, the IBM logo and ibm.com are trademarks of International Business Machines Corp., registered in many jurisdictions worldwide. Other product and service names might be trademarks of IBM or other companies. A current list of IBM trademarks is available on the Web at "Copyright and trademark information" at www.ibm.com/legal/copytrade.shtml.