I want a sort of dynamic style functionailities, so that features with the
same featureType can be rendered in different colors, and end-users can
change the color of a feature, but the change won't affect other features
with the same FeatureType.
I am trying to do this using attribute expression to link a feature's
attributes to its style. But I couldn't get it work. Geotools throw
NullPointerException. Attached my code in the following. Have anyone get
this work before? Could anyone help me to check what I did is wrong? BTW,
any other way to achieve the same goal?
org.geotools.filter.AttributeExpression colorExp = null;
org.geotools.filter.AttributeExpression strokeWidExp = null;
try{
colorExp = ff.createAttributeExpression(null,
SharedFeature.StrokeColor);
strokeWidExp = ff.createAttributeExpression(null,
SharedFeature.StrokeWidth);
}
catch (IllegalFilterException e) {
e.printStackTrace();
}
org.geotools.styling.Stroke stroke = sb.createStroke(colorExp,
strokeWidExp);
LineSymbolizer ls = sb.createLineSymbolizer(stroke);
thank you,
Dejin
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users