@Test public void testGetBBOX() { final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap = new HashMap<>(); final FeatureBoundingBoxStatistics geoStats = new FeatureBoundingBoxStatistics("geometry"); statsMap.put( VectorStatisticsQueryBuilder.newBuilder().factory().bbox().fieldName( "geometry").build().getId(), geoStats); final SimpleFeature firstFeature = createGeoFeature(factory.createPoint(new Coordinate(22.25, 42.25))); geoStats.entryIngested(firstFeature); final SimpleFeature secondFeature = createGeoFeature(factory.createPoint(new Coordinate(27.25, 41.25))); geoStats.entryIngested(secondFeature); final Envelope bounds = new Envelope(21.23, 26.23, 41.75, 43.1); final Geometry bbox = QueryIndexHelper.clipIndexedBBOXConstraints( geoType, new GeometryFactory().toGeometry(bounds), statsMap); final Envelope env = bbox.getEnvelopeInternal(); assertEquals(22.25, env.getMinX(), 0.0001); assertEquals(26.23, env.getMaxX(), 0.0001); assertEquals(41.75, env.getMinY(), 0.0001); assertEquals(42.25, env.getMaxY(), 0.0001); }
public static Geometry clipIndexedBBOXConstraints( final SimpleFeatureType featureType, final Geometry bbox, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap) { final String geoAttrName = featureType.getGeometryDescriptor().getLocalName(); final StatisticsId statId = VectorStatisticsQueryBuilder.newBuilder().factory().bbox().fieldName( geoAttrName).build().getId(); final BoundingBoxDataStatistics bboxStats = (BoundingBoxDataStatistics) statsMap.get(statId); if ((bboxStats != null) && bboxStats.isSet() && (bbox != null)) { final Geometry geo = new GeometryFactory().toGeometry(bboxStats.getResult()); return geo.intersection(bbox); } return bbox; }
QueryIndexHelper { public static Geometry clipIndexedBBOXConstraints( final SimpleFeatureType featureType, final Geometry bbox, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap) { final String geoAttrName = featureType.getGeometryDescriptor().getLocalName(); final StatisticsId statId = VectorStatisticsQueryBuilder.newBuilder().factory().bbox().fieldName( geoAttrName).build().getId(); final BoundingBoxDataStatistics bboxStats = (BoundingBoxDataStatistics) statsMap.get(statId); if ((bboxStats != null) && bboxStats.isSet() && (bbox != null)) { final Geometry geo = new GeometryFactory().toGeometry(bboxStats.getResult()); return geo.intersection(bbox); } return bbox; } }
QueryIndexHelper { public static Geometry clipIndexedBBOXConstraints( final SimpleFeatureType featureType, final Geometry bbox, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap) { final String geoAttrName = featureType.getGeometryDescriptor().getLocalName(); final StatisticsId statId = VectorStatisticsQueryBuilder.newBuilder().factory().bbox().fieldName( geoAttrName).build().getId(); final BoundingBoxDataStatistics bboxStats = (BoundingBoxDataStatistics) statsMap.get(statId); if ((bboxStats != null) && bboxStats.isSet() && (bbox != null)) { final Geometry geo = new GeometryFactory().toGeometry(bboxStats.getResult()); return geo.intersection(bbox); } return bbox; }  }
QueryIndexHelper { public static Geometry clipIndexedBBOXConstraints( final SimpleFeatureType featureType, final Geometry bbox, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap) { final String geoAttrName = featureType.getGeometryDescriptor().getLocalName(); final StatisticsId statId = VectorStatisticsQueryBuilder.newBuilder().factory().bbox().fieldName( geoAttrName).build().getId(); final BoundingBoxDataStatistics bboxStats = (BoundingBoxDataStatistics) statsMap.get(statId); if ((bboxStats != null) && bboxStats.isSet() && (bbox != null)) { final Geometry geo = new GeometryFactory().toGeometry(bboxStats.getResult()); return geo.intersection(bbox); } return bbox; }  static TemporalConstraintsSet clipIndexedTemporalConstraints(
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final TimeDescriptors timeDescriptors,
      final TemporalConstraintsSet constraintsSet); static Geometry clipIndexedBBOXConstraints(
      final SimpleFeatureType featureType,
      final Geometry bbox,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap); static ConstraintSet getTimeConstraintsFromIndex(
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> stats); static ConstraintSet getBBOXIndexConstraintsFromIndex(
      final SimpleFeatureType featureType,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap); static ConstraintsByClass composeTimeConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final TemporalConstraintsSet timeBoundsSet); static ConstraintsByClass composeTimeBoundedConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final TemporalConstraintsSet timeBoundsSet); static GeoConstraintsWrapper composeGeometricConstraints(
      final SimpleFeatureType featureType,
      final Geometry jtsBounds); static ConstraintsByClass composeConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final Geometry jtsBounds,
      final TemporalConstraintsSet timeBoundsSet); }
QueryIndexHelper { public static Geometry clipIndexedBBOXConstraints( final SimpleFeatureType featureType, final Geometry bbox, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap) { final String geoAttrName = featureType.getGeometryDescriptor().getLocalName(); final StatisticsId statId = VectorStatisticsQueryBuilder.newBuilder().factory().bbox().fieldName( geoAttrName).build().getId(); final BoundingBoxDataStatistics bboxStats = (BoundingBoxDataStatistics) statsMap.get(statId); if ((bboxStats != null) && bboxStats.isSet() && (bbox != null)) { final Geometry geo = new GeometryFactory().toGeometry(bboxStats.getResult()); return geo.intersection(bbox); } return bbox; }  static TemporalConstraintsSet clipIndexedTemporalConstraints(
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final TimeDescriptors timeDescriptors,
      final TemporalConstraintsSet constraintsSet); static Geometry clipIndexedBBOXConstraints(
      final SimpleFeatureType featureType,
      final Geometry bbox,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap); static ConstraintSet getTimeConstraintsFromIndex(
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> stats); static ConstraintSet getBBOXIndexConstraintsFromIndex(
      final SimpleFeatureType featureType,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap); static ConstraintsByClass composeTimeConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final TemporalConstraintsSet timeBoundsSet); static ConstraintsByClass composeTimeBoundedConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final TemporalConstraintsSet timeBoundsSet); static GeoConstraintsWrapper composeGeometricConstraints(
      final SimpleFeatureType featureType,
      final Geometry jtsBounds); static ConstraintsByClass composeConstraints(
      final SimpleFeatureType featureType,
      final TimeDescriptors timeDescriptors,
      final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap,
      final Geometry jtsBounds,
      final TemporalConstraintsSet timeBoundsSet);  }