Search in sources :

Example 6 with CoordinateReferenceSystem

use of org.neo4j.values.storable.CoordinateReferenceSystem 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 7 with CoordinateReferenceSystem

use of org.neo4j.values.storable.CoordinateReferenceSystem 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 8 with CoordinateReferenceSystem

use of org.neo4j.values.storable.CoordinateReferenceSystem 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)

Example 9 with CoordinateReferenceSystem

use of org.neo4j.values.storable.CoordinateReferenceSystem in project neo4j by neo4j.

the class GeometryType method asValue.

@Override
Value asValue(GenericKey state) {
    assertHasCoordinates(state);
    CoordinateReferenceSystem crs = CoordinateReferenceSystem.get((int) state.long1, (int) state.long2);
    return asValue(state, crs, 0);
}
Also used : CoordinateReferenceSystem(org.neo4j.values.storable.CoordinateReferenceSystem)

Example 10 with CoordinateReferenceSystem

use of org.neo4j.values.storable.CoordinateReferenceSystem in project neo4j by neo4j.

the class IndexSpecificSpaceFillingCurveSettings method fromConfig.

public static IndexSpecificSpaceFillingCurveSettings fromConfig(Config config) {
    Map<CoordinateReferenceSystem, SpaceFillingCurveSettings> specificIndexConfigCache = new HashMap<>();
    ConfiguredSpaceFillingCurveSettingsCache configuredSettings = new ConfiguredSpaceFillingCurveSettingsCache(config);
    for (CoordinateReferenceSystem crs : CoordinateReferenceSystem.all()) {
        specificIndexConfigCache.put(crs, configuredSettings.forCRS(crs));
    }
    return new IndexSpecificSpaceFillingCurveSettings(specificIndexConfigCache);
}
Also used : HashMap(java.util.HashMap) CoordinateReferenceSystem(org.neo4j.values.storable.CoordinateReferenceSystem)

Aggregations

CoordinateReferenceSystem (org.neo4j.values.storable.CoordinateReferenceSystem)21 Test (org.junit.jupiter.api.Test)10 HashMap (java.util.HashMap)5 IndexConfig (org.neo4j.internal.schema.IndexConfig)5 PointValue (org.neo4j.values.storable.PointValue)5 SpaceFillingCurveSettings (org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings)4 Value (org.neo4j.values.storable.Value)4 SpaceFillingCurve (org.neo4j.gis.spatial.index.curves.SpaceFillingCurve)3 IndexDescriptor (org.neo4j.internal.schema.IndexDescriptor)3 Assertions.assertEquals (org.junit.jupiter.api.Assertions.assertEquals)2 Config (org.neo4j.configuration.Config)2 Node (org.neo4j.graphdb.Node)2 Transaction (org.neo4j.graphdb.Transaction)2 PropertyIndexQuery (org.neo4j.internal.kernel.api.PropertyIndexQuery)2 LabelSchemaDescriptor (org.neo4j.internal.schema.LabelSchemaDescriptor)2 IndexDirectoryStructure (org.neo4j.kernel.api.index.IndexDirectoryStructure)2 InternalTransaction (org.neo4j.kernel.impl.coreapi.InternalTransaction)2 ConfiguredSpaceFillingCurveSettingsCache (org.neo4j.kernel.impl.index.schema.config.ConfiguredSpaceFillingCurveSettingsCache)2 IndexSpecificSpaceFillingCurveSettings (org.neo4j.kernel.impl.index.schema.config.IndexSpecificSpaceFillingCurveSettings)2 DoubleArray (org.neo4j.values.storable.DoubleArray)2