use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class GenericCardinalPropertyFunctionTest method testExtractObjectArguments_3args_pos0_fail.
/**
* Test of extractObjectArguments method, of class
* GenericCardinalPropertyFunction.
*/
@Test(expected = ExprEvalException.class)
public void testExtractObjectArguments_3args_pos0_fail() {
Node predicate = NodeFactory.createURI(SpatialExtension.NORTH_PROP);
float lat = 0;
float lon = 1;
int limit = 10;
Literal geometry = ConvertLatLon.toLiteral(lat, lon);
List<Node> objectNodes = Arrays.asList(NodeValue.makeString("e").asNode(), NodeValue.makeFloat(lon).asNode(), NodeValue.makeInteger(limit).asNode());
PropFuncArg object = new PropFuncArg(objectNodes);
GeometryWrapper geometryWrapper = GeometryWrapper.extract(geometry);
NorthPF instance = new NorthPF();
SearchEnvelope searchEnvelope = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
SpatialArguments expResult = new SpatialArguments(limit, geometryWrapper, searchEnvelope);
SpatialArguments result = instance.extractObjectArguments(predicate, object, SpatialIndexTestData.WGS_84_SRS_INFO);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class NorthPFTest method testBuildSearchEnvelope.
/**
* Test of buildSearchEnvelope method, of class NorthPF.
*/
@Test
public void testBuildSearchEnvelope() {
GeometryWrapper geometryWrapper = SpatialIndexTestData.PARIS_GEOMETRY_WRAPPER;
NorthPF instance = new NorthPF();
SearchEnvelope expResult = SearchEnvelope.build(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO, CardinalDirection.NORTH);
SearchEnvelope result = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class WestGeomPFTest method testBuildSearchEnvelope.
/**
* Test of buildSearchEnvelope method, of class WestGeomPF.
*/
@Test
public void testBuildSearchEnvelope() {
GeometryWrapper geometryWrapper = SpatialIndexTestData.PARIS_GEOMETRY_WRAPPER;
WestGeomPF instance = new WestGeomPF();
SearchEnvelope expResult = SearchEnvelope.build(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO, CardinalDirection.WEST);
SearchEnvelope result = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class WestGeomPFTest method testCheckSearchEnvelope_wrap.
/**
* Test of checkSearchEnvelope method, of class WestGeomPF.
*/
@Test
public void testCheckSearchEnvelope_wrap() {
SpatialIndex spatialIndex = SpatialIndexTestData.createTestIndex();
// Search Envelope
GeometryWrapper geometryWrapper = SpatialIndexTestData.HONOLULU_GEOMETRY_WRAPPER;
WestGeomPF instance = new WestGeomPF();
// Needed to initialise the search.
SearchEnvelope searchEnvelope = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
HashSet<Resource> expResult = new HashSet<>(Arrays.asList(SpatialIndexTestData.AUCKLAND_FEATURE, SpatialIndexTestData.PERTH_FEATURE, SpatialIndexTestData.HONOLULU_FEATURE));
HashSet<Resource> result = searchEnvelope.check(spatialIndex);
assertEquals(expResult, result);
}
use of org.apache.jena.geosparql.implementation.GeometryWrapper in project jena by apache.
the class WestGeomPFTest method testCheckSearchEnvelope_no_wrap.
/**
* Test of checkSearchEnvelope method, of class WestGeomPF.
*/
@Test
public void testCheckSearchEnvelope_no_wrap() {
SpatialIndex spatialIndex = SpatialIndexTestData.createTestIndex();
// Search Envelope
GeometryWrapper geometryWrapper = SpatialIndexTestData.PERTH_GEOMETRY_WRAPPER;
WestGeomPF instance = new WestGeomPF();
// Needed to initialise the search.
SearchEnvelope searchEnvelope = instance.buildSearchEnvelope(geometryWrapper, SpatialIndexTestData.WGS_84_SRS_INFO);
HashSet<Resource> expResult = new HashSet<>(Arrays.asList(SpatialIndexTestData.LONDON_FEATURE, SpatialIndexTestData.PERTH_FEATURE));
HashSet<Resource> result = searchEnvelope.check(spatialIndex);
assertEquals(expResult, result);
}
Aggregations