public static HierarchicalNumericIndexStrategy findHierarchicalStrategy( final NumericIndexStrategy indexStrategy) { final List<CompoundIndexStrategy> parentStrategies = new ArrayList<CompoundIndexStrategy>(); final HierarchicalNumericIndexStrategy firstHierarchicalStrategy = findHierarchicalStrategy(indexStrategy, parentStrategies); if (firstHierarchicalStrategy == null) { return null; } else if (parentStrategies.isEmpty()) { return firstHierarchicalStrategy; } else { return new CompoundHierarchicalIndexStrategyWrapper( parentStrategies, firstHierarchicalStrategy); } }
@Override public void fromBinary(final byte[] bytes) { final CompoundIndexStrategy rootStrategy = (CompoundIndexStrategy) PersistenceUtils.fromBinary(bytes); parentStrategies = new ArrayList<CompoundIndexStrategy>(); // discover hierarchy firstHierarchicalStrategy = findHierarchicalStrategy(rootStrategy, parentStrategies); }
public static HierarchicalNumericIndexStrategy findHierarchicalStrategy( final NumericIndexStrategy indexStrategy, final List<CompoundIndexStrategy> parentStrategies) { if (indexStrategy instanceof HierarchicalNumericIndexStrategy) { return (HierarchicalNumericIndexStrategy) indexStrategy; } if (indexStrategy instanceof CompoundIndexStrategy) { final PartitionIndexStrategy<MultiDimensionalNumericData, MultiDimensionalNumericData> primaryIndex = ((CompoundIndexStrategy) indexStrategy).getPrimarySubStrategy(); final NumericIndexStrategy secondaryIndex = ((CompoundIndexStrategy) indexStrategy).getSecondarySubStrategy(); // warn if round robin is used if (primaryIndex instanceof RoundRobinKeyIndexStrategy) { LOGGER.warn("Round Robin partitioning won't work correctly with raster merge strategies"); } else if (secondaryIndex instanceof RoundRobinKeyIndexStrategy) { LOGGER.warn("Round Robin partitioning won't work correctly with raster merge strategies"); } final HierarchicalNumericIndexStrategy secondary = findHierarchicalStrategy(secondaryIndex); if (secondary != null) { // add it to beginning because we are recursing back from the // leaf strategy up to the parent parentStrategies.add(0, (CompoundIndexStrategy) indexStrategy); return secondary; } } return null; }
CompoundHierarchicalIndexStrategyWrapper.findHierarchicalStrategy(indexStrategy); if (strategy != null) { final TreeMap<Double, SubStrategy> sortedStrategies = new TreeMap<>();
@Override public Iterator<GridCoverage> convertToIndex(final Index index, final GridCoverage gridCoverage) { final HierarchicalNumericIndexStrategy indexStrategy = CompoundHierarchicalIndexStrategyWrapper.findHierarchicalStrategy(index.getIndexStrategy()); if (indexStrategy != null) { final CoordinateReferenceSystem sourceCrs = gridCoverage.getCoordinateReferenceSystem();