Hi,
thank you. I should have known that by myself.
One question thought:
To sum it up, i want to modify an existing style depending on a numerical
value, e.g. i want to draw the feature's label depending on expression exp.
Can you give me a hint, how i can implement that? Should i actually use a
DuplicatingStyleVisitor?
This is, what i am doing for know:
public void visit( Rule rule ) {
Symbolizer[] symbolizer = rule.getSymbolizers();
DuplicatingStyleVisitor dsv = new DuplicatingStyleVisitor();
for( int i = 0; i < symbolizer.length; i++ )
if( symbolizer[i] instanceof TextSymbolizer ) {
symbolizer[i].accept( dsv );
TextSymbolizer ts = (TextSymbolizer)dsv.getCopy();
ts.setLabel(ff.literal("exp less than 0.5"));
symbolizer[i] = ts;
}
Rule copy = sf.createRule();
copy.setFilter( ff.less( exp, ff.literal( 0.5 ) ) );
copy.setSymbolizers( symbolizer );
pages.push(copy);
}
The problem is: How can i add an else-rule or multiplie rules to the visitor?
Is there a better way in adding rules?
Thank you very much.
Sincerely,
Julian
-------- Original-Nachricht --------
> Datum: Mon, 08 Sep 2008 10:12:34 -0700
> Von: Jody Garnett <[EMAIL PROTECTED]>
> An: Julian Hagenauer <[EMAIL PROTECTED]>
> CC: [email protected]
> Betreff: Re: [Geotools-gt2-users] (no subject)
> Julian Hagenauer wrote:
> > Fill update( Fill fill ) {
> > Expression color = ff.literal("#000000");
> > if( ff.less( exp, ff.literal(1.0) ).evaluate( null ) )
> > // does not
> work :-(((((((
> > color = ff.literal("#00FF00");
> > Expression opacity = fill.getOpacity();
> > return sf.createFill( color, opacity );
> > }
> >
>
> > CustomStyleVisitor osv = new CustomStyleVisitor( ff.property("num_val")
> );
> > areaStyle.accept(osv);
> > areaStyle = (Style)osv.getCopy();
> > .
> > .
> > .
> >
> > What i want to do is, drawing the labels of the feature, depending on
> their property 'num_val'.
> >
> Cool - create a Rule to select only those features; and then use your
> Fill as normal.
> > If it is smaller than 1, the labels should be drawn green, else black.
> >
> Right so you will need two Rules; one for each set of Features; each
> Rule will have different symbolizers.
>
> Note on SE 1.1. there is a categorization function (I implemented it on
> trunk if you want to use it now) that can offer a lookup based on a
> value ...but using a Rule is going to be so much faster as it will
> be able to perform a nice optimized SQL query.
> > The problem seems to be, that i can't not evaluate the lesser-relation
> of the filterfactory, without the referring feature of the expression.
> >
> Correct; this is a test you want to perform on a feature by feature
> basis; the SLD document lets you declair up front what rules to use; and
> then the correct styles are used based on the individual features.
> > Is there a way around that? Am i overseeing something?
> >
> Rule :-)
--
Ist Ihr Browser Vista-kompatibel? Jetzt die neuesten
Browser-Versionen downloaden: http://www.gmx.net/de/go/browser
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Geotools-gt2-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users