Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [udig-devel] updating geotools library

uDig 1.1 makes use of GeoTools 2.2. To make use of a newer version of GeoTools you will need to update to trunk (and trunk does not even uses GeoTools 2.5 - it uses GeoTools 2.6 which is still under development).

When you do go to make use of a new version of GeoTools you will notice that how you make filters has changed. The GeoTools FilterFactory has been removed and we make use of a GeoAPI FilterFactory now.

For more information please review the page on upgrading:
http://udig.refractions.net/confluence/display/DEV/GeoTools+2.5+for+uDig+Developers

This page has links to instructions on upgrading filter _expression_ - here is a quick example from the upgrading to GeoTools 2.4 page:

Before (GeoTools 2.2 Code)

package org.geotools.filter;

import junit.framework.TestCase;

import org.geotools.filter.LogicFilter;
import org.geotools.filter.FilterFactory;
import org.geotools.filter.Filter;

public class FilterFactoryBeforeTest extends TestCase {

    public void testBefore() throws Exception {
        FilterFactory ff = FilterFactoryFinder.createFilterFactory();

        CompareFilter filter = ff.createCompareFilter(Filter.COMPARE_GREATER_THAN);
        filter.addLeftValue( ff.createLiteralExpression(2));
        filter.addRightValue( ff.createLiteralExpression(1));

        assertTrue( filter.contrains( null ) );
        assertTrue( filter.getFilterType() == FilterType.COMPARE_GREATER_THAN );
        assertTrue( Filter.NONE != filter );
    }
}

After (GeoTools 2.4 Code)

public void testAfter() throws Exception {
        FilterFactory ff = CommonFactoryFinder.getFilterFactory(null);

        _expression_ left = ff.literal(2);
        _expression_ right = ff.literal(2);
        PropertyIsGreaterThan filter = ff.greater( left, right );

        assertTrue( filter.evaluate( null ) );
        assertTrue( Fitler.INCLUDE != filter );
    }


On Wed, Jan 7, 2009 at 8:21 PM, Yanaris Jorge Aguirre <yanaris.jorge@xxxxxxxxxxxxx> wrote:
Hello:
We´re using the 1.1RC14 version of Udig wich includes the geotools 2.2 but we need to use the geotools 2.5. The things is that the original geotools came as a plug in but the 2.5 is a set of jars. When we try to use a class like FilterFactory for instance, the compiler doesn´t know wich source should use....how could we change the using of the original 2.2 plug in for the 2.5 jar????
 
Thanks in advance...

_______________________________________________
User-friendly Desktop Internet GIS (uDig)
http://udig.refractions.net
http://lists.refractions.net/mailman/listinfo/udig-devel



Back to the top