Adding the event to FeatureLayer.setStyle seems to allow the
SelectionLab app to work with the new JMapPane code:
http://jira.codehaus.org/browse/GEOT-3562

Michael

On 4 May 2011 23:32, Michael Bedward <[email protected]> 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