GeometryUtils.basicGeoConstraintsWrapperFromGeometry(geometry); Constraints constraints = geoConstraints.getConstraints(); final CompareOperation extractedCompareOp = geometryAndCompareOp.getCompareOp(); if ((timeConstraintSet != null) && !timeConstraintSet.isEmpty()) { constraints = geoConstraints.getConstraints().merge(timeConstraints);
/** * If composed constraints matched statistics constraints, are empty or null, then return empty * constraint set * * @param featureType * @param timeDescriptors * @param statsMap * @param timeBoundsSet * @return */ public static GeoConstraintsWrapper composeGeometricConstraints( final SimpleFeatureType featureType, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final Geometry jtsBounds) { if (jtsBounds == null) { return new GeoConstraintsWrapper(new Constraints(), true, null); } final GeoConstraintsWrapper geoConstraints = GeometryUtils.basicGeoConstraintsWrapperFromGeometry(jtsBounds); final Constraints statsConstraints = new Constraints(getBBOXIndexConstraintsFromIndex(featureType, statsMap)); if (geoConstraints.getConstraints().matches(statsConstraints)) { return new GeoConstraintsWrapper( new Constraints(), geoConstraints.isConstraintsMatchGeometry(), jtsBounds); } return geoConstraints; }
private BasicQuery composeQuery( final GeoConstraintsWrapper geoConstraints, final Constraints temporalConstraints) { // TODO: this actually doesn't boost performance much, if at // all, and one key is missing - the query geometry has to be // topologically equivalent to its envelope and the ingested // geometry has to be topologically equivalent to its envelope // this could be kept as a statistic on ingest, but considering // it doesn't boost performance it may not be worthwhile // pursuing // if (geoConstraints.isConstraintsMatchGeometry()) { // return new BasicQuery( // geoConstraints.getConstraints().merge( // temporalConstraints)); // } // else { return new ExplicitSpatialQuery( geoConstraints.getConstraints().merge(temporalConstraints), geoConstraints.getGeometry(), GeometryUtils.getCrsCode( components.getAdapter().getFeatureType().getCoordinateReferenceSystem())); // } }
/** * Compose a query from the set of constraints. When the provided constraints do not fulfill the * indexed dimensions, compose constraints from statistics. * * @param featureType * @param timeDescriptors * @param statsMap * @param jtsBounds * @param timeBoundsSet * @return */ public static Constraints composeConstraints( final SimpleFeatureType featureType, final TimeDescriptors timeDescriptors, final Map<StatisticsId, InternalDataStatistics<SimpleFeature, ?, ?>> statsMap, final Geometry jtsBounds, final TemporalConstraintsSet timeBoundsSet) { final Constraints timeConstraints = composeTimeConstraints(featureType, timeDescriptors, statsMap, timeBoundsSet); final GeoConstraintsWrapper geoConstraints = composeGeometricConstraints(featureType, statsMap, jtsBounds); return timeConstraints.merge(geoConstraints.getConstraints()); } }