Package org.geotools.filter

Examples of org.geotools.filter.FilterFactoryImpl


    private static FilterFactoryImpl factory;
    private FilterFactoryImpl getFilterFactory() {
        if(factory == null){
            synchronized(factory) {
                if(factory == null) {
                    factory = new FilterFactoryImpl();
                }
            }
        }
        return factory;
    }
View Full Code Here


* @author Martin Davis
*/
public class FilterFunction_disjoint3DTest extends TestCase{

    public void testIntersects() throws Exception {
        FilterFactoryImpl ff = new FilterFactoryImpl();
               
        SimpleFeatureType type = null;
        try {
            type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry");
        } catch (SchemaException e) {
            e.printStackTrace();
        }       
      
        WKTReader reader = new WKTReader();
        Geometry geom1 = reader.read("LINESTRING(0 0 0, 10 10 10)");
        Feature f = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", geom1 }, null);
       
        Geometry geom2 = reader.read("LINESTRING(10 0 0, 0 10 10)");
        Literal literal_geom = ff.literal(geom2);

        Function exp = ff.function("disjoint3D", ff.property("geom"), literal_geom);
        Object value = exp.evaluate(f);
        assertTrue(value instanceof Boolean);
        assertTrue(! (Boolean) value);
    }
View Full Code Here

* @author Martin Davis
*/
public class FilterFunction_distance3DTest extends TestCase{

    public void testDistance3D() {
        FilterFactoryImpl ff = new FilterFactoryImpl();
        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
               
        SimpleFeatureType type = null;
        try {
            type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry");
        } catch (SchemaException e) {
            e.printStackTrace();
        }       
      
        Feature f = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null);
        Literal literal_geom = ff.literal(gf.createPoint(new Coordinate(10, 30, 40)));

        Function exp = ff.function("distance3D", ff.property("geom"), literal_geom);
        Object value = exp.evaluate(f);
        assertTrue(value instanceof Double);
        assertEquals(14.142135623730951, (Double) value, 0.00001);
    }
View Full Code Here

     */
    @Test
    public void toFilterUsesProvidedFilterFactory() throws Exception {
        final boolean[] called = { false };
       
        FilterFactory ff = new FilterFactoryImpl() {
                public PropertyName property(String propName) {
                    called[0] = true;

                    return super.property(propName);
                }
View Full Code Here

     */
    @Test
    public void toExpressionUsesProvidedFilterFactory() throws Exception {
        final boolean[] called = { false };
       
        FilterFactory ff = new FilterFactoryImpl() {
                public PropertyName property(String propName) {
                    called[0] = true;

                    return super.property(propName);
                }
View Full Code Here

* @author Martin Davis
*/
public class FilterFunction_intersects3DTest extends TestCase{

    public void testIntersects() throws Exception {
        FilterFactoryImpl ff = new FilterFactoryImpl();
               
        SimpleFeatureType type = null;
        try {
            type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry");
        } catch (SchemaException e) {
            e.printStackTrace();
        }       
      
        WKTReader reader = new WKTReader();
        Geometry geom1 = reader.read("LINESTRING(0 0 0, 10 10 10)");
        Feature f = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", geom1 }, null);
       
        Geometry geom2 = reader.read("LINESTRING(10 0 0, 0 10 10)");
        Literal literal_geom = ff.literal(geom2);

        Function exp = ff.function("intersects3D", ff.property("geom"), literal_geom);
        Object value = exp.evaluate(f);
        assertTrue(value instanceof Boolean);
        assertTrue((Boolean) value);
    }
View Full Code Here

* @author Martin Davis
*/
public class FilterFunction_isWithinDistance3DTest extends TestCase{

    public void testDistance3D() {
        FilterFactoryImpl ff = new FilterFactoryImpl();
        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
               
        SimpleFeatureType type = null;
        try {
            type = DataUtilities.createType("testSchema", "name:String,*geom:Geometry");
        } catch (SchemaException e) {
            e.printStackTrace();
        }       
      
        Feature f = SimpleFeatureBuilder.build(type, new Object[] { "testFeature1", gf.createPoint(new Coordinate(10, 20, 30)) }, null);
        Literal literal_geom = ff.literal(gf.createPoint(new Coordinate(10, 30, 40)));
        Literal literal_num = ff.literal(15.0);

        Function exp = ff.function("isWithinDistance3D", ff.property("geom"), literal_geom, literal_num);
        Object value = exp.evaluate(f);
        assertTrue(value instanceof Boolean);
        assertTrue((Boolean) value);
    }
View Full Code Here

            StyleBuilder styleBuilder = new StyleBuilder();

            PointSymbolizerImpl pointSymb = (PointSymbolizerImpl) styleBuilder.createPointSymbolizer();
            pointSymb.setUnitOfMeasure(uom);
           
            FilterFactory2 filterFactory  = new FilterFactoryImpl();
            pointSymb.getGraphic().setSize(filterFactory.literal(size));

            visitor = new UomRescaleStyleVisitor(scaleMetersToPixel);

            pointSymb.accept(visitor);
            PointSymbolizer rescaledPointSymb = (PointSymbolizer) visitor.getCopy();
View Full Code Here

            StyleBuilder styleBuilder = new StyleBuilder();

            LineSymbolizerImpl lineSymb = (LineSymbolizerImpl) styleBuilder.createLineSymbolizer();
            lineSymb.setUnitOfMeasure(uom);
           
            FilterFactory2 filterFactory  = new FilterFactoryImpl();
            lineSymb.getStroke().setWidth(filterFactory.literal(size));

            visitor = new UomRescaleStyleVisitor(scaleMetersToPixel);

            lineSymb.accept(visitor);
            LineSymbolizer rescaledLineSymb = (LineSymbolizer) visitor.getCopy();
View Full Code Here

            StyleBuilder styleBuilder = new StyleBuilder();

            PolygonSymbolizerImpl polySymb = (PolygonSymbolizerImpl) styleBuilder.createPolygonSymbolizer();
            polySymb.setUnitOfMeasure(uom);
           
            FilterFactory2 filterFactory  = new FilterFactoryImpl();
            polySymb.getStroke().setWidth(filterFactory.literal(size));

            visitor = new UomRescaleStyleVisitor(scaleMetersToPixel);

            polySymb.accept(visitor);
            PolygonSymbolizer rescaledPolySymb = (PolygonSymbolizer) visitor.getCopy();
View Full Code Here

TOP

Related Classes of org.geotools.filter.FilterFactoryImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.