use of org.locationtech.geowave.analytic.model.IndexModelBuilder in project geowave by locationtech.
the class AbstractPartitioner method initialize.
public void initialize(final ScopedJobConfiguration config) throws IOException {
distancePerDimension = getDistances(config);
this.precisionFactor = config.getDouble(Partition.PARTITION_PRECISION, 1.0);
if ((precisionFactor < 0) || (precisionFactor > 1.0)) {
throw new IllegalArgumentException(String.format("Precision value must be between 0 and 1: %.6f", precisionFactor));
}
try {
final IndexModelBuilder builder = config.getInstance(CommonParameters.Common.INDEX_MODEL_BUILDER_CLASS, IndexModelBuilder.class, SpatialIndexModelBuilder.class);
final CommonIndexModel model = builder.buildModel();
if (model.getDimensions().length > distancePerDimension.length) {
final double[] newDistancePerDimension = new double[model.getDimensions().length];
for (int j = 0; j < newDistancePerDimension.length; j++) {
newDistancePerDimension[j] = distancePerDimension[j < distancePerDimension.length ? j : (distancePerDimension.length - 1)];
}
distancePerDimension = newDistancePerDimension;
}
this.initIndex(model, distancePerDimension);
} catch (InstantiationException | IllegalAccessException e) {
throw new IOException(e);
}
}
Aggregations