MGAddMapLayerObserver.onAddMapLayer   Go to object model Go to parent topic

Syntax

public void onAddMapLayer(String URL, MGMapLayer layer)

Description

The layer-addition observer method. This event is fired when a new map layer has been added. It is initiated by a call to addMapLayer.

This topic describes this event for Plug-In and Java Edition only. For ActiveX Control, see onAddMapLayer.

Applies To

Plug-In and Java Edition only

Parameters

URL - A string that will contain the URL of the map layer file as passed to the addMapLayer method. This can be used to differentiate between multiple onAddMapLayer events if several layers are added to the map in succession.

layer - An MGMapLayer object for the new map layer. If unsuccessful, this parameter will be null.

Error Codes

none

Example

To handle this event from the Plug-In or Java Edition, a Java object that implements the MGAddMapLayerObserver interface must be passed to the addMapLayer method. The observer Java object should include the following:

<class_definition> implements MGAddMapLayerObserver
{
// ...
public void onAddMapLayer(String URL, MGMapLayer layer)
{
// event handling code here...
}
// ...
}

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.

See Also

addMapLayer