Autodesk 15607-010000-5000A Manuale Utente

Pagina di 180
Managing the Autodesk MapGuide and Buzzsaw Interface
|
71
Retaining the Current Map State
Autodesk MapGuide and Buzzsaw Viewer integration is designed to ensure 
that your maps retain their most recent state when you leave them to access 
a document in Buzzsaw. 
Map state retention would help, for example, if you have spent a significant 
amount of time navigating the map, turning layers on and off, and zooming 
to display a particular feature on the map, such as a building or road. When 
you return to the map view from a Buzzsaw document, you want to see the 
same map view you left to access the document. Otherwise, you must recon-
struct the view you created before you accessed the Buzzsaw document. 
Autodesk MapGuide remembers both your map’s selection state and the last 
mode that you were in for a particular session. 
To ensure map state retention, three key categories of information must be 
saved during the process:
Area of the map that you are currently viewing
Current layer and group visibility
Currently selected map feature objects
For example, you may have displayed a series of layers in a drawing order that 
exposes a point layer containing hydrants on top of a land parcel layer. Then, 
you may have zoomed to fill your screen with a particular parcel and its 
hydrants. Now, you may want to access a Buzzsaw document containing 
location data about a selected hydrant. You need to be able to save the above 
three categories of information and return to the map in the state you left it 
in before accessing the Buzzsaw document.
To prevent map states from being lost, cookies that normally expire at the 
end of a session must be enabled, which permits the preceding three catego-
ries of information to be saved to the cookies. To save these three categories 
of map information, you must perform two tasks:
Serialize the map state and save the serialized map state in cookies.
Use the cookies to restore the map state the next time you open the page.
To save the map states in cookies
Use the onUnload event handler, which is the onUnload HTML BODY tag, 
to save the state of the map to cookies when you leave the Web page. The 
event handler calls a JavaScript function that creates the state cookies and 
allows the Autodesk MapGuide Viewer API to get the map state informa-
tion. 
Save the current map view by using the following APIs: