本文整理了Java中org.opengis.filter.FilterFactory2.less()
方法的一些代码示例,展示了FilterFactory2.less()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilterFactory2.less()
方法的具体详情如下:
包路径:org.opengis.filter.FilterFactory2
类名称:FilterFactory2
方法名:less
暂无
代码示例来源:origin: geotools/geotools
public Object visit(PropertyIsLessThan 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.less(left, right, filter.isMatchingCase(), filter.getMatchAction());
combinedFilters.add(unrolled);
}
Filter unrolled = combineOred(combinedFilters);
return unrolled;
}
代码示例来源:origin: geotools/geotools
return factory.less(expr1, expr2);
代码示例来源:origin: geotools/geotools
return factory.less(expr1, expr2);
代码示例来源:origin: geotools/geotools
/** Delegates to FilterFactory2 */
public static boolean lessThan(Object o1, Object o2) {
return getFilterFactory2().less(ff.literal(o1), ff.literal(o2)).evaluate(null);
}
代码示例来源:origin: geotools/geotools
/**
* Builds a filter that compares a and b: <code>a compare b</code>
*
* @param filterType
* @param a
* @param b
* @return
*/
org.opengis.filter.Filter compare(
Class filterType,
org.opengis.filter.expression.Expression a,
org.opengis.filter.expression.Expression b) {
if (filterType == PropertyIsLessThan.class) {
return fac.less(a, b);
} else if (filterType == PropertyIsLessThanOrEqualTo.class) {
return fac.lessOrEqual(a, b);
}
if (filterType == PropertyIsEqualTo.class) {
return fac.equals(a, b);
} else if (filterType == PropertyIsGreaterThanOrEqualTo.class) {
return fac.greaterOrEqual(a, b);
} else if (filterType == PropertyIsGreaterThan.class) {
return fac.greater(a, b);
} else {
throw new IllegalArgumentException("Uknown compare filter type " + filterType);
}
}
代码示例来源:origin: geotools/geotools
static PropertyIsLessThan propertyIsLessThan() {
return f.less(propertyName(), literal());
}
代码示例来源:origin: geotools/geotools
Filter less;
if (i < rangedClassifier.getSize() - 1) {
less = FF.less(PERSONS, FF.literal(rangedClassifier.getMax(i)));
} else {
less = FF.lessOrEqual(PERSONS, FF.literal(rangedClassifier.getMax(i)));
代码示例来源:origin: geotools/geotools
public static PropertyIsLessThan propertyIsLessThan() {
return f.less(propertyName(), literal());
}
代码示例来源:origin: geotools/geotools
} else if (simplified instanceof PropertyIsBetween) {
PropertyIsBetween pb = (PropertyIsBetween) simplified;
Filter lt = ff.less(pb.getExpression(), pb.getLowerBoundary());
Filter gt = ff.greater(pb.getExpression(), pb.getUpperBoundary());
return ff.or(lt, gt);
} else if (simplified instanceof PropertyIsGreaterThanOrEqualTo) {
PropertyIsGreaterThanOrEqualTo pg = (PropertyIsGreaterThanOrEqualTo) simplified;
return ff.less(pg.getExpression1(), pg.getExpression2(), pg.isMatchingCase());
} else if (simplified instanceof PropertyIsLessThan) {
PropertyIsLessThan pl = (PropertyIsLessThan) simplified;
代码示例来源:origin: geotools/geotools
public Object visit(PropertyIsLessThan filter, Object extraData) {
Expression expr1 = visit(filter.getExpression1(), extraData);
Expression expr2 = visit(filter.getExpression2(), extraData);
return getFactory(extraData)
.less(expr1, expr2, filter.isMatchingCase(), filter.getMatchAction());
}
代码示例来源:origin: geotools/geotools
assertFalse(filter.evaluate(null));
filter = fac.less(e1, new LiteralExpressionImpl(100000000), false, MatchAction.ALL);
assertTrue(filter.evaluate(null));
filter = fac.less(e1, new LiteralExpressionImpl(9999), false, MatchAction.ALL);
assertFalse(filter.evaluate(null));
filter = fac.less(new LiteralExpressionImpl(32), e1, false, MatchAction.ALL);
assertTrue(filter.evaluate(null));
filter = fac.less(new LiteralExpressionImpl(700), e1, false, MatchAction.ALL);
assertFalse(filter.evaluate(null));
代码示例来源:origin: geotools/geotools
@Override
public Object visit(PropertyIsLessThan 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).less(expr1, expr2, matchCase, filter.getMatchAction());
}
代码示例来源:origin: geotools/geotools
assertFalse(filter.evaluate(null));
filter = fac.less(e, new LiteralExpressionImpl(50));
assertTrue(filter.evaluate(null));
filter = fac.less(e, new LiteralExpressionImpl(34));
assertFalse(filter.evaluate(null));
filter = fac.less(new LiteralExpressionImpl(9999), e);
assertTrue(filter.evaluate(null));
filter = fac.less(new LiteralExpressionImpl(99999), e);
assertFalse(filter.evaluate(null));
代码示例来源:origin: geotools/geotools
public void testFilterEquality() {
Filter f1 = fac.less(fac.property("ATR"), fac.literal("32"));
Filter f2 = fac.notEqual(fac.property("ATR2"), fac.literal("1"));
Assert.assertTrue(f1.equals(f1));
Assert.assertFalse(f1.equals(f2));
Assert.assertFalse(f2.equals(f1));
Filter f4 = fac.notEqual(fac.property("BBB"), fac.literal("2"));
Assert.assertFalse(f2.equals(f4));
Assert.assertFalse(f4.equals(f2));
Filter f3 = fac.less(fac.property("ATR"), fac.literal("40"));
Assert.assertFalse(f1.equals(f3));
Assert.assertFalse(f3.equals(f1));
Expression l32 = fac.literal("32");
Expression l40 = fac.literal("40");
Assert.assertFalse(l32.equals(l40));
Assert.assertFalse(l40.equals(l32));
}
代码示例来源:origin: geotools/geotools
@Test
public void testNonSpatial() {
Filter f = ff.less(ff.property("att"), ff.literal(10));
Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(infinity, env);
}
代码示例来源:origin: geotools/geotools
public void testSafeConversions() {
Literal d = fac.literal(1.1);
Literal i = fac.literal(1);
Filter f1 = fac.greater(d, i);
assertTrue(f1.evaluate(null));
Filter f2 = fac.less(i, d);
assertTrue(f2.evaluate(null));
}
代码示例来源:origin: geotools/geotools
@Test
public void testFilter() throws Exception {
FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2();
StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
UserLayer layer = styleFactory.createUserLayer();
sld.layers().add(layer);
Style style = styleFactory.createStyle();
layer.userStyles().add(style);
Rule rule = styleFactory.createRule();
rule.setFilter(filterFactory.less(filterFactory.property("foo"), filterFactory.literal(2)));
style.featureTypeStyles().add(styleFactory.createFeatureTypeStyle());
style.featureTypeStyles().get(0).rules().add(rule);
PointSymbolizer p = styleFactory.createPointSymbolizer();
rule.symbolizers().add((Symbolizer) p);
StringWriter out = new StringWriter();
Ysld.encode(sld, out);
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap result = obj.seq("feature-styles").map(0).seq("rules").map(0);
assertThat(result, yHasEntry("filter", equalTo("${foo < 2}")));
}
代码示例来源:origin: geotools/geotools
@Test
public void testFilterEscape() throws Exception {
FilterFactory2 filterFactory = CommonFactoryFinder.getFilterFactory2();
StyleFactory styleFactory = CommonFactoryFinder.getStyleFactory();
StyledLayerDescriptor sld = styleFactory.createStyledLayerDescriptor();
UserLayer layer = styleFactory.createUserLayer();
sld.layers().add(layer);
Style style = styleFactory.createStyle();
layer.userStyles().add(style);
Rule rule = styleFactory.createRule();
rule.setFilter(
filterFactory.less(filterFactory.property("foo"), filterFactory.literal("}$")));
style.featureTypeStyles().add(styleFactory.createFeatureTypeStyle());
style.featureTypeStyles().get(0).rules().add(rule);
PointSymbolizer p = styleFactory.createPointSymbolizer();
rule.symbolizers().add((Symbolizer) p);
StringWriter out = new StringWriter();
Ysld.encode(sld, out);
YamlMap obj = new YamlMap(YamlUtil.getSafeYaml().load(out.toString()));
YamlMap result = obj.seq("feature-styles").map(0).seq("rules").map(0);
assertThat(result, yHasEntry("filter", equalTo("${foo < '\\}\\$'}")));
}
代码示例来源:origin: geotools/geotools
/** Sets up a schema and a test feature. */
protected void setUp() {
LOGGER.finer("Setting up FilterCapabilitiesTest");
if (setup) {
return;
}
setup = true;
capabilities = new FilterCapabilities();
try {
gFilter = fact.within(fact.property("geom"), fact.literal(null));
compFilter = fact.less(fact.property("size"), fact.literal(3));
} catch (IllegalFilterException ife) {
LOGGER.fine("Bad filter " + ife);
}
capabilities.addType(AbstractFilter.LOGIC_OR);
capabilities.addType(AbstractFilter.LOGIC_AND);
capabilities.addType(AbstractFilter.LOGIC_NOT);
capabilities.addType(FilterType.COMPARE_EQUALS);
capabilities.addType(FilterType.COMPARE_LESS_THAN);
capabilities.addType(AbstractFilter.BETWEEN);
}
代码示例来源:origin: geotools/geotools
public void testLogicFilterDuplication() throws IllegalFilterException {
// create a filter
PropertyIsGreaterThan greater = fac.greater(fac.literal(2), fac.literal(1));
PropertyIsLessThan less = fac.less(fac.literal(3), fac.literal(4));
And and = fac.and(greater, less);
// duplicate it
DuplicatingFilterVisitor visitor = new DuplicatingFilterVisitor();
Filter newFilter = (Filter) and.accept(visitor, fac);
// compare it
assertNotNull(newFilter);
assertEquals(and, newFilter);
}
内容来源于网络,如有侵权,请联系作者删除!