use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.
the class SpaceFillingCurveTest method shouldWorkWithNormalGPSCoordinatesAndHeight.
@Test
void shouldWorkWithNormalGPSCoordinatesAndHeight() {
Envelope envelope = new Envelope(new double[] { -180, -90, 0 }, new double[] { 180, 90, 10000 });
HilbertSpaceFillingCurve3D curve = new HilbertSpaceFillingCurve3D(envelope);
assertAtLevel(curve, envelope);
}
use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.
the class SpaceFillingCurveTest method shouldCreateSimple2DZOrderCurveAtManyLevels.
@Test
void shouldCreateSimple2DZOrderCurveAtManyLevels() {
Envelope envelope = new Envelope(new double[] { -8, -8 }, new double[] { 8, 8 });
for (int level = 1; level <= ZOrderSpaceFillingCurve2D.MAX_LEVEL; level++) {
ZOrderSpaceFillingCurve2D curve = new ZOrderSpaceFillingCurve2D(envelope, level);
assertAtLevel(curve, envelope);
assertRange((int) curve.getWidth(), 0, curve, 0, (int) curve.getWidth() - 1);
assertRange((int) curve.getWidth(), curve.getValueWidth() - 1, curve, (int) curve.getWidth() - 1, 0);
}
}
use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.
the class SpaceFillingCurveTest method shouldGet2DHilbertSearchTilesForCenterRangeAndTraverseToBottom.
@Test
void shouldGet2DHilbertSearchTilesForCenterRangeAndTraverseToBottom() {
TraverseToBottomConfiguration configuration = new TraverseToBottomConfiguration();
Envelope envelope = new Envelope(-8, 8, -8, 8);
for (// 12 takes 6s, 13 takes 25s, 14 takes 100s, 15 takes over 400s
int level = 2; // 12 takes 6s, 13 takes 25s, 14 takes 100s, 15 takes over 400s
level <= 11; // 12 takes 6s, 13 takes 25s, 14 takes 100s, 15 takes over 400s
level++) {
HilbertSpaceFillingCurve2D curve = new HilbertSpaceFillingCurve2D(envelope, level);
double fullTile = curve.getTileWidth(0, level);
double halfTile = fullTile / 2.0;
Envelope centerWithoutOuterRing = new Envelope(envelope.getMin(0) + fullTile + halfTile, envelope.getMax(0) - fullTile - halfTile, envelope.getMin(1) + fullTile + halfTile, envelope.getMax(1) - fullTile - halfTile);
List<SpaceFillingCurve.LongRange> result = curve.getTilesIntersectingEnvelope(centerWithoutOuterRing, configuration, null);
assertTiles(result, tilesNotTouchingOuterRing(curve).toArray(new SpaceFillingCurve.LongRange[0]));
}
}
use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.
the class SpaceFillingCurveTest method shouldGiveRangesWithinMaxValuesWhenMatchingWholeEnvelopeAtMaxLevel.
@Test
void shouldGiveRangesWithinMaxValuesWhenMatchingWholeEnvelopeAtMaxLevel() {
Envelope envelope = new Envelope(-8, 8, -8, 8);
HilbertSpaceFillingCurve2D curve = new HilbertSpaceFillingCurve2D(envelope);
List<SpaceFillingCurve.LongRange> ranges = curve.getTilesIntersectingEnvelope(envelope);
assertThat(ranges.size()).isEqualTo(1);
assertThat(ranges.get(0).max).isLessThan(Long.MAX_VALUE);
assertThat(ranges.get(0).min).isGreaterThan(Long.MIN_VALUE);
}
use of org.neo4j.gis.spatial.index.Envelope in project neo4j by neo4j.
the class SpaceFillingCurveTest method shouldWorkWithNormalGPSCoordinatesHilbert.
@Test
void shouldWorkWithNormalGPSCoordinatesHilbert() {
Envelope envelope = new Envelope(-180, 180, -90, 90);
HilbertSpaceFillingCurve2D curve = new HilbertSpaceFillingCurve2D(envelope);
assertAtLevel(curve, envelope);
}
Aggregations