本文整理了Java中org.opengis.filter.FilterFactory2.equal()
方法的一些代码示例,展示了FilterFactory2.equal()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilterFactory2.equal()
方法的具体详情如下:
包路径:org.opengis.filter.FilterFactory2
类名称:FilterFactory2
方法名:equal
[英]Checks if the geometry of the two operands are equal.
[中]检查两个操作数的几何图形是否相等。
代码示例来源:origin: geotools/geotools
Object cloneFilter(
BinarySpatialOperator bso, Object extraData, Expression ex1, Expression ex2) {
return ff.equal(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.equal(operands[0], operands[1]);
}
}
代码示例来源:origin: geotools/geotools
Object cloneFilter(
BinaryComparisonOperator bso,
Object extraData,
Expression ex1,
Expression ex2) {
return ff.equal(ex1, ex2, bso.isMatchingCase());
}
}.transform(filter, extraData);
代码示例来源:origin: geotools/geotools
private Filter buildLocationsFilter(RasterManager manager, Set<String> locations) {
PropertyName locationProperty = getLocationProperty(manager);
List<Filter> filters =
locations
.stream()
.map(l -> FF.equal(locationProperty, FF.literal(l), false))
.collect(Collectors.toList());
return Filters.or(FF, filters);
}
代码示例来源:origin: geotools/geotools
public Object visit(Equals 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.equal(left, right, filter.getMatchAction());
combinedFilters.add(unrolled);
}
Filter unrolled = combineOred(combinedFilters);
return unrolled;
}
代码示例来源:origin: geotools/geotools
/**
* @return new instance of {@link Equals} operation
* @throws CQLException
*/
public Equals buildEquals() throws CQLException {
Expression[] params = buildParameters();
return getFilterFactory().equal(params[0], params[1]);
}
/**
代码示例来源:origin: geotools/geotools
public BinarySpatialOperator buildSpatialEqualFilter() 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.equal(property, geom);
}
代码示例来源:origin: geotools/geotools
public Object visit(PropertyIsEqualTo filter, Object arg1) {
Expression[][] expressions = visitBinaryComparisonOperator(filter);
List combinedFilters = new ArrayList(expressions.length);
for (int i = 0; i < expressions.length; i++) {
Expression left = expressions[i][0];
Expression right = expressions[i][1];
Filter unrolled =
ff.equal(left, right, filter.isMatchingCase(), filter.getMatchAction());
combinedFilters.add(unrolled);
}
Filter unrolled = combineOred(combinedFilters);
return unrolled;
}
代码示例来源:origin: geotools/geotools
public Object visit(Equals filter, Object extraData) {
Expression geometry1 = visit(filter.getExpression1(), extraData);
Expression geometry2 = visit(filter.getExpression2(), extraData);
return getFactory(extraData).equal(geometry1, geometry2, filter.getMatchAction());
}
代码示例来源:origin: geotools/geotools
public Object visit(PropertyIsEqualTo filter, Object extraData) {
Expression expr1 = visit(filter.getExpression1(), extraData);
Expression expr2 = visit(filter.getExpression2(), extraData);
boolean matchCase = filter.isMatchingCase();
return getFactory(extraData).equal(expr1, expr2, matchCase, filter.getMatchAction());
}
代码示例来源:origin: geotools/geotools
public static Equals equals() {
return f.equal(f.property("the_geom"), f.literal(geometry()));
}
代码示例来源:origin: geotools/geotools
static Equals equals() {
return f.equal(f.property("the_geom"), f.literal(geometry()));
}
代码示例来源:origin: geotools/geotools
public Object visit(PropertyIsEqualTo filter, Object extraData) {
Class targetType = getTargetType(filter.getExpression1(), filter.getExpression2());
Expression expr1 = optimize(filter.getExpression1(), extraData, targetType);
Expression expr2 = optimize(filter.getExpression2(), extraData, targetType);
boolean matchCase = filter.isMatchingCase();
return getFactory(extraData).equal(expr1, expr2, matchCase, filter.getMatchAction());
}
代码示例来源:origin: geotools/geotools
/**
* Test the geometry operators.
*
* @throws IllegalFilterException If the constructed filter is not valid.
*/
public void testGeometry() throws IllegalFilterException {
Coordinate[] coords = new Coordinate[3];
coords[0] = new Coordinate(1, 2);
coords[1] = new Coordinate(3, 4);
coords[2] = new Coordinate(5, 6);
// Test Equals
PropertyName att = fac.property("testGeometry");
GeometryFactory gf = new GeometryFactory(new PrecisionModel());
Literal geom = fac.literal(gf.createLineString(coords));
Equals filter = fac.equal(att, geom);
assertAttributeName(filter, "testGeometry");
filter = fac.equal(att, att);
assertAttributeName(filter, "testGeometry");
filter = fac.equal(geom, att);
assertAttributeName(filter, "testGeometry");
}
代码示例来源:origin: geotools/geotools
@Test
public void testCompareStringOperators_All() {
Filter filter;
List<String> list = new ArrayList<String>();
list.add("foo-1");
list.add("foo-2");
list.add("foo-3");
List<String> list2 = new ArrayList<String>();
list2.add("fOo-2");
list2.add("foO-2");
list2.add("Foo-2");
Expression e1 = new LiteralExpressionImpl(list);
Expression e2 = new LiteralExpressionImpl(list2);
filter = fac.equal(e1, new LiteralExpressionImpl("foo-2"), false, MatchAction.ALL);
assertFalse(filter.evaluate(null));
filter = fac.equal(new LiteralExpressionImpl("foo-2"), e2, false, MatchAction.ALL);
assertTrue(filter.evaluate(null));
filter = fac.notEqual(e1, new LiteralExpressionImpl("blah"), false, MatchAction.ALL);
assertTrue(filter.evaluate(null));
filter = fac.notEqual(new LiteralExpressionImpl("foo-2"), e1, false, MatchAction.ALL);
assertFalse(filter.evaluate(null));
filter = fac.like(e1, "foo-*", "*", "?", "\\", false, MatchAction.ALL);
assertTrue(filter.evaluate(null));
filter = fac.like(e1, "*-1", "*", "?", "\\", false, MatchAction.ALL);
assertFalse(filter.evaluate(null));
}
代码示例来源:origin: geotools/geotools
FilterFactory2 ff = FeatureUtilities.DEFAULT_FILTER_FACTORY;
PropertyIsEqualTo crsFilter =
ff.equal(ff.property(crsAttribute), ff.literal(granuleCRSCode), false);
BBOX bbox = ff.bbox(ff.property(""), requestBounds);
Filter filter = ff.and(crsFilter, bbox);
代码示例来源:origin: geotools/geotools
@Test
public void testBinaryComparison() {
PropertyIsEqualTo equal = ff.equal(ff.property("a"), ff.property("b"), false);
NullHandlingVisitor visitor = new NullHandlingVisitor();
Filter result = (Filter) equal.accept(visitor, null);
assertTrue(result instanceof And);
Filter expected = ff.and(Arrays.asList(equal, propertyNotNull("a"), propertyNotNull("b")));
assertEquals(expected, result);
equal = ff.equal(ff.property("a"), ff.literal(10), false);
result = (Filter) equal.accept(visitor, null);
assertTrue(result instanceof And);
expected = ff.and(Arrays.asList(equal, propertyNotNull("a")));
assertEquals(expected, result);
equal = ff.equal(ff.literal(10), ff.property("b"), false);
result = (Filter) equal.accept(visitor, null);
assertTrue(result instanceof And);
expected = ff.and(Arrays.asList(equal, propertyNotNull("b")));
assertEquals(expected, result);
equal = ff.equal(ff.literal(10), ff.literal(20), false);
result = (Filter) equal.accept(visitor, null);
assertEquals(equal, result);
}
代码示例来源:origin: geotools/geotools
public void testEqualsFilter() throws Exception {
FilterFactory2 ff = CommonFactoryFinder.getFilterFactory2(null);
// should match only "r3"
GeometryFactory gf = new GeometryFactory();
Geometry g = gf.createGeometry((Geometry) td.roadFeatures[2].getDefaultGeometry());
Equals cs = ff.equal(ff.literal(g), ff.property(aname("geom")));
FeatureCollection features = dataStore.getFeatureSource(tname("road")).getFeatures(cs);
checkSingleResult(features, "r3");
}
代码示例来源:origin: geotools/geotools
@Test
public void testSimplifyRedundant() {
PropertyIsBetween between =
ff.between(ff.property("a"), ff.property("b"), ff.property("c"));
PropertyIsEqualTo equal = ff.equal(ff.property("a"), ff.property("b"), false);
And and = ff.and(between, equal);
NullHandlingVisitor nh = new NullHandlingVisitor();
Filter nhResult = (Filter) and.accept(nh, null);
SimplifyingFilterVisitor simplifier = new SimplifyingFilterVisitor();
Filter simplified = (Filter) nhResult.accept(simplifier, null);
assertTrue(simplified instanceof And);
Filter expected =
ff.and(
Arrays.asList(
between,
equal,
propertyNotNull("a"),
propertyNotNull("b"),
propertyNotNull("c")));
assertEquals(expected, simplified);
}
代码示例来源:origin: geotools/geotools
@Test
public void testCompareFilter() throws Exception {
PropertyIsEqualTo complexFilter =
ff.equal(ff.property("measurement/result"), ff.literal(1.1), true, MatchAction.ALL);
Filter unrolled = (Filter) complexFilter.accept(visitor, null);
assertNotNull(unrolled);
assertTrue(unrolled instanceof PropertyIsEqualTo);
assertNotSame(complexFilter, unrolled);
assertTrue(((PropertyIsEqualTo) unrolled).isMatchingCase());
assertEquals(MatchAction.ALL, ((PropertyIsEqualTo) unrolled).getMatchAction());
Expression left = ((PropertyIsEqualTo) unrolled).getExpression1();
Expression right = ((PropertyIsEqualTo) unrolled).getExpression2();
assertTrue(left instanceof PropertyName);
assertTrue(right instanceof Literal);
PropertyName attExp = (PropertyName) left;
String expectedAtt = "results_value";
assertEquals(expectedAtt, attExp.getPropertyName());
assertEquals(new Double(1.1), ((Literal) right).getValue());
}
内容来源于网络,如有侵权,请联系作者删除!