| MGMapLoadedObserver.onMapLoaded |
|
public abstract void onMapLoaded(MGMap map)
The map loaded observer event method. This event is fired when Autodesk MapGuide loads an MWF into the Autodesk MapGuide Viewer, before the first refresh.
This topic describes this event for Plug-In and Java Edition only. For ActiveX Control, see onMapLoaded.
A typical use of onMapLoaded is to set certain MWF properties, such as a SQL where clause, based on external variables, for example, the user name. If you want to change settings every time the map is about to be refreshed, use the onViewChanging event instead.
Note that Autodesk MapGuide disables the autoRefresh flag, set by setAutoRefresh, when it executes the onMapLoaded event. Therefore, calling zoomGotoDlg, zoomGotoLocation, setUrl, or refresh in onMapLoaded has no effect. Additionally, setAutoRefresh has no effect when called from onMapLoaded.
Plug-In and Java Edition only
map - The MGMap map object that this event applies to.
none
To handle this event, a Java object that implements the MGMapLoadedObserver interface must be established with a call to the setMapLoadedObserver method. The observer Java object should include the following:
<class_definition> implements MGMapLoadedObserver
{
// ...
public void onMapLoaded(MGMap map)
{
// event Handling code here, for example:
var mapLayer = map.getMapLayer("ODBCPointLayer");
maplayer.setSQLWhere("Name = " + userName);
}
// ...
}
The simplest way to include the observer object in a Web page is to implement it as an applet. See Advanced Examples for a fully functional observer object that supports all of the observer interfaces by forwarding the events back to JavaScript functions that have identical semantics to the ActiveX Control event handlers.