Cool; let me look for a moment:

public void setStyle(Style style) {
this.style = style;
}

Yep; no event in sight! My understanding is we should add the following:

fireMapLayerListenerLayerChanged( MapLayerEvent.STYLE_CHANGED )

(the method is nice and efficient and only bothers to do something if there is 
somebody listening) 

Aside; I went looking for docs and did not find any; thus you have the 
following notes* I have just added to the user guide:

- http://docs.geotools.org/latest/userguide/library/render/map.html

-- 
Jody Garnett
* notes in this case means I missed something; and had to go make diagrams and 
stuff

On Wednesday, 4 May 2011 at 11:32 PM, Michael Bedward wrote: 
> Thanks jody, that gets me further.
> 
> Now comes the tricky bit. The current SelectionLab example implicitly
> relies on the do-everything nature of JMapPane.paintComponent.
> 
> In my local "improved" JMapPane the paintComponent method's only job
> is to blit the backing image to the pane. The actual map drawing has
> been moved into a separate method and the map pane relies on events
> from its MapContext to know when that needs updating.
> 
> For this to work I need FeatureLayer.setStyle to publish an event.
> 
> Michael
> 
> PS. Perhaps I should commit the GEOT-3560 changes to trunk so we are
> both looking at the same code ?
> 
> On 4 May 2011 22:23, Jody Garnett <[email protected]> wrote:
> > Reading ...
> > 
> > I'm trying to work out whether updating the example will make it work
> > with the changed JMapPane code, but I'm a bit lost in the new Layer
> > code.
> > 
> > Okay - my goal was to make it exactly the same (but this time with a set
> > class for each kind of layer - rather than a bunch of magic methods).
> > 
> > In the example, the style of the single layer is updated when a new feature
> > selection is made:
> > 
> > mapFrame.getMapContext().getLayer(0).setStyle(style);
> > mapFrame.getMapPane().repaint();
> > 
> > Okay.
> > 
> > I see that getLayer returns a deprecated DefaultMapLayer object.
> > However, I can't update the example to use the new MapContent.layers()
> > method because there doesn't seem to be a setStyle method (?)
> > 
> > Interesting; I would expect you are working with a FeatureLayer (so
> > something like the following).
> > MapContent content = mapFrame.getMapContext();
> > if( content.layers().get(0) instanceof FeatureLayer ){
> > FeatureLayer selectionLayer = (FeatureLayer) content.layers().get(0);
> > selectLayer.setStyle( style );
> > }
> > Jody
> 
------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
Geotools-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to