use of org.neo4j.ogm.cypher.function.DistanceFromNativePoint in project neo4j-ogm by neo4j.
the class DistanceComparisonTestBase method filterForCartesianPoint3d.
@Test
public void filterForCartesianPoint3d() {
Session session = sessionFactory.openSession();
SomethingSpatial spatial = new SomethingSpatial();
CartesianPoint3d point = new CartesianPoint3d(1, 2, 3);
spatial.setCartesianPoint3d(point);
session.save(spatial);
DistanceFromNativePoint distanceFromNativePoint = new DistanceFromNativePoint(new CartesianPoint3d(2, 2, 3), 2);
Filter filter = new Filter("cartesianPoint3d", distanceComparisonFor(distanceFromNativePoint));
filter.setOwnerEntityType(SomethingSpatial.class);
Collection<SomethingSpatial> somethingSpatials = session.loadAll(SomethingSpatial.class, filter);
assertThat(somethingSpatials).hasSize(1);
}
use of org.neo4j.ogm.cypher.function.DistanceFromNativePoint in project neo4j-ogm by neo4j.
the class DistanceComparisonTestBase method filterForGeographicPoint3d.
@Test
public void filterForGeographicPoint3d() {
Session session = sessionFactory.openSession();
SomethingSpatial spatial = new SomethingSpatial();
GeographicPoint3d centralStationLocation = new GeographicPoint3d(55.6093093, 13.0004377, -5);
spatial.setGeographicPoint3d(centralStationLocation);
session.save(spatial);
GeographicPoint3d office = new GeographicPoint3d(55.611851, 12.9949028, 15);
DistanceFromNativePoint distanceFromNativePoint = new DistanceFromNativePoint(office, 448.9591);
Filter filter = new Filter("geographicPoint3d", distanceComparisonFor(distanceFromNativePoint));
filter.setOwnerEntityType(SomethingSpatial.class);
Collection<SomethingSpatial> somethingSpatials = session.loadAll(SomethingSpatial.class, filter);
assertThat(somethingSpatials).hasSize(1);
}
use of org.neo4j.ogm.cypher.function.DistanceFromNativePoint in project neo4j-ogm by neo4j.
the class DistanceComparisonTestBase method filterForGeographicPoint2d.
@Test
public void filterForGeographicPoint2d() {
Session session = sessionFactory.openSession();
SomethingSpatial spatial = new SomethingSpatial();
GeographicPoint2d centralStationLocation = new GeographicPoint2d(55.6093093, 13.0004377);
spatial.setGeographicPoint2d(centralStationLocation);
session.save(spatial);
GeographicPoint2d office = new GeographicPoint2d(55.611851, 12.9949028);
DistanceFromNativePoint distanceFromNativePoint = new DistanceFromNativePoint(office, 449);
Filter filter = new Filter("geographicPoint2d", distanceComparisonFor(distanceFromNativePoint));
filter.setOwnerEntityType(SomethingSpatial.class);
Collection<SomethingSpatial> somethingSpatials = session.loadAll(SomethingSpatial.class, filter);
assertThat(somethingSpatials).hasSize(1);
}
use of org.neo4j.ogm.cypher.function.DistanceFromNativePoint in project neo4j-ogm by neo4j.
the class DistanceComparisonTestBase method filterForGeographicPoint3dNoMatch.
@Test
public void filterForGeographicPoint3dNoMatch() {
Session session = sessionFactory.openSession();
SomethingSpatial spatial = new SomethingSpatial();
GeographicPoint3d centralStationLocation = new GeographicPoint3d(55.6093093, 13.0004377, -5);
spatial.setGeographicPoint3d(centralStationLocation);
session.save(spatial);
GeographicPoint3d office = new GeographicPoint3d(55.611851, 12.9949028, 15);
DistanceFromNativePoint distanceFromNativePoint = new DistanceFromNativePoint(office, 448.950);
Filter filter = new Filter("geographicPoint3d", distanceComparisonFor(distanceFromNativePoint));
filter.setOwnerEntityType(SomethingSpatial.class);
Collection<SomethingSpatial> somethingSpatials = session.loadAll(SomethingSpatial.class, filter);
assertThat(somethingSpatials).hasSize(0);
}
use of org.neo4j.ogm.cypher.function.DistanceFromNativePoint in project neo4j-ogm by neo4j.
the class DistanceComparisonTestBase method filterForCartesianPoint2dNoMatch.
@Test
public void filterForCartesianPoint2dNoMatch() {
Session session = sessionFactory.openSession();
SomethingSpatial spatial = new SomethingSpatial();
CartesianPoint2d point = new CartesianPoint2d(1, 2);
spatial.setCartesianPoint2d(point);
session.save(spatial);
DistanceFromNativePoint distanceFromNativePoint = new DistanceFromNativePoint(new CartesianPoint2d(2, 2), 1);
Filter filter = new Filter("cartesianPoint2d", distanceComparisonFor(distanceFromNativePoint));
filter.setOwnerEntityType(SomethingSpatial.class);
Collection<SomethingSpatial> somethingSpatials = session.loadAll(SomethingSpatial.class, filter);
assertThat(somethingSpatials).hasSize(0);
}
Aggregations