I have a polygon symoblizer and I wanted to change values in a given
layer. What happens is I load a shapefile, add the data to the map
context, and then display this.
Later, I want to update information based on the ID of a feature. So
what I want to do is update the symbolizer so that only the feature with
the changed value will display. I want to filter the change based on
feature id because the values are not associated with the feature data
directly, but rather the feature is an attribute of another object. So
feature id is a convenient way to refer to the feature that I want to
display the changes. Anyway, I am not quite sure how to do this, as my
attempts so far cause the entire layer to change the value (i.e. based
on fillValue below). I want only the specific feature with the proper id
to change its opacity value and not all the features in the layer, as it
does currently.
Thanks for the help in advance.
Anyway, here is the code I have for updating a style value:
private void tryThis(Style style,FeatureTypeStyle fts, Feature
f, double fillValue, Color c,String name) throws
IllegalFilterException{
StyleBuilder sb = new StyleBuilder();
FilterFactoryImpl ff = new FilterFactoryImpl();
PolygonSymbolizer ps = sb.createPolygonSymbolizer(c,
Color.BLACK, 2.0);
ps.getFill().setOpacity(sb.literalExpression(fillValue));
Rule r = sb.createRule(new Symbolizer[] {ps });
FidFilter cf=ff.createFidFilter();
cf.addFid(f.getID());
r.setFilter(cf);
FeatureTypeStyleImpl fti =
(FeatureTypeStyleImpl)((FeatureTypeStyleImpl)fts).clone();
fti.addRule(r);
style.addFeatureTypeStyle(fti);
}
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users