Hi everyone,

I am trying to build a style programmatically, and I would like the  
color of my line symbolizer to be retrieved from a feature attribute,  
like in the SLD sample below.
Do you know how to do this ?

<UserStyle>
        <FeatureTypeStyle>
                 <Rule>
                        <LineSymbolizer>
                                <Stroke>
                                        <CssParameter name=\"stroke\">
                                                
<PropertyName>color</PropertyName>
                                        </CssParameter>
                                        <CssParameter 
name=\"width\">1.0</CssParameter>
                                </Stroke>
                        </LineSymbolizer>
                </Rule>
        </FeatureTypeStyle>
</UserStyle>

Here is my code so far:

// Create the style
Style style = null;

// Create the style builder and the filter factory
StyleBuilder sb = new StyleBuilder();

// Creates the line symbolizer
LineSymbolizer symbolizer = sb.createLineSymbolizer(Color.decode(???));

// Creates a rule
Rule rule = sb.createRule(symbolizer);

// Creates a feature style
FeatureTypeStyle fts = sb.createFeatureTypeStyle(typeName, rule);

// Creates the style
style = sb.createStyle();

// Adds the feature style to the style
style.addFeatureTypeStyle(fts);

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
_______________________________________________
Geotools-gt2-users mailing list
Geotools-gt2-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to