Search in sources :

Example 1 with SpaceFillingCurveSettings

use of org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings in project neo4j by neo4j.

the class EntityValueIndexCursorTestBase method assertSameDerivedValue.

protected void assertSameDerivedValue(PointValue p1, PointValue p2) {
    ConfiguredSpaceFillingCurveSettingsCache settingsFactory = new ConfiguredSpaceFillingCurveSettingsCache(Config.defaults());
    SpaceFillingCurveSettings spaceFillingCurveSettings = settingsFactory.forCRS(CoordinateReferenceSystem.WGS84);
    SpaceFillingCurve curve = spaceFillingCurveSettings.curve();
    assertEquals(curve.derivedValueFor(p1.coordinate()), curve.derivedValueFor(p2.coordinate()));
}
Also used : SpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings) ConfiguredSpaceFillingCurveSettingsCache(org.neo4j.kernel.impl.index.schema.config.ConfiguredSpaceFillingCurveSettingsCache) SpaceFillingCurve(org.neo4j.gis.spatial.index.curves.SpaceFillingCurve)

Example 2 with SpaceFillingCurveSettings

use of org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings in project neo4j by neo4j.

the class SpatialIndexConfigTest method mustAddSpatialConfigToMap.

@Test
void mustAddSpatialConfigToMap() {
    Map<String, Value> map = new HashMap<>();
    for (CoordinateReferenceSystem crs : CoordinateReferenceSystem.all()) {
        Config config = Config.defaults();
        SpaceFillingCurveSettings spaceFillingCurveSettings = new ConfiguredSpaceFillingCurveSettingsCache(config).forCRS(crs);
        SpatialIndexConfig.addSpatialConfig(map, crs, spaceFillingCurveSettings);
        assertNotNull(map.remove(IndexSettingUtil.spatialMinSettingForCrs(crs).getSettingName()));
        assertNotNull(map.remove(IndexSettingUtil.spatialMaxSettingForCrs(crs).getSettingName()));
        assertTrue(map.isEmpty());
    }
}
Also used : HashMap(java.util.HashMap) SpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings) Config(org.neo4j.configuration.Config) IndexConfig(org.neo4j.internal.schema.IndexConfig) ConfiguredSpaceFillingCurveSettingsCache(org.neo4j.kernel.impl.index.schema.config.ConfiguredSpaceFillingCurveSettingsCache) Value(org.neo4j.values.storable.Value) CoordinateReferenceSystem(org.neo4j.values.storable.CoordinateReferenceSystem) Test(org.junit.jupiter.api.Test)

Example 3 with SpaceFillingCurveSettings

use of org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings in project neo4j by neo4j.

the class SpatialIndexConfigTest method mustAddAndExtractSpatialConfigToIndexConfig.

@Test
void mustAddAndExtractSpatialConfigToIndexConfig() {
    IndexConfig indexConfig = IndexConfig.empty();
    Map<CoordinateReferenceSystem, SpaceFillingCurveSettings> expectedMap = new HashMap<>();
    for (CoordinateReferenceSystem crs : CoordinateReferenceSystem.all()) {
        Config config = Config.defaults();
        SpaceFillingCurveSettings spaceFillingCurveSettings = new ConfiguredSpaceFillingCurveSettingsCache(config).forCRS(crs);
        expectedMap.put(crs, spaceFillingCurveSettings);
        indexConfig = SpatialIndexConfig.addSpatialConfig(indexConfig, crs, spaceFillingCurveSettings);
    }
    Map<CoordinateReferenceSystem, SpaceFillingCurveSettings> extractedMap = SpatialIndexConfig.extractSpatialConfig(indexConfig);
    assertEquals(expectedMap, extractedMap);
}
Also used : IndexConfig(org.neo4j.internal.schema.IndexConfig) SpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings) HashMap(java.util.HashMap) Config(org.neo4j.configuration.Config) IndexConfig(org.neo4j.internal.schema.IndexConfig) ConfiguredSpaceFillingCurveSettingsCache(org.neo4j.kernel.impl.index.schema.config.ConfiguredSpaceFillingCurveSettingsCache) CoordinateReferenceSystem(org.neo4j.values.storable.CoordinateReferenceSystem) Test(org.junit.jupiter.api.Test)

Example 4 with SpaceFillingCurveSettings

use of org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings in project neo4j by neo4j.

the class GenericNativeIndexProvider method layout.

@Override
GenericLayout layout(IndexDescriptor descriptor, Path storeFile) {
    int numberOfSlots = descriptor.schema().getPropertyIds().length;
    IndexConfig indexConfig = descriptor.getIndexConfig();
    Map<CoordinateReferenceSystem, SpaceFillingCurveSettings> settings = SpatialIndexConfig.extractSpatialConfig(indexConfig);
    return new GenericLayout(numberOfSlots, new IndexSpecificSpaceFillingCurveSettings(settings));
}
Also used : IndexSpecificSpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettings) IndexConfig(org.neo4j.internal.schema.IndexConfig) IndexSpecificSpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettings) SpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings) CoordinateReferenceSystem(org.neo4j.values.storable.CoordinateReferenceSystem)

Example 5 with SpaceFillingCurveSettings

use of org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings in project neo4j by neo4j.

the class GenericNativeIndexProvider method completeSpatialConfiguration.

private IndexConfig completeSpatialConfiguration(IndexConfig indexConfig) {
    for (CoordinateReferenceSystem crs : CoordinateReferenceSystem.all()) {
        SpaceFillingCurveSettings spaceFillingCurveSettings = configuredSettings.forCRS(crs);
        indexConfig = SpatialIndexConfig.addSpatialConfig(indexConfig, crs, spaceFillingCurveSettings);
    }
    return indexConfig;
}
Also used : IndexSpecificSpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettings) SpaceFillingCurveSettings(org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings) CoordinateReferenceSystem(org.neo4j.values.storable.CoordinateReferenceSystem)

Aggregations

SpaceFillingCurveSettings (org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings)6 CoordinateReferenceSystem (org.neo4j.values.storable.CoordinateReferenceSystem)4 IndexConfig (org.neo4j.internal.schema.IndexConfig)3 ConfiguredSpaceFillingCurveSettingsCache (org.neo4j.kernel.impl.index.schema.config.ConfiguredSpaceFillingCurveSettingsCache)3 HashMap (java.util.HashMap)2 Test (org.junit.jupiter.api.Test)2 Config (org.neo4j.configuration.Config)2 IndexSpecificSpaceFillingCurveSettings (org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettings)2 Envelope (org.neo4j.gis.spatial.index.Envelope)1 SpaceFillingCurve (org.neo4j.gis.spatial.index.curves.SpaceFillingCurve)1 Value (org.neo4j.values.storable.Value)1