MGViewDistanceObserver.onViewedDistance   Go to object model Go to parent topic

Syntax

public abstract void onViewedDistance(MGMap map, double totalDistance, MGCollection distances, String units)

Description

The view distance observer event method. This event is fired when a user has finished viewing distances.

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

Note that the event is fired only if the distances were measured using the viewDistance method or the UI menu commands. If the distances were measured using the viewDistanceEx method, onViewedDistanceEx is fired instead.

Applies To

Plug-In and Java Edition only

Parameters

map - The MGMap object for which the event occurred.

totalDistance - The total distance viewed.

distances - An MGCollection object containing all the sub-distances.

units - The units used to quantify the distance.

Error Codes

-1 (busy)

Example

To handle this event from the Plug-In or Java Edition, a Java object that implements the MGViewDistanceObserver interface must be established with a call to the setViewDistanceObserver method. The observer Java object should include the following:

<class_definition> implements MGViewDistanceObserver
{
// ...
public void onViewedDistance(MGMap map,
 double totalDistance, 
 MGCollection distances, 
 String units)
{
<... 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

viewDistance