|
From: Greg E. <gr...@er...> - 2009-01-22 02:31:12
|
On Jan 21, 2009, at 6:27 PM, Greg Ederer wrote:
> Hi Michael,
>
> This does not quite work because the the compiler is unable to locate
> the newly defined method in the anonymous subclass. But, creating a
> named subclass of DefaultMapLayer with your dataChanged method does
> work.
>
> You have to override all of the constructors in DefaultMapLayer, since
> it has no public constructor, like so:
>
I meant 'has no public default constructor'.
Cheers,
Greg
> public class UpdatingMapLayer
> extends DefaultMapLayer
> {
> UpdatingMapLayer(AbstractGridCoverage2DReader reader, Style style)
> throws Exception
> {
> super(reader, style);
> }
>
> UpdatingMapLayer(AbstractGridCoverage2DReader reader, Style style,
> String title)
> throws Exception
> {
> super(reader, style, title);
> }
>
> UpdatingMapLayer(CollectionSource source, Style style, String title)
> {
> super(source, style, title);
> }
>
> UpdatingMapLayer(Collection collection, Style style)
> {
> super(collection, style);
> }
>
> UpdatingMapLayer(Collection collection, Style style, String title)
> {
> super(collection, style, title);
> }
>
> UpdatingMapLayer(FeatureCollection<SimpleFeatureType,
> SimpleFeature> collection, Style style)
> {
> super(collection, style);
> }
>
> UpdatingMapLayer(FeatureCollection<SimpleFeatureType,
> SimpleFeature> collection, Style style, String title)
> {
> super(collection, style, title);
> }
>
> UpdatingMapLayer(FeatureSource<SimpleFeatureType, SimpleFeature>
> featureSource, Style style)
> {
> super(featureSource, style);
> }
>
> UpdatingMapLayer(FeatureSource<SimpleFeatureType, SimpleFeature>
> featureSource, Style style, String title)
> {
> super(featureSource, style, title);
> }
>
> UpdatingMapLayer(GridCoverage coverage, Style style)
> throws Exception
> {
> super(coverage, style);
> }
>
> UpdatingMapLayer(GridCoverage coverage, Style style, String title)
> throws Exception
> {
> super(coverage, style, title);
> }
>
> public void dataChanged()
> {
> sourceListener.changed(null);
> }
> }
>
> Cheers,
>
> Greg
>
> On Jan 21, 2009, at 4:53 PM, Michael Bedward wrote:
>
>> Greg,
>>
>> Could you test this for me please ?
>>
>> // instead of myMapContext.addLayer( myGrid, myStyle ) do
>> this...
>> //
>> MapLayer myGridLayer = new DefaultMapLayer(myGrid, myStyle) {
>> public void dataChanged() {
>> sourceListener.changed(null);
>> }
>> };
>>
>> myMapContext.addLayer(myGridLayer);
>>
>> // later when you've changed the grid data
>> myGridLayer.dataChanged();
>>
>> Fingers crossed...
>>
>> Michael
>
>
> ------------------------------------------------------------------------------
> This SF.net email is sponsored by:
> SourcForge Community
> SourceForge wants to tell your story.
> http://p.sf.net/sfu/sf-spreadtheword
> _______________________________________________
> Geotools-gt2-users mailing list
> Geo...@li...
> https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users
|