Search in sources :

Example 21 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveTest method shouldCreateSimple3DHilbertCurveAtLevel5.

@Test
void shouldCreateSimple3DHilbertCurveAtLevel5() {
    Envelope envelope = new Envelope(new double[] { -8, -8, -8 }, new double[] { 8, 8, 8 });
    HilbertSpaceFillingCurve3D curve = new HilbertSpaceFillingCurve3D(envelope, 5);
    assertAtLevel(curve, envelope);
    assertRange(32, 0, curve, 0, 0, 0);
    assertRange(32, (long) Math.pow(8, 5) - 1, curve, 31, 0, 0);
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Example 22 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveConfigurationTest method shouldReturnMaxDepth1WithWholeSearchArea.

@Test
void shouldReturnMaxDepth1WithWholeSearchArea() {
    SpaceFillingCurveConfiguration standardConfiguration = new StandardConfiguration();
    SpaceFillingCurveConfiguration partialOverlapConf = new PartialOverlapConfiguration();
    // search area is a line, thus having a search area = 0
    Envelope range = new Envelope(-180, 180, -90, 90);
    assertThat(partialOverlapConf.maxDepth(range, range, 2, 30)).isEqualTo(1);
    assertThat(standardConfiguration.maxDepth(range, range, 2, 30)).isEqualTo(1);
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Example 23 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveConfigurationTest method shouldReturnMaxDepth2WithQuarterOfWholeArea.

@Test
void shouldReturnMaxDepth2WithQuarterOfWholeArea() {
    SpaceFillingCurveConfiguration standardConfiguration = new StandardConfiguration();
    SpaceFillingCurveConfiguration partialOverlapConf = new PartialOverlapConfiguration();
    // search area is a line, thus having a search area = 0
    Envelope range = new Envelope(-180, 180, -90, 90);
    Envelope search = new Envelope(0, 180, 0, 90);
    assertThat(partialOverlapConf.maxDepth(search, range, 2, 30)).isEqualTo(2);
    assertThat(standardConfiguration.maxDepth(search, range, 2, 30)).isEqualTo(2);
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Example 24 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveTest method shouldCreateSimple2DZOrderCurveAtLevel4.

@Test
void shouldCreateSimple2DZOrderCurveAtLevel4() {
    Envelope envelope = new Envelope(-8, 8, -8, 8);
    assertAtLevel(new ZOrderSpaceFillingCurve2D(envelope, 4), envelope);
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Example 25 with Envelope

use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.

the class SpaceFillingCurveTest method shouldGet3DSearchTilesForLevel2.

@Test
void shouldGet3DSearchTilesForLevel2() {
    Envelope envelope = new Envelope(new double[] { -8, -8, -8 }, new double[] { 8, 8, 8 });
    HilbertSpaceFillingCurve3D curve = new HilbertSpaceFillingCurve3D(envelope, 2);
    int[] mid = new int[] { 5, 14, 17, 28, 35, 46, 49, 58 };
    SpaceFillingCurve.LongRange[] midRanges = new SpaceFillingCurve.LongRange[mid.length];
    for (int i = 0; i < mid.length; i++) {
        midRanges[i] = new SpaceFillingCurve.LongRange(mid[i], mid[i]);
    }
    assertTiles(curve.getTilesIntersectingEnvelope(new Envelope(new double[] { -6, -6, -6 }, new double[] { -5, -5, -5 })), new SpaceFillingCurve.LongRange(0, 0));
    assertTiles(curve.getTilesIntersectingEnvelope(new Envelope(new double[] { 4, -6, -6 }, new double[] { 6, -5, -5 })), new SpaceFillingCurve.LongRange(63, 63));
    assertTiles(curve.getTilesIntersectingEnvelope(new Envelope(new double[] { -6, -5, -5 }, new double[] { 4, -2, -2 })), new SpaceFillingCurve.LongRange(0, 7), new SpaceFillingCurve.LongRange(56, 63));
    assertTiles(curve.getTilesIntersectingEnvelope(new Envelope(new double[] { -2, -6, -2 }, new double[] { -1, 5, -1 })), new SpaceFillingCurve.LongRange(2, 2), new SpaceFillingCurve.LongRange(5, 5), new SpaceFillingCurve.LongRange(13, 14));
    assertTiles(curve.getTilesIntersectingEnvelope(new Envelope(new double[] { -8, -3, -3 }, new double[] { -1, 3, 3 })), new SpaceFillingCurve.LongRange(5, 6), new SpaceFillingCurve.LongRange(14, 17), new SpaceFillingCurve.LongRange(27, 28));
    assertTiles(curve.getTilesIntersectingEnvelope(new Envelope(new double[] { -1, -1, -1 }, new double[] { 1, 1, 1 })), midRanges);
}
Also used : Envelope(org.neo4j.gis.spatial.index.Envelope) Test(org.junit.jupiter.api.Test)

Aggregations

Envelope (org.neo4j.gis.spatial.index.Envelope)55 Test (org.junit.jupiter.api.Test)48 Config (org.neo4j.configuration.Config)1 SpaceFillingCurveSettings (org.neo4j.kernel.impl.index.schema.config.SpaceFillingCurveSettings)1