Package org.opengis.filter.spatial

Examples of org.opengis.filter.spatial.Beyond


    }

    public void testBeyondParse() throws Exception {
        FilterMockData.beyond(document, document);

        Beyond beyond = (Beyond) parse();

        assertNotNull(beyond.getExpression1());
        assertNotNull(beyond.getExpression2());
        assertEquals(1.0, beyond.getDistance(), 0.1);
        assertEquals("m",beyond.getDistanceUnits());
    }
View Full Code Here


    }

    public void testBeyondParse() throws Exception {
        FilterMockData.beyond(document, document);

        Beyond beyond = (Beyond) parse();

        assertNotNull(beyond.getExpression1());
        assertNotNull(beyond.getExpression2());
        assertEquals(1.0, beyond.getDistance(), 0.1);
        assertEquals("m",beyond.getDistanceUnits());
    }
View Full Code Here

        Filter resultFilter;
        // Beyond
        resultFilter = CompilerUtil.parseFilter(language,
                "BEYOND(ATTR1, POINT(1.0 2.0), 10.0, kilometers)");
        Assert.assertTrue(resultFilter instanceof Beyond);
        Beyond beyondFilter = (Beyond) resultFilter;

        Assert.assertEquals(beyondFilter.getDistance(), 10.0, 0.1);
        Assert.assertEquals(beyondFilter.getDistanceUnits(), "kilometers");
        Assert.assertEquals(beyondFilter.getExpression1().toString(), "ATTR1");

        Expression geomExpression = beyondFilter.getExpression2();
        Assert.assertTrue(geomExpression instanceof Literal);
        Literal literalPoint = (Literal) geomExpression;

        Object pointValue = literalPoint.getValue();
        Assert.assertTrue(pointValue instanceof Point);
View Full Code Here

        init("not-active");
        FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        Point ls = gf.createPoint(sf.create(new double[] { 1, 1 }, 2));
        Beyond f = ff.beyond(ff.property("geo"), ff.literal(ls), 1, SI.METRE.getSymbol());
        SimpleFeatureCollection features = featureSource.getFeatures(f);
        assertEquals(1, features.size());
        SimpleFeatureIterator fsi = features.features();
        assertTrue(fsi.hasNext());
        assertEquals(fsi.next().getID(), "not-active.13");
View Full Code Here

    }
   
    public void testBeyond() throws Exception {
        Filter test = parseDocument("beyond.xml");
        assertTrue(test instanceof Beyond);
        Beyond bd = (Beyond) test;
        assertEquals("the_geom", ((PropertyName) bd.getExpression1()).getPropertyName());
        assertTrue(((Literal) bd.getExpression2()).getValue() instanceof Point);
        assertEquals(5000.0, bd.getDistance());
        assertEquals("metre", bd.getDistanceUnits());
        LOGGER.fine("parsed filter is " + test);
    }
View Full Code Here

        coords2[4] = new Coordinate(10, 10);
        GeometryFactory gf = new GeometryFactory(new PrecisionModel());
        Literal right = new LiteralExpressionImpl(gf.createPolygon(gf.createLinearRing(
                coords2),null));

        Beyond filter = fac.beyond(left, right, 20, "m");
        LOGGER.finer(filter.toString());
        LOGGER.finer("contains feature: " + filter.evaluate(testFeature));
        assertFalse(filter.evaluate(testFeature));
       
        filter = fac.beyond(left, right, 2, "m");
        LOGGER.finer("contains feature: " + filter.evaluate(testFeature));
        assertTrue(filter.evaluate(testFeature));       

        coords2[0] = new Coordinate(20, 20);
        coords2[1] = new Coordinate(21, 20);
        coords2[2] = new Coordinate(21, 21);
        coords2[3] = new Coordinate(20, 21);
        coords2[4] = new Coordinate(20, 20);
        right = fac.literal(gf
                .createPolygon(gf.createLinearRing(coords2), null));
        filter = fac.beyond(left, right, 2, "m");
        LOGGER.finer(filter.toString());
        LOGGER.finer("contains feature: " + filter.evaluate(testFeature));
        assertTrue(filter.evaluate(testFeature));
       
        right = new LiteralExpressionImpl(null);
        filter = fac.beyond(left, right, 2, "m");
        LOGGER.finer(filter.toString());
        LOGGER.finer("contains feature: " + filter.evaluate(testFeature));
        assertFalse(filter.evaluate(testFeature));

    }
View Full Code Here

                return ReprojectingFilterVisitor.super.visit((Beyond) filter, extraData);
            }

            Object cloneFilter(BinarySpatialOperator bso, Object extraData, Expression ex1,
                    Expression ex2) {
                Beyond filter = (Beyond) bso;
                return ff.beyond(ex1, ex2, filter.getDistance(), filter.getDistanceUnits());
            }
        }.transform(filter, extraData);
    }
View Full Code Here

       
        Filter resultFilter = CompilerUtil.parseFilter(language,
                "BEYOND(POINT(5.0 7.0), POINT(1.0 2.0), 10.0, kilometers)");
       
        Assert.assertTrue(resultFilter instanceof Beyond);
        Beyond beyondFilter = (Beyond) resultFilter;
       
        Literal literal1 = (Literal) beyondFilter.getExpression1();
        Assert.assertTrue(literal1.getValue() instanceof Geometry);
       
        Literal literal2 = (Literal) beyondFilter.getExpression2();
        Assert.assertTrue(literal2.getValue() instanceof Geometry);
    }
View Full Code Here

       
        Filter resultFilter = CompilerUtil.parseFilter(language,
                "BEYOND(buffer(geom1,3), buffer(geom2, 4), 10.0, kilometers)");
       
        Assert.assertTrue(resultFilter instanceof Beyond);
        Beyond beyondFilter = (Beyond) resultFilter;
       
        Expression expr1 = beyondFilter.getExpression1();
        Assert.assertTrue(expr1 instanceof FilterFunction_buffer);
       
        Expression expr2 =  beyondFilter.getExpression2();
        Assert.assertTrue(expr2 instanceof FilterFunction_buffer);
    }
View Full Code Here

                return ReprojectingFilterVisitor.super.visit((Beyond) filter, extraData);
            }

            Object cloneFilter(BinarySpatialOperator bso, Object extraData, Expression ex1,
                    Expression ex2) {
                Beyond filter = (Beyond) bso;
                return ff.beyond(ex1, ex2, filter.getDistance(), filter.getDistanceUnits());
            }
        }.transform(filter, extraData);
    }
View Full Code Here

TOP

Related Classes of org.opengis.filter.spatial.Beyond

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.