2 points:
1. The COntextModel should not be accessed, it is a historical artifact at this point. I would look at the map's MapComposition listeners if you want events when the map changes 2. You might consider adding a LayerInterceptor. They are called when layers are added to a map to configure the layer for addition. I think there may be ones for deletion as well. Jesse On Wed, Jan 18, 2012 at 7:22 AM, Elvie DSouza <[email protected]> wrote: > Hi, > > Our application needs a functionallity where we can sync 2 maps i.e. if we > zoom/pan on one, it should be reflected on the other. I am able to achieve > this however, I am not able to sync the maps when a new layer is added. For > testing purpose, I have written "ContextModelListenerAdapter" which listen > to the context changes on one of the map (mainmap) . If I add the new layer > in the layerAdded() function, it adds it to the second map(map2) & is not > added to the mainmap, code snippet is :- > > contextListener = new ContextModelListenerAdapter() { > protected void layerAdded(Notification msg) { > Layer layerAdded = (Layer) msg.getNewValue(); > map2.sendCommandASync(new AddLayerCommand(layerAdded)); > } > > .... > mainmap.getContextModel().eAdapters().add(contextListener); > Please help... > > Thanks > Elvie > > _______________________________________________ > User-friendly Desktop Internet GIS (uDig) > http://udig.refractions.net > http://lists.refractions.net/mailman/listinfo/udig-devel > >
_______________________________________________ User-friendly Desktop Internet GIS (uDig) http://udig.refractions.net http://lists.refractions.net/mailman/listinfo/udig-devel
