Package org.opengis.filter

Examples of org.opengis.filter.FilterFactory2.touches()


  private FeatureIterator<SimpleFeature> getAffectedFeatures(SimpleFeature feature) throws IOException {
    FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2(GeoTools.getDefaultHints());
    String geomAttName = feature.getFeatureType().getGeometryDescriptor().getLocalName();
    PropertyName geomPropertyExpression = filterFactory.property(geomAttName);
    Literal literalGeomExpression = filterFactory.literal(feature.getDefaultGeometry());
    Touches filter = filterFactory.touches(geomPropertyExpression, literalGeomExpression);
   
    IProgressMonitor monitor =
      getContext().getActionBars().getStatusLineManager().getProgressMonitor();
    FeatureSource<SimpleFeatureType,SimpleFeature> resource =
      getContext().getSelectedLayer().getResource(FeatureSource.class, monitor);
View Full Code Here


            geometryPropertyName);
      } else if (spatialFilterType.equals(SpatialFilterType.OVERLAPS)) {
        geometryFilter = ff.overlaps(ff.literal(geometry),
            geometryPropertyName);
      } else if (spatialFilterType.equals(SpatialFilterType.TOUCHES)) {
        geometryFilter = ff.touches(ff.literal(geometry),
            geometryPropertyName);
      } else if (spatialFilterType.equals(SpatialFilterType.WITHIN)) {
        geometryFilter = ff.within(ff.literal(geometry),
            geometryPropertyName);
      }
View Full Code Here

              geometryPropertyName);
        } else if (spatialFilterType.equals(SpatialFilterType.OVERLAPS)) {
          geometryFilter = ff.overlaps(ff.literal(geometry),
              geometryPropertyName);
        } else if (spatialFilterType.equals(SpatialFilterType.TOUCHES)) {
          geometryFilter = ff.touches(ff.literal(geometry),
              geometryPropertyName);
        } else if (spatialFilterType.equals(SpatialFilterType.WITHIN)) {
          geometryFilter = ff.within(ff.literal(geometry),
              geometryPropertyName);
        }
View Full Code Here

                case FilterType.GEOMETRY_OVERLAPS:
                    return factory.overlaps(geometry1, geometry2);

                case FilterType.GEOMETRY_TOUCHES:
                    return factory.touches(geometry1, geometry2);

                default:
                    throw new SAXException("Illegal filter for " + element);
                }
            } catch (ClassCastException filterRequired) {
View Full Code Here

        Expression property = this.resultStack.popExpression();

        FilterFactory2 ff = (FilterFactory2) filterFactory; // TODO this cast must be removed. It depends of Geometry implementation

        return ff.touches(property, geom);
    }

    public BinarySpatialOperator buildSpatialCrossesFilter() throws CQLException {
        Literal geom = this.resultStack.popLiteral();
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));
        Touches f = ff.touches(ff.property("geo"), ff.literal(ls));
        SimpleFeatureCollection features = featureSource.getFeatures(f);
        assertEquals(1, features.size());
        SimpleFeatureIterator fsi = features.features();
        assertTrue(fsi.hasNext());
        assertEquals(fsi.next().getID(), "not-active.12");
View Full Code Here

        FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
        // should match only "r1"
        GeometryFactory gf = new GeometryFactory();
        PackedCoordinateSequenceFactory sf = new PackedCoordinateSequenceFactory();
        LineString ls = gf.createLineString(sf.create(new double[] { 1, 1, 1, 3 }, 2));
        Touches is = ff.touches(ff.property(aname("geom")), ff.literal(ls));
        FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(is);
        checkSingleResult(features, "r1");
    }

    public void testContainsFilter() throws Exception {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.