Re: [OpenMap Users] Analyzing LayerEvent events when a Layer is added to map.

From: Don Dietrick <dietrick_at_bbn.com>
Date: Tue, 21 Jun 2005 17:24:14 -0400

Hi Tom,

On Jun 21, 2005, at 12:22 PM, Lepkowski, Thomas M., CTR, OSD-PA&E wrote:

> Classification: UNCLASSIFIED
>
>
> Hello OpenMap group,
>
> Need some help understanding events that are fired when something
> happens to Layers.
>
> First, I implemented a new LayerListener() and made it print the
> event that happened.
> Here is some output:
>
> (this happened when a layer was added).
>
> Layer event: ALL (403)
> Layer event: REPLACE (402)
>
>
>
> <code>
>
> ...
>
> int event_type = e.getType();
>
> switch( event_type ) {
> case LayerEvent.ADD: System.out.println("Layer event: ADD" ); break;
> case LayerEvent.ALL: System.out.println("Layer event: ALL" ); break;
> case LayerEvent.REMOVE: System.out.println("Layer event:
> REMOVE" ); break;
> case LayerEvent.REPLACE: System.out.println("Layer event:
> REPLACE" ); break;
>
> }
> ...
>
> </code>
>
> QUESTIONS:
>
> 1) what does ALL mean. What's happening that 'ALL' indicates?
ALL provides the total set of layers available to the application.
ADD provides an initial set of layers currently added to the map.
REPLACE provides a subsequent set of layers on the map.
REMOVE isn't used.

> 2) When doing mapPanel().getMapHandler().add( MyLayer );
> This is printed:
> Layer event: ALL (403)
> Layer event: REPLACE (402)
> Layer event: ALL (403)
> Layer event: REPLACE (402)
>
> The sequence of events fired twice!.
>
> Any ideas on what's happening? I wonder if the Menus are causing
> the second firing.

Looks like your LayerListener has been added as a listener twice to
the LayerHandler. Menus don't fire these events. Only the
LayerHandler fires these events.

- Don

--
[To unsubscribe to this list send an email to "majdart_at_bbn.com"
with the following text in the BODY of the message "unsubscribe openmap-users"]
Received on Tue Jun 21 2005 - 17:24:58 EDT

This archive was generated by hypermail 2.3.0 : Tue Mar 28 2017 - 23:25:07 EDT