Hello I just wanted to point out that whenever I select a feature the
selected style is rendered but whenever i select another feature the style
of the "selected_before" returns to unselected but the text symbolizer
stays: (I am using geotools 2.7-RC1)

Code:
---------

public Style RoadsSelectedStyle(Set<FeatureId> IDs)
    {
        Rule SelectedRule = RoadsRule(true);
        Rule UnselectedRule = RoadsRule(false);

        SelectedRule.setFilter(filterFactory.id(IDs)); //selected components
        UnselectedRule.setElseFilter(true); // unselected components

        FeatureTypeStyle fts = styleFactory.createFeatureTypeStyle();
        fts.rules().add(SelectedRule);
        fts.rules().add(UnselectedRule);

        Style style = styleFactory.createStyle();
        style.featureTypeStyles().add(fts);
        return style;

    }

public Rule RoadsRule(boolean Selected)
    {
        Stroke stroke;
        Symbolizer symbolizer;
        Symbolizer label_symbolizer;
        Rule rule;
        if(Selected)
        {
            stroke =
styleFactory.createStroke(filterFactory.literal(sel_roads_stroke),
filterFactory.literal(6));
            symbolizer =styleFactory.createLineSymbolizer(stroke, null);
            StyleBuilder style_builder = new StyleBuilder(styleFactory);

          // here is the text symbolizer

            TextSymbolizer textSym =
style_builder.createTextSymbolizer(Color.RED,
style_builder.createFont("Arial", false, false, 20),"RTT_DESCRI");
            rule = styleFactory.createRule();
            rule.symbolizers().add(symbolizer);
            rule.symbolizers().add(textSym);
            return rule;
        }
        else
        {
            stroke =
styleFactory.createStroke(filterFactory.literal(unsel_roads_stroke),
filterFactory.literal(3));
            symbolizer =styleFactory.createLineSymbolizer(stroke, null);
            rule = styleFactory.createRule();
            rule.symbolizers().add(symbolizer);
            return rule;
        }

Is this a bug? Or am I doing something wrong (though I do not think so)
And how could I remove the text symbolizer whenever i select another
feature?
------------------------------------------------------------------------------
The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE:
Pinpoint memory and threading errors before they happen.
Find and fix more than 250 security defects in the development cycle.
Locate bottlenecks in serial and parallel code that limit performance.
http://p.sf.net/sfu/intel-dev2devfeb
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to