Search in sources :

Example 1 with ConfiguredSpaceFillingCurveSettingsCache

use of org.neo4j.kernel.impl.index.schema.config.ConfiguredSpaceFillingCurveSettingsCache 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 ConfiguredSpaceFillingCurveSettingsCache

use of org.neo4j.kernel.impl.index.schema.config.ConfiguredSpaceFillingCurveSettingsCache 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 ConfiguredSpaceFillingCurveSettingsCache

use of org.neo4j.kernel.impl.index.schema.config.ConfiguredSpaceFillingCurveSettingsCache 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)

Aggregations

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