44
|
Chapter 3
Accessing Maps
There are some important points to remember about the busy state:
■
In general, most write methods and properties are affected by the busy
state and return a
-1 (busy)
error code when called during a busy state.
Most read methods and properties are not affected by the busy state. How-
ever, there are exceptions to both of these rules. The best way to learn
which methods and properties do not work during the busy state is to
view the method/property descriptions in the
Autodesk MapGuide Viewer
API Help
.
■
When your Autodesk MapGuide Viewer application calls an API method
that causes a busy state, Autodesk MapGuide Viewer can return control to
the application and then go to the next method while still in the busy state.
To avoid errors, you need to make sure that Autodesk MapGuide Viewer is
not in a busy state when your application calls one of the methods that are
affected by the busy state.
Your application is most likely to fail when it is about to call two or more API
methods—the first an API method that automatically invokes a refresh, and
subsequent ones methods that don’t work during the busy state. For example:
function selectAndZoomToPointObject(mgObj)
{
var map = getMap();
var sel = map.getSelection();
sel.clear();
sel.addObject(mgObj);
map.zoomSelected();
// Busy state begins in zoomSelected()
map.setWidth(5, "KM"); // Error occurs because setWidth() fails
// if called during the busy state
}
To avoid errors, you need to make sure that Autodesk MapGuide Viewer is
not in a busy state when your application calls one of these methods. To do
this you can:
■
Control map refresh using the
autoRefresh
flag
■
Detect when a map refresh is about to happen
■
Detect a change in the busy state
Each of these approaches is described in the following sections.
Summary of Contents for 15606-011408-9300 - MAP R6.3 UPG
Page 1: ...15306 010000 5060 October 2001 Autodesk MapGuide Release 6 Developer s Guide ...
Page 6: ...vi ...
Page 16: ...16 ...
Page 30: ...30 ...
Page 84: ...84 ...
Page 134: ...134 ...
Page 202: ...202 ...