Search in sources :

Example 1 with IndexModelBuilder

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);
    }
}
Also used : IndexModelBuilder(org.locationtech.geowave.analytic.model.IndexModelBuilder) SpatialIndexModelBuilder(org.locationtech.geowave.analytic.model.SpatialIndexModelBuilder) IOException(java.io.IOException) CommonIndexModel(org.locationtech.geowave.core.store.index.CommonIndexModel)

Aggregations

IOException (java.io.IOException)1 IndexModelBuilder (org.locationtech.geowave.analytic.model.IndexModelBuilder)1 SpatialIndexModelBuilder (org.locationtech.geowave.analytic.model.SpatialIndexModelBuilder)1 CommonIndexModel (org.locationtech.geowave.core.store.index.CommonIndexModel)1