Which version of geotools are you using? On 2.4 it seems to have been
deprecated and replaced with DuplicatingFilterVisitor. Which makes sense
because the filter api changed in 2.4.

So... if you are working with 2.3.x or below the following should work:

DuplicatorFilterVisitor dfv = new DuplicatorFilterVisitor(ff);
dfv.visit( myFilter );

Filter filterCopy = (Filter) dfv.getCopy();


Martin Schmitz wrote:
> Well, I think you mean DuplicatorFilterVisitor.
> But: I don't know, how to use it...
> 
> There is no method to copy a Filter...
> 
> Or is...
> 
> DuplicatorFilterVisitor dfv = new DuplicatorFilterVisitor(ff);
> dfv.visit( myFilter );
> Filter filterCopy = (Filter)dfv.copy( myFilter );
> 
> ... the way?
> 
> 
> Justin Deoliveira schrieb:
>> Hi Martin,
>>
>> Check out the org.geotools.filter.visitor.DuplicatingFilterVisitor
>> class. That should do the trick for you.
>>
>> -Justin
>>
>> Martin Schmitz wrote:
>>> Hello everybody,
>>>
>>> is there a method to clone a Filter object?
>>>
>>> I "prepare" a Filter and apply it to several FeatureSources.
>>> Thereby I recognized, that sometimes also the results of FURTHER created 
>>> sub-collections changes, when changing the expressions of the Filter object!
>>>
>>> For several reasons I can not recreate the complete Filter before 
>>> calling FeatureSource.getFeatures( filter ). At the calling point my 
>>> program doesn't have any information about the filer.
>>> So the easiest way seems to be to clone the given filter object.
>>> But how?
>>>
>>> Thanks for help...
>>>
>>> Martin
>>>
>>> -------------------------------------------------------------------------
>>> 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
>>>
>>>
>>>
>>
> 
> -------------------------------------------------------------------------
> 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
> 
> !DSPAM:4007,4714f23760681015089218!
> 


-- 
Justin Deoliveira
The Open Planning Project
http://topp.openplans.org

-------------------------------------------------------------------------
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