I got it work, what was causing the problem was the additional piece of
code on the rule the filter was applied to.

rule.setMaxScaleDenominator(min);
rule.setMinScaleDenominator(max);

I guess I am not sure what the Max/Min Scale Denominators are :-)

On the other hand, as you said this also works:
BetweenFilter bf = filterFactory.createBetweenFilter();
  bf.addMiddleValue(filterFactory.createAttributeExpression(at.getName()));
bf.setExpression1(filterFactory.createLiteralExpression(min));
bf.setExpression2(filterFactory.createLiteralExpression(min));

Very cool!
gaby

Jody Garnett wrote:
> That looks okay to me ... once again step through with the debugger to
> confirm what was created makes sense.
> - CQL is easier for this kind of thing
> - There is a BETWEEN filter that does exactly this kind of check
> 
> Gabriella Turek wrote:
>> I want to set up a rule to display data in give interval with a certain
>> color:
>> I set up the filter as follows:
>>
>> LogicFilter lf = filterFactory.createLogicFilter(FilterType.LOGIC_AND);
>>
>> CompareFilter cf =
>> filterFactory.createCompareFilter(Filter.COMPARE_GREATER_THAN_EQUAL);
>>
>> cf.addLeftValue(filterFactory.createAttributeExpression(at.getName()));
>> //AttributeType Name
>>
>> cf.addRightValue(filterFactory.createLiteralExpression(Double.toString(min)));
>>
>> // lowerbound
>>     lf.addFilter(cf);
>>   
> AT >= min
>>     cf = filterFactory.createCompareFilter(Filter.COMPARE_LESS_THAN);
>>    
>> cf.addLeftValue(filterFactory.createAttributeExpression(at.getName()));
>>
>> cf.addRightValue(filterFactory.createLiteralExpression(Double.toString(max)));
>>
>> //upper bound
>>
>>     lf.addFilter(cf);
>>   
> AT < max
> 
> I seem to recall you are using GeoTools 2.3? Try just using the literal
> double values ... may work out better?
> 
> either: cf.addRightValue(filterFactory.createLiteralExpression( max )));
> 
> or:
> 
> cf.addRightValue(filterFactory.createLiteralExpression( new Double(max)
> )));
> 
>> It does not work. I suspect I am not supposed to use a literal here....
>>   
> min and max are just values right? nothing dynamic?
>> Thanx
>> Gaby
>>
>>   
> 

-- 
***************************************************************
**     Gabriella Turek               [EMAIL PROTECTED]      **
** National Institute of Water & Atmospheric Research (NIWA) **
** PO Box 8602 Christchurch New Zealand    +64-3-343-8067    **
***************************************************************

-------------------------------------------------------------------------
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
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to