本文整理汇总了Java中org.opengis.filter.spatial.BBOX类的典型用法代码示例。如果您正苦于以下问题:Java BBOX类的具体用法?Java BBOX怎么用?Java BBOX使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
BBOX类属于org.opengis.filter.spatial包,在下文中一共展示了BBOX类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: execute
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@DescribeResult(name = "result", description = "Clipped feature collection")
public SimpleFeatureCollection execute(
@DescribeParameter(name = "features", description = "Input feature collection") SimpleFeatureCollection features,
@DescribeParameter(name = "clip", description = "Geometry to use for clipping (in same CRS as input features)") Geometry clip,
@DescribeParameter(name = "preserveZ", min=0,description = "Attempt to preserve Z values from the original geometry (interpolate value for new points)") Boolean preserveZ)
throws ProcessException {
// only get the geometries in the bbox of the clip
Envelope box = clip.getEnvelopeInternal();
String srs = null;
if(features.getSchema().getCoordinateReferenceSystem() != null) {
srs = CRS.toSRS(features.getSchema().getCoordinateReferenceSystem());
}
BBOX bboxFilter = ff.bbox("", box.getMinX(), box.getMinY(), box.getMaxX(), box.getMaxY(), srs);
// default value for preserve Z
if(preserveZ == null) {
preserveZ = false;
}
// return dynamic collection clipping geometries on the fly
return new ClippingFeatureCollection(features.subCollection(bboxFilter), clip, preserveZ);
}
开发者ID:ec-europa,项目名称:sumo,代码行数:23,代码来源:ClipProcess.java
示例2: testAlternateGeometry
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testAlternateGeometry() throws Exception {
init("active", "geo2");
SimpleFeatureType schema = featureSource.getSchema();
GeometryDescriptor gd = schema.getGeometryDescriptor();
assertNotNull(gd);
assertEquals("geo2", gd.getLocalName());
FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
BBOX bbox = ff.bbox("geo2", 6.5, 23.5, 7.5, 24.5, "EPSG:4326");
SimpleFeatureCollection features = featureSource.getFeatures(bbox);
assertEquals(1, features.size());
SimpleFeatureIterator fsi = features.features();
assertTrue(fsi.hasNext());
assertEquals(fsi.next().getID(), "active.09");
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:17,代码来源:ElasticGeometryFilterIT.java
示例3: testOgrStyleGeoPoint
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testOgrStyleGeoPoint() throws Exception {
init("not-active","geo4.coordinates");
FilterFactory2 ff = (FilterFactory2) dataStore.getFilterFactory();
BBOX bbox = ff.bbox("geo4.coordinates", 0, 0, 5, 5, "EPSG:4326");
assertNotNull(featureSource.getSchema().getDescriptor("geo4.coordinates"));
assertNull(featureSource.getSchema().getDescriptor("geo4.type"));
SimpleFeatureCollection features = featureSource.getFeatures(bbox);
assertEquals(1, features.size());
SimpleFeatureIterator fsi = features.features();
assertTrue(fsi.hasNext());
SimpleFeature feature = fsi.next();
assertEquals(feature.getID(), "active.13");
assertNotNull(feature.getDefaultGeometry());
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:17,代码来源:ElasticGeometryFilterIT.java
示例4: testGeoShapeBboxFilter
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testGeoShapeBboxFilter() throws ParseException, IOException {
BBOX filter = ff.bbox("geom", 0., 0., 1.1, 1.1, "EPSG:4326");
List<List<Double>> coords = new ArrayList<>();
coords.add(ImmutableList.of(0.,0.));
coords.add(ImmutableList.of(0.,1.1));
coords.add(ImmutableList.of(1.1,1.1));
coords.add(ImmutableList.of(1.1,0.));
coords.add(ImmutableList.of(0.,0.));
Map<String,Object> expected = ImmutableMap.of("bool",
ImmutableMap.of("must", MATCH_ALL, "filter", ImmutableMap.of("geo_shape",
ImmutableMap.of("geom", ImmutableMap.of("shape",
ImmutableMap.of("coordinates", ImmutableList.of(coords), "type", "Polygon"),
"relation", "INTERSECTS")))));
builder.visit(filter, null);
assertTrue(builder.createFilterCapabilities().fullySupports(filter));
assertEquals(expected.toString(), builder.getQueryBuilder().toString());
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:20,代码来源:ElasticFilterTest.java
示例5: testFilters
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@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());
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:18,代码来源:StyleConverterServiceTest.java
示例6: visitGeoShapeBinarySpatialOperator
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
void visitGeoShapeBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2,
boolean swapped, Object extraData) {
if (filter instanceof Disjoint) {
shapeRelation = SpatialRelation.DISJOINT;
} else if ((!swapped && filter instanceof Within) || (swapped && filter instanceof Contains)) {
shapeRelation = SpatialRelation.WITHIN;
} else if (filter instanceof Intersects || filter instanceof BBOX) {
shapeRelation = SpatialRelation.INTERSECTS;
} else {
FilterToElastic.LOGGER.fine(filter.getClass().getSimpleName()
+ " is unsupported for geo_shape types");
shapeRelation = null;
delegate.fullySupported = false;
}
if (shapeRelation != null) {
e1.accept(delegate, extraData);
key = (String) delegate.field;
e2.accept(delegate, extraData);
shapeBuilder = delegate.currentShapeBuilder;
}
if (shapeRelation != null && shapeBuilder != null) {
delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must", MATCH_ALL,
"filter", ImmutableMap.of("geo_shape",
ImmutableMap.of(key, ImmutableMap.of("shape", shapeBuilder, "relation", shapeRelation)))));
} else {
delegate.queryBuilder = MATCH_ALL;
}
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:32,代码来源:FilterToElasticHelper.java
示例7: createFilterCapabilities
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
/**
* Sets the capabilities of this filter.
*
* @return FilterCapabilities for this Filter
*/
protected FilterCapabilities createFilterCapabilities() {
FilterCapabilities capabilities = new FilterCapabilities();
capabilities.addAll(FilterCapabilities.LOGICAL_OPENGIS);
capabilities.addAll(FilterCapabilities.SIMPLE_COMPARISONS_OPENGIS);
capabilities.addType(PropertyIsNull.class);
capabilities.addType(PropertyIsBetween.class);
capabilities.addType(Id.class);
capabilities.addType(IncludeFilter.class);
capabilities.addType(ExcludeFilter.class);
capabilities.addType(PropertyIsLike.class);
// spatial filters
capabilities.addType(BBOX.class);
capabilities.addType(Contains.class);
//capabilities.addType(Crosses.class);
capabilities.addType(Disjoint.class);
//capabilities.addType(Equals.class);
capabilities.addType(Intersects.class);
//capabilities.addType(Overlaps.class);
//capabilities.addType(Touches.class);
capabilities.addType(Within.class);
capabilities.addType(DWithin.class);
capabilities.addType(Beyond.class);
//temporal filters
capabilities.addType(After.class);
capabilities.addType(Before.class);
capabilities.addType(Begins.class);
capabilities.addType(BegunBy.class);
capabilities.addType(During.class);
capabilities.addType(Ends.class);
capabilities.addType(EndedBy.class);
capabilities.addType(TContains.class);
capabilities.addType(TEquals.class);
return capabilities;
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:44,代码来源:FilterToElastic.java
示例8: testBBOXFilter
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testBBOXFilter() throws Exception {
init();
FilterFactory ff = dataStore.getFilterFactory();
BBOX bbox = ff.bbox("geo", -180, -98, 180, 98, "EPSG:" + SOURCE_SRID);
SimpleFeatureCollection features = featureSource.getFeatures(bbox);
assertEquals(11, features.size());
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:9,代码来源:ElasticGeometryFilterIT.java
示例9: testBBOXAndEqualsFilter
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testBBOXAndEqualsFilter() throws Exception {
init();
FilterFactory ff = dataStore.getFilterFactory();
PropertyIsEqualTo property = ff.equals(ff.property("standard_ss"),
ff.literal("IEEE 802.11b"));
BBOX bbox = ff.bbox("geo", -180, -180, 180, 180, "EPSG:" + SOURCE_SRID);
And filter = ff.and(property, bbox);
SimpleFeatureCollection features = featureSource.getFeatures(filter);
assertEquals(7, features.size());
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:12,代码来源:ElasticGeometryFilterIT.java
示例10: testBBOXCoveringDateline
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testBBOXCoveringDateline() throws Exception {
init("not-active","geo");
FilterFactory ff = dataStore.getFilterFactory();
BBOX bbox = ff.bbox("geo", 178, -98, 182, 98, "EPSG:" + SOURCE_SRID);
SimpleFeatureCollection features = featureSource.getFeatures(bbox);
assertEquals(2, features.size());
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:9,代码来源:ElasticGeometryFilterIT.java
示例11: testBBOXBeyondDateline
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testBBOXBeyondDateline() throws Exception {
init("not-active","geo");
FilterFactory ff = dataStore.getFilterFactory();
BBOX bbox = ff.bbox("geo", 180.5, -98, 182, 98, "EPSG:" + SOURCE_SRID);
SimpleFeatureCollection features = featureSource.getFeatures(bbox);
assertEquals(1, features.size());
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:9,代码来源:ElasticGeometryFilterIT.java
示例12: testNullBinarySpatialOperatorFilter
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testNullBinarySpatialOperatorFilter() {
boolean success = false;
try {
builder.visit((BBOX) null, null);
} catch (NullPointerException e) {
success = true;
}
assertTrue(success);
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:11,代码来源:ElasticFilterTest.java
示例13: testGeoPointBboxFilter
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testGeoPointBboxFilter() {
BBOX filter = ff.bbox("geo_point", 0., 0., 1., 1., "EPSG:4326");
Map<String,Object> expected = ImmutableMap.of("bool",
ImmutableMap.of("must", MATCH_ALL, "filter", ImmutableMap.of("geo_bounding_box",
ImmutableMap.of("geo_point", ImmutableMap.of("top_left", ImmutableList.of(0.,1.) ,
"bottom_right", ImmutableList.of(1.,0.))))));
builder.visit(filter, null);
assertTrue(builder.createFilterCapabilities().fullySupports(filter));
assertEquals(expected, builder.getQueryBuilder());
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:13,代码来源:ElasticFilterTest.java
示例14: testGetFeaturesWithAndLogicFilter
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Test
public void testGetFeaturesWithAndLogicFilter() throws Exception {
init();
FilterFactory ff = dataStore.getFilterFactory();
PropertyIsEqualTo property = ff.equals(ff.property("standard_ss"),
ff.literal("IEEE 802.11b"));
BBOX bbox = ff.bbox("geo", -1, -1, 10, 10, "EPSG:" + SOURCE_SRID);
And filter = ff.and(property, bbox);
SimpleFeatureCollection features = featureSource.getFeatures(filter);
assertEquals(3, features.size());
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:12,代码来源:ElasticFeatureFilterIT.java
示例15: visit
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@SuppressWarnings("deprecation")
@Override
public Object visit(
final BBOX filter,
final Object data ) {
final Geometry bbox = bbox(data);
// consider doing reprojection here into data CRS?
final Envelope bounds = new Envelope(
filter.getMinX(),
filter.getMaxX(),
filter.getMinY(),
filter.getMaxY());
if (this.attributeOfInterest.equals(filter.getExpression1().toString())) {
if (bbox != null) {
return bbox.union(new GeometryFactory().toGeometry(bounds));
}
else {
return new ExtractGeometryFilterVisitorResult(
bbox(bounds),
CompareOperation.INTERSECTS);
}
}
else {
return new ExtractGeometryFilterVisitorResult(
infinity(),
null);
}
}
开发者ID:locationtech,项目名称:geowave,代码行数:31,代码来源:ExtractGeometryFilterVisitor.java
示例16: visit
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Override
public Object visit(
final BBOX filter,
final Object extraData ) {
if (!usesProperty(filter)) {
return Filter.INCLUDE;
}
return super.visit(
filter,
extraData);
}
开发者ID:locationtech,项目名称:geowave,代码行数:12,代码来源:PropertyIgnoringFilterVisitor.java
示例17: visitBinarySpatialOperator
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
void visitBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2,
boolean swapped, Object extraData) throws IOException {
String closingParenthesis = ")";
if (filter instanceof Equals) {
out.write("Equals");
} else if (filter instanceof Disjoint) {
out.write("NOT (\"Intersect\"");
closingParenthesis += ")";
} else if (filter instanceof Intersects || filter instanceof BBOX) {
out.write("\"Intersect\"");
} else if (filter instanceof Crosses) {
out.write("Crosses");
} else if (filter instanceof Within) {
if(swapped)
out.write("Contains");
else
out.write("Within");
} else if (filter instanceof Contains) {
if(swapped)
out.write("Within");
else
out.write("Contains");
} else if (filter instanceof Overlaps) {
out.write("Overlaps");
} else if (filter instanceof Touches) {
out.write("Touches");
} else {
throw new RuntimeException("Unsupported filter type " + filter.getClass());
}
out.write("(");
e1.accept(delegate, extraData);
out.write(", ");
e2.accept(delegate, extraData);
out.write(closingParenthesis);
}
开发者ID:DennisPallett,项目名称:gt-jdbc-monetdb,代码行数:39,代码来源:FilterToSqlHelper.java
示例18: visit
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
/** {@inheritDoc} */
@Override
public Object visit(BBOX filter, Object userData) {
Envelope env = new Envelope(filter.getMinX(), filter.getMaxX(), filter.getMinY(), filter.getMaxY());
String finalName = parsePropertyName(geomName, userData);
return SpatialRestrictions.filter(finalName, env, srid);
}
开发者ID:geomajas,项目名称:geomajas-project-server,代码行数:8,代码来源:CriteriaVisitor.java
示例19: visit
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
@Override
public Object visit(BBOX filter, Object extraData) {
geometryPropertyName = filter.getPropertyName();
return Filter.INCLUDE;
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:6,代码来源:BBOXRemovingFilterVisitor.java
示例20: visitGeoPointBinarySpatialOperator
import org.opengis.filter.spatial.BBOX; //导入依赖的package包/类
void visitGeoPointBinarySpatialOperator(BinarySpatialOperator filter, Expression e1, Expression e2,
boolean swapped, Object extraData) {
e1.accept(delegate, extraData);
key = (String) delegate.field;
e2.accept(delegate, extraData);
final Geometry geometry = delegate.currentGeometry;
if (geometry instanceof Polygon &&
((!swapped && filter instanceof Within)
|| (swapped && filter instanceof Contains)
|| filter instanceof Intersects)) {
final Polygon polygon = (Polygon) geometry;
final List<List<Double>> points = new ArrayList<>();
for (final Coordinate coordinate : polygon.getCoordinates()) {
points.add(ImmutableList.of(coordinate.x, coordinate.y));
}
delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must", MATCH_ALL,
"filter", ImmutableMap.of("geo_polygon",
ImmutableMap.of(key, ImmutableMap.of("points", points)))));
} else if (filter instanceof BBOX) {
final Envelope envelope = geometry.getEnvelopeInternal();
final double minY = clipLat(envelope.getMinY());
final double maxY = clipLat(envelope.getMaxY());
final double minX, maxX;
if (envelope.getWidth() < 360) {
minX = clipLon(envelope.getMinX());
maxX = clipLon(envelope.getMaxX());
} else {
minX = -180;
maxX = 180;
}
delegate.queryBuilder = ImmutableMap.of("bool", ImmutableMap.of("must", MATCH_ALL,
"filter", ImmutableMap.of("geo_bounding_box", ImmutableMap.of(key,
ImmutableMap.of("top_left", ImmutableList.of(minX, maxY),
"bottom_right", ImmutableList.of(maxX, minY))))));
} else {
FilterToElastic.LOGGER.fine(filter.getClass().getSimpleName()
+ " is unsupported for geo_point types");
delegate.fullySupported = false;
delegate.queryBuilder = MATCH_ALL;
}
}
开发者ID:ngageoint,项目名称:elasticgeo,代码行数:45,代码来源:FilterToElasticHelper.java
注:本文中的org.opengis.filter.spatial.BBOX类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论