use of org.opengis.geometry.Geometry in project ddf by codice.
the class CopyFilterDelegateTest method testSpatialOverlaps.
@Test
public void testSpatialOverlaps() {
Geometry polygonGeometry = wktToGeometry(POLYGON_WKT);
assertFilterException(FF.overlaps(TEST_PROPERTY_VALUE, polygonGeometry));
}
use of org.opengis.geometry.Geometry in project ddf by codice.
the class CopyFilterDelegateTest method testSpatialDisjoint.
@Test
public void testSpatialDisjoint() {
Geometry polygonGeometry = wktToGeometry(POLYGON_WKT);
assertFilterException(FF.disjoint(TEST_PROPERTY_VALUE, polygonGeometry));
}
use of org.opengis.geometry.Geometry in project ddf by codice.
the class CopyFilterDelegateTest method testSpatialTouches.
@Test
public void testSpatialTouches() {
Geometry polygonGeometry = wktToGeometry(POLYGON_WKT);
assertFilterException(FF.touches(TEST_PROPERTY_VALUE, polygonGeometry));
}
use of org.opengis.geometry.Geometry in project ddf by codice.
the class OpenSearchQuery method addSpatialFilter.
private void addSpatialFilter(SpatialFilter spatialFilter) {
Geometry geometry = spatialFilter.getGeometry();
if (geometry != null) {
Filter filter = FILTER_FACTORY.intersects(Metacard.ANY_GEO, geometry);
LOGGER.debug("Adding spatial filter");
filters.add(filter);
}
}
use of org.opengis.geometry.Geometry in project ddf by codice.
the class OpenSearchQueryTest method testWktParserPolygon.
@Test
@Ignore
public void testWktParserPolygon() throws Exception {
String geometryWkt = "POLYGON(( 0 10, 0 30, 20 30, 20 10, 0 10 ))";
GeometryBuilder builder = new GeometryBuilder(DefaultGeographicCRS.WGS84);
WKTParser parser = new WKTParser(builder);
// This fixed the NPE in parser.parse() - seems GeoTools has bug with
// keeping the CRS hint set ...
parser.setFactory(new PrimitiveFactoryImpl(DefaultGeographicCRS.WGS84));
Geometry geometry = parser.parse(geometryWkt);
CoordinateReferenceSystem crs = geometry.getCoordinateReferenceSystem();
assertNotNull(crs);
double[] coords = geometry.getCentroid().getCoordinate();
LOGGER.debug("coords[0] = {}, coords[1] = {}", coords[0], coords[1]);
// String geometryWkt2 = "POINT( 10 20 )";
String geometryWkt2 = "POLYGON(( 10 15, 10 25, 15 25, 15 15, 10 15 ))";
builder = new GeometryBuilder(DefaultGeographicCRS.WGS84);
WKTParser parser2 = new WKTParser(builder);
// This fixed the NPE in parser.parse() - seems GeoTools has bug with
// keeping the CRS hint set ...
parser2.setFactory(new PrimitiveFactoryImpl(DefaultGeographicCRS.WGS84));
Geometry geometry2 = parser2.parse(geometryWkt2);
double[] coords2 = geometry2.getCentroid().getCoordinate();
LOGGER.debug("coords[0] = {}, coords[1] = {}", coords2[0], coords2[1]);
// This fails - why?
assertTrue(geometry.contains(geometry2));
}
Aggregations