本文整理了Java中org.opengis.filter.FilterFactory2.bbox()
方法的一些代码示例,展示了FilterFactory2.bbox()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。FilterFactory2.bbox()
方法的具体详情如下:
包路径:org.opengis.filter.FilterFactory2
类名称:FilterFactory2
方法名:bbox
[英]Checks if the geometry expression overlaps the specified bounding box.
[中]检查几何图形表达式是否与指定的边界框重叠。
代码示例来源:origin: geotools/geotools
@Test
public void testBBOX() {
ff.bbox("geom", 0, 0, 10, 10, "EPSG:4326").accept(visitor, null);
assertTrue(visitor.hasSpatialFilter);
}
代码示例来源:origin: geotools/geotools
public void testBboxReprojectUnreferencedProperty() {
// see if coordinates gets flipped, urn forces lat/lon interpretation
BBOX bbox =
ff.bbox(ff.property("line"), 10, 15, 20, 25, "urn:x-ogc:def:crs:EPSG:6.11.2:4326");
Filter clone = (Filter) bbox.accept(reprojector, null);
assertNotSame(bbox, clone);
assertEquals(bbox, clone);
}
代码示例来源:origin: geotools/geotools
public void testBboxNoReprojection() {
// no reprojection needed in fact
Filter bbox = ff.bbox(ff.property("geom"), 10, 10, 20, 20, "EPSG:4326");
Filter clone = (Filter) bbox.accept(reprojector, null);
assertNotSame(bbox, clone);
assertEquals(bbox, clone);
}
代码示例来源:origin: geotools/geotools
@Test
public void testBbox() {
Filter f = ff.bbox("geom", -10, -10, 10, 10, null);
Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testSpatialDefaulter() throws Exception {
// a spatial filter in the same SRS as the geometry
StyleBuilder sb = new StyleBuilder();
PolygonSymbolizer ps = sb.createPolygonSymbolizer();
Style style = sb.createStyle(ps);
Rule rule = style.featureTypeStyles().get(0).rules().get(0);
rule.setFilter(ff.bbox("geom", 1, 1, 4, 4, null));
content.addLayer(new FeatureLayer(squareFS, style));
RendererBaseTest.showRender("Spatial without CRS", renderer, TIME, bounds);
assertEquals(2, renderedIds.size());
}
代码示例来源:origin: geotools/geotools
@Test
public void testSpatialNoReprojection() throws Exception {
// a spatial filter in the same SRS as the geometry
StyleBuilder sb = new StyleBuilder();
PolygonSymbolizer ps = sb.createPolygonSymbolizer();
Style style = sb.createStyle(ps);
Rule rule = style.featureTypeStyles().get(0).rules().get(0);
rule.setFilter(ff.bbox("geom", 1, 1, 4, 4, "EPSG:4326"));
content.addLayer(new FeatureLayer(squareFS, style));
RendererBaseTest.showRender("Spatial with default CRS", renderer, TIME, bounds);
assertEquals(2, renderedIds.size());
}
代码示例来源:origin: geotools/geotools
@Test
public void testPreserveOriginalSRS() throws NoSuchAuthorityCodeException, FactoryException {
String srs = "AUTO:42004,9001,0,33";
CoordinateReferenceSystem crs = CRS.decode(srs);
BBOX bbox = ff.bbox(ff.property(""), 0, 1000, 2000, 3000, srs);
Geometry geom = bbox.getExpression2().evaluate(null, Geometry.class);
assertEquals(crs, geom.getUserData());
assertEquals(srs, bbox.getSRS());
}
}
代码示例来源:origin: geotools/geotools
public void testBboxFilter() throws Exception {
if (!isGeographySupportAvailable()) {
return;
}
// should match only "r2"
BBOX bbox = ff.bbox(aname("geo"), -120, 25, -100, 40, "EPSG:4326");
FeatureCollection features =
dataStore.getFeatureSource(tname("geopoint")).getFeatures(bbox);
assertEquals(2, features.size());
}
代码示例来源:origin: geotools/geotools
@Test
public void testOr() {
Filter f =
ff.or(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.equals(ff.property("att"), ff.literal("10")));
Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(infinity, env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndIsNull() throws Exception {
final Filter f =
ff.and(ff.bbox("geom", -10, -10, 10, 10, null), ff.isNull(ff.literal("someDate")));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndIsNil() throws Exception {
final Filter f =
ff.and(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.isNil(ff.literal("someDate"), null));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
}
代码示例来源:origin: geotools/geotools
@Test
public void testAnd() {
Filter f =
ff.and(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.equals(ff.property("att"), ff.literal("10")));
Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndTemporalDuring() throws Exception {
final Period p = period("2016-01-01T00:00:00.000-0500", "2106-01-02T00:00:00.000-0500");
final Filter f =
ff.and(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.during(ff.literal("someDate"), ff.literal(p)));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndTemporalEnds() throws Exception {
final Instant start = instant("2016-01-01T00:00:00.000-0500");
final Filter f =
ff.and(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.ends(ff.literal("someDate"), ff.literal(start)));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndTemporalTOverlaps() throws Exception {
final Period p = period("2016-01-01T00:00:00.000-0500", "2106-01-02T00:00:00.000-0500");
final Filter f =
ff.and(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.toverlaps(ff.literal("someDate"), ff.literal(p)));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndTemporalMetBy() throws Exception {
final Period p = period("2016-01-01T00:00:00.000-0500", "2106-01-02T00:00:00.000-0500");
final Filter f =
ff.and(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.metBy(ff.literal("someDate"), ff.literal(p)));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndTemporalBefore() throws Exception {
final Instant start = instant("2016-01-01T00:00:00.000-0500");
final Filter f =
ff.and(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.before(ff.literal("someDate"), ff.literal(start)));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndTemporalMeets() throws Exception {
final Period p = period("2016-01-01T00:00:00.000-0500", "2106-01-02T00:00:00.000-0500");
final Filter f =
ff.and(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.meets(ff.literal("someDate"), ff.literal(p)));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndTemporalOverlappedBy() throws Exception {
final Period p = period("2016-01-01T00:00:00.000-0500", "2106-01-02T00:00:00.000-0500");
final Filter f =
ff.and(
ff.bbox("geom", -10, -10, 10, 10, null),
ff.overlappedBy(ff.literal("someDate"), ff.literal(p)));
final Envelope env = (Envelope) f.accept(visitor, null);
assertEquals(new Envelope(-10, 10, -10, 10), env);
}
代码示例来源:origin: geotools/geotools
@Test
public void testAndDWithin() {
Point geom = new GeometryFactory().createPoint(new Coordinate(0, 0));
Filter filter = ff.dwithin(ff.property("geom"), ff.literal(geom), 100, "metre");
filter = ff.and(filter, ff.bbox(ff.property("geom"), 50, 50, 150, 150, null));
Envelope env = (Envelope) filter.accept(visitor, null);
assertEquals(new Envelope(50, 100, 50, 100), env);
}
内容来源于网络,如有侵权,请联系作者删除!