Package org.opengis.filter.spatial

Examples of org.opengis.filter.spatial.Intersects


            bbox = bbox.transform(crs, true);
        }
        FilterFactory2 factory = (FilterFactory2) CommonFactoryFinder.getFilterFactory(GeoTools
                .getDefaultHints());
        Geometry geom = new GeometryFactory().toGeometry(bbox);
        Intersects filter = factory.intersects(factory.property(type.getGeometryDescriptor()
                .getName()), factory.literal(geom));

        layer.getQuery(false);
        final FeatureCollection<SimpleFeatureType, SimpleFeature> results = source
                .getFeatures(filter);
View Full Code Here


    try {

          Filter filter = selectedLayer.getFilter();
          FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
          Intersects intersectsFilter;

      final CoordinateReferenceSystem layerCrs = LayerUtil.getCrs(selectedLayer);
      final Geometry splitLineGeom = reprojectSplitLine(splittingLine, layerCrs);

      SimpleFeatureType schema = selectedLayer.getSchema();
View Full Code Here

        if( !bbox.getCoordinateReferenceSystem().equals( crs )) {
            bbox = bbox.transform(crs, true);
        }
        FilterFactory2 factory = (FilterFactory2) CommonFactoryFinder.getFilterFactory(GeoTools.getDefaultHints());
        Geometry geom = new GeometryFactory().toGeometry(bbox);
        Intersects filter = factory.intersects(factory.property(type.getGeometryDescriptor().getName()), factory.literal(geom));
       
        layer.getQuery(false);
        final FeatureCollection<SimpleFeatureType, SimpleFeature>  results = source.getFeatures( filter );
//        if( results.getCount() == 0 ) {
//            return null; // no content!
View Full Code Here

  private Filter createTrimmingLineFilter(ILayer selectedLayer, LineString trimmingLineInLayerCrs)
    throws OperationNotFoundException, TransformException {
    Filter filter = selectedLayer.getFilter();
    FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
    Intersects intersectsFilter;
    try {

      SimpleFeatureType schema = selectedLayer.getSchema();
      String typeName = schema.getGeometryDescriptor().getLocalName();
View Full Code Here

        GeometryFactory gf = new GeometryFactory();
        LineString ls = gf.createLineString(new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)});
        ls.setUserData(CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:4326"));
       
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        Intersects original = ff.intersects(ff.property("geom"), ff.literal(ls));
        Filter clone = (Filter) original.accept(reprojector, null);
        assertNotSame(original, clone);
        Intersects isClone = (Intersects) clone;
        assertEquals(isClone.getExpression1(), original.getExpression1());
        LineString clonedLs = (LineString) ((Literal) isClone.getExpression2()).getValue();
        assertTrue(15 == clonedLs.getCoordinateN(0).x);
        assertTrue(10 == clonedLs.getCoordinateN(0).y);
        assertTrue(25 == clonedLs.getCoordinateN(1).x);
        assertTrue(20 == clonedLs.getCoordinateN(1).y);
        assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData());
View Full Code Here

    public void testIntersectsUnreferencedGeometry() throws Exception {
        GeometryFactory gf = new GeometryFactory();
        LineString ls = gf.createLineString(new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)});
       
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        Intersects original = ff.intersects(ff.property("geom"), ff.literal(ls));
        Filter clone = (Filter) original.accept(reprojector, null);
        assertNotSame(original, clone);
        assertEquals(original, clone);
    }
View Full Code Here

        GeometryFactory gf = new GeometryFactory();
        LineString ls = gf.createLineString(new Coordinate[] {new Coordinate(10, 15), new Coordinate(20, 25)});
        ls.setUserData(CRS.decode("urn:x-ogc:def:crs:EPSG:6.11.2:4326"));
       
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        Intersects original = ff.intersects(ff.property("line"), ff.literal(ls));
        Filter clone = (Filter) original.accept(reprojector, null);
        assertNotSame(original, clone);
        assertEquals(original, clone);
    }
View Full Code Here

   
    public void testIntersectsWithFunction() throws Exception {
        Function function = new GeometryFunction();
       
        // see if coordinates gets flipped, urn forces lat/lon interpretation
        Intersects original = ff.intersects(ff.property("geom"), function);
        Filter clone = (Filter) original.accept(reprojector, null);
        assertNotSame(original, clone);
        Intersects isClone = (Intersects) clone;
        assertEquals(isClone.getExpression1(), original.getExpression1());
        LineString clonedLs = (LineString) isClone.getExpression2().evaluate(null);
        assertTrue(15 == clonedLs.getCoordinateN(0).x);
        assertTrue(10 == clonedLs.getCoordinateN(0).y);
        assertTrue(25 == clonedLs.getCoordinateN(1).x);
        assertTrue(20 == clonedLs.getCoordinateN(1).y);
        assertEquals(CRS.decode("EPSG:4326"), clonedLs.getUserData());
View Full Code Here

        targetType = (FeatureType) targetDescriptor.getType();

        Expression literalGeom = ff
                .literal(new GeometryFactory().createPoint(new Coordinate(1, 1)));

        Intersects gf = ff.intersects(ff.property("areaOfInfluence"), literalGeom, MatchAction.ALL);

        Filter unrolled = (Filter) gf.accept(visitor, null);
        assertTrue(unrolled instanceof Intersects);
        assertNotSame(gf, unrolled);
        assertEquals(MatchAction.ALL, ((Intersects) unrolled).getMatchAction());

        Intersects newFilter = (Intersects) unrolled;
        Expression left = newFilter.getExpression1();
        Expression right = newFilter.getExpression2();

        assertSame(right, literalGeom);
        assertTrue(left instanceof Function);
        Function fe = (Function) left;
        assertEquals("buffer", fe.getName());
View Full Code Here

    }

    public void testIntersectsParse() throws Exception {
        FilterMockData.intersects(document, document);

        Intersects intersects = (Intersects) parse();

        assertNotNull(intersects.getExpression1());
        assertNotNull(intersects.getExpression2());
    }
View Full Code Here

TOP

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

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.