I am not sure; every GridCoverage layer has the same feature type; so if you
made that method accept a String and search through the style then you could
smoothly call it from both ....
(making up the following code example)
if( layer instanceof FeatureLayer ){
FeatureLayer featureLayer = (FeatureLayer) layer;
Style style = featureLayer.getStyle();
SimpleFeatureType schema = featureLayer.getFeatureSource().getFeatureType();
boolean active = isFeatureTypeStyleActive( schema.getTypeName() );
...
}
else if ( layer instanceof GridReaderLayer || layer instanceof
GridCoverageLayer){
Style style = ((StyleLayer) layer).getStyle();
boolean active = isFeatureTypeStyleActive( "GridCoverage", style );
...
}
Notes:
- using "GridCoverage" is something we made up (see
FetureUtilities.wrapGridCoverage)
- for Symbology encoding they tend to use something else ... (from the
interpolate function javadocs it looks like it is "RasterData" ).
So personally I would check for both as we get more and more SE based styles.
- I would probably add a method FeatureLayer.getFeatureType() to make life
easier. Remember these classes are driven by your needs when working on the
StreamingRenderer class. So anything we can do to make that code more readable
we should do.
- Example: If you really want you could add a StyleLayer.getTypeName() abstract
method in order to do your test above only using StyleLayer?
--
Jody Garnett
On Monday, 9 May 2011 at 6:13 PM, Michael Bedward wrote:
> Hi Jody,
>
> > Am I missing something?
>
> Yes but only because of my vaguely worded comment. I meant the call to
> the isFeatureTypeStyleActive method. That can validly apply to a
> GridCoverageLayer can't it ? That was why I thought "instanceof
> FeatureLayer" in my original patch was bad.
>
> Michael
>
------------------------------------------------------------------------------
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
Geotools-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-devel