org.opengis.filter.spatial.Touches Java Examples

The following examples show how to use org.opengis.filter.spatial.Touches. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: StyleConverterServiceTest.java    From geomajas-project-server with GNU Affero General Public License v3.0 6 votes vote down vote up
@Test
public void testFilters() throws LayerException {
	Style style = styleConverterService.convert(layerBeansMixedGeometryStyleInfoSld.getUserStyle());
	List<Rule> rules = style.featureTypeStyles().get(0).rules();
	assertThat(rules.get(0).getFilter()).isInstanceOf(BBOX.class);
	assertThat(rules.get(1).getFilter()).isInstanceOf(Contains.class);
	assertThat(rules.get(2).getFilter()).isInstanceOf(Crosses.class);
	assertThat(rules.get(3).getFilter()).isInstanceOf(Disjoint.class);
	assertThat(rules.get(4).getFilter()).isInstanceOf(Equals.class);
	assertThat(rules.get(5).getFilter()).isInstanceOf(Intersects.class);
	assertThat(rules.get(6).getFilter()).isInstanceOf(Overlaps.class);
	assertThat(rules.get(7).getFilter()).isInstanceOf(Touches.class);
	assertThat(rules.get(8).getFilter()).isInstanceOf(Within.class);
	NamedStyleInfo namedStyleInfo = styleConverterService.convert(
			layerBeansMixedGeometryStyleInfoSld.getUserStyle(), featureInfo);
	Assert.assertEquals(9, namedStyleInfo.getFeatureStyles().size());
}
 
Example #2
Source File: ElasticGeometryFilterIT.java    From elasticgeo with GNU General Public License v3.0 5 votes vote down vote up
@Test
public void testTouchesFilter() throws Exception {
    init("not-active","geo3");
    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("geo3"), ff.literal(ls));
    SimpleFeatureCollection features = featureSource.getFeatures(f);
    assertEquals(1, features.size());
    SimpleFeatureIterator fsi = features.features();
    assertTrue(fsi.hasNext());
    assertEquals(fsi.next().getID(), "active.12");
}
 
Example #3
Source File: PropertyIgnoringFilterVisitor.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Object visit(final Touches filter, final Object extraData) {
  if (!usesProperty(filter)) {
    return Filter.INCLUDE;
  }
  return super.visit(filter, extraData);
}
 
Example #4
Source File: PropertyIgnoringFilterVisitor.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Object visit(final Touches filter, final Object extraData) {
  if (!usesProperty(filter)) {
    return Filter.INCLUDE;
  }
  return super.visit(filter, extraData);
}
 
Example #5
Source File: ExtractGeometryFilterVisitor.java    From geowave with Apache License 2.0 5 votes vote down vote up
@Override
public Object visit(final Touches filter, Object data) {
  if (!attributeOfInterest.equals(filter.getExpression1().toString())) {
    return new ExtractGeometryFilterVisitorResult(infinity(), null);
  }
  data = filter.getExpression2().accept(this, data);

  return new ExtractGeometryFilterVisitorResult((Geometry) data, CompareOperation.TOUCHES);
}
 
Example #6
Source File: FilterToElastic.java    From elasticgeo with GNU General Public License v3.0 4 votes vote down vote up
public Object visit(Touches filter, Object extraData) {
    return visitBinarySpatialOperator(filter, extraData);
}
 
Example #7
Source File: ExtractTimeFilterVisitor.java    From geowave with Apache License 2.0 4 votes vote down vote up
@Override
public Object visit(final Touches filter, final Object data) {
  return new TemporalConstraints();
}
 
Example #8
Source File: CriteriaVisitor.java    From geomajas-project-server with GNU Affero General Public License v3.0 4 votes vote down vote up
/** {@inheritDoc} */
@Override
public Object visit(Touches filter, Object userData) {
	String finalName = parsePropertyName(geomName, userData);
	return SpatialRestrictions.touches(finalName, asGeometry(getLiteralValue(filter.getExpression2())));
}