org.opengis.filter.FilterFactory2.touches()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(6.7k)|赞(0)|评价(0)|浏览(95)

本文整理了Java中org.opengis.filter.FilterFactory2.touches()方法的一些代码示例,展示了FilterFactory2.touches()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilterFactory2.touches()方法的具体详情如下:
包路径:org.opengis.filter.FilterFactory2
类名称:FilterFactory2
方法名:touches

FilterFactory2.touches介绍

[英]Checks if the feature's geometry touches, but does not overlap with the geometry held by this object.
[中]检查特征的几何图形是否与该对象所持有的几何图形接触,但不重叠。

代码示例

代码示例来源:origin: geotools/geotools

Object cloneFilter(
      BinarySpatialOperator bso, Object extraData, Expression ex1, Expression ex2) {
    return ff.touches(ex1, ex2);
  }
}.transform(filter, extraData);

代码示例来源:origin: geotools/geotools

/**
   *
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value) throws Exception {
    Expression[] operands = OGCUtils.spatial(node, filterFactory, geometryFactory);

    return filterFactory.touches(operands[0], operands[1]);
  }
}

代码示例来源:origin: geotools/geotools

public BinarySpatialOperator buildSpatialTouchesFilter() throws CQLException {
  Literal geom = this.resultStack.popLiteral();
  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);
}

代码示例来源:origin: geotools/geotools

public Object visit(Touches filter, Object arg1) {
  Expression[][] exps = visitBinarySpatialOp(filter);
  List combinedFilters = new ArrayList(exps.length);
  for (int i = 0; i < exps.length; i++) {
    Expression left = exps[i][0];
    Expression right = exps[i][1];
    Filter unrolled = ff.touches(left, right, filter.getMatchAction());
    combinedFilters.add(unrolled);
  }
  Filter unrolled = combineOred(combinedFilters);
  return unrolled;
}

代码示例来源:origin: geotools/geotools

/**
 * @return new instance of {@link Touches} operation
 * @throws CQLException
 */
public Touches buildTouches() throws CQLException {
  Expression[] params = buildParameters();
  return getFilterFactory().touches(params[0], params[1]);
}

代码示例来源:origin: geotools/geotools

private Filter mergeOperations(String propertyName, List<SpatialOperation> ops) {
  // prepare the property name
  PropertyName property = FF.property(propertyName);
  // prepare united the geometry
  Geometry[] geomArray = new Geometry[ops.size()];
  for (int i = 0; i < geomArray.length; i++) {
    geomArray[i] = ops.get(i).geometry;
  }
  GeometryCollection collection =
      geomArray[0].getFactory().createGeometryCollection(geomArray);
  Geometry united = collection.union();
  Literal geometry = FF.literal(united);
  // rebuild the filter
  Class<?> operation = ops.get(0).operation;
  if (BBOX.class.isAssignableFrom(operation)
      || Intersects.class.isAssignableFrom(operation)) {
    return FF.intersects(property, geometry);
  } else if (Crosses.class.isAssignableFrom(operation)) {
    return FF.crosses(property, geometry);
  } else if (Overlaps.class.isAssignableFrom(operation)) {
    return FF.overlaps(property, geometry);
  } else if (Touches.class.isAssignableFrom(operation)) {
    return FF.touches(property, geometry);
  } else {
    throw new IllegalArgumentException("Cannot merge operation " + operation.getName());
  }
}

代码示例来源:origin: geotools/geotools

return FILTER_FACT.touches(left, right);

代码示例来源:origin: geotools/geotools

public Object visit(Touches filter, Object extraData) {
  Expression geometry1 = visit(filter.getExpression1(), extraData);
  Expression geometry2 = visit(filter.getExpression2(), extraData);
  return getFactory(extraData).touches(geometry1, geometry2, filter.getMatchAction());
}

代码示例来源:origin: geotools/geotools

public static Touches touches() {
  return f.touches(f.property("the_geom"), f.literal(geometry()));
}

代码示例来源:origin: geotools/geotools

static Touches touches() {
  return f.touches(f.property("the_geom"), f.literal(geometry()));
}

代码示例来源:origin: geotools/geotools

return factory.touches(geometry1, geometry2);

代码示例来源:origin: org.geotools/gt-main

Object cloneFilter(BinarySpatialOperator bso, Object extraData, Expression ex1,
      Expression ex2) {
    return ff.touches(ex1, ex2);
  }
}.transform(filter, extraData);

代码示例来源:origin: org.geotools/gt2-xml-filter

/**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   *
   * @generated modifiable
   */
  public Object parse(ElementInstance instance, Node node, Object value)
    throws Exception {
    Expression[] operands = OGCUtils.spatial(node, filterFactory, geometryFactory);

    return filterFactory.touches(operands[0], operands[1]);
  }
}

代码示例来源:origin: geotools/geotools

@Test
public void testTouches() {
  Coordinate[] coords = new Coordinate[] {new Coordinate(0, 0), new Coordinate(10, 10)};
  LineString lineString = new GeometryFactory().createLineString(coords);
  Filter filter = ff.touches(ff.property("name"), ff.literal(lineString));
  Envelope env = (Envelope) filter.accept(visitor, null);
  assertEquals(new Envelope(0, 10, 0, 10), env);
}

代码示例来源:origin: geotools/geotools

public void testTouchesFilter() throws Exception {
  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");
}

代码示例来源:origin: org.geotools/gt-cql

/**
 * @return new instance of {@link Touches} operation
 * @throws CQLException
 */
public Touches buildTouches() throws CQLException {
  Expression[] params = buildParameters();
  
  return getFilterFactory().touches(params[0], params[1]);
}

代码示例来源:origin: org.geotools/gt-cql

public BinarySpatialOperator buildSpatialTouchesFilter() throws CQLException {
  Literal geom = this.resultStack.popLiteral();
  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);
}

代码示例来源:origin: org.geotools/gt-main

public Object visit(Touches filter, Object extraData) {
  Expression geometry1= visit(filter.getExpression1(), extraData);
  Expression geometry2= visit(filter.getExpression2(), extraData);
  return getFactory(extraData).touches(geometry1, geometry2);
}

代码示例来源:origin: org.geotools/gt2-main

public Object visit(Touches filter, Object extraData) {
  Expression geometry1=(Expression) filter.getExpression1().accept(this, extraData);
  Expression geometry2=(Expression) filter.getExpression2().accept(this, extraData);
  return getFactory(extraData).touches(geometry1, geometry2);
}

代码示例来源:origin: geotools/geotools

filter = fac.overlaps(expr1, expr2);
assertEquals(filter.getMatchAction(), MatchAction.ANY);
filter = fac.touches(expr1, expr2);
assertEquals(filter.getMatchAction(), MatchAction.ANY);
filter = fac.within(expr1, expr2);
filter = fac.overlaps(expr1, expr2, MatchAction.ALL);
assertEquals(filter.getMatchAction(), MatchAction.ALL);
filter = fac.touches(expr1, expr2, MatchAction.ONE);
assertEquals(filter.getMatchAction(), MatchAction.ONE);
filter = fac.within(expr1, expr2, MatchAction.ALL);

相关文章