Search in sources :

Example 31 with BinarySpatialOpType

use of net.opengis.fes._2.BinarySpatialOpType in project ddf by codice.

the class CswFilterFactory method createBinarySpatialOpTypeUsingGeometry.

@SuppressWarnings("unchecked")
private BinarySpatialOpType createBinarySpatialOpTypeUsingGeometry(PropertyNameType propertyName, JAXBElement<? extends AbstractGeometryType> geometry) {
    BinarySpatialOpType binarySpatialOpType = new BinarySpatialOpType();
    binarySpatialOpType.getPropertyName().add(propertyName);
    binarySpatialOpType.setGeometry((JAXBElement<AbstractGeometryType>) geometry);
    return binarySpatialOpType;
}
Also used : AbstractGeometryType(net.opengis.gml.v_3_1_1.AbstractGeometryType) BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType)

Example 32 with BinarySpatialOpType

use of net.opengis.fes._2.BinarySpatialOpType in project ddf by codice.

the class WfsFilterDelegateTest method testMultiPolygonWithSinglePolygonSupportsOnlyPolygon.

@Test
public void testMultiPolygonWithSinglePolygonSupportsOnlyPolygon() {
    final String MULTIPOLYGON_SINGLE_POLYGON = "MULTIPOLYGON (((30 20, 10 40, 45 40, 30 20)))";
    final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.INTERSECTS.getValue(), new LatLonCoordinateStrategy());
    delegate.setSupportedGeometryOperands(singletonList(Wfs11Constants.POLYGON));
    final FilterType filter = delegate.intersects(Metacard.ANY_GEO, MULTIPOLYGON_SINGLE_POLYGON);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BinarySpatialOpType.class)));
    final BinarySpatialOpType binarySpatialOpType = (BinarySpatialOpType) filter.getSpatialOps().getValue();
    assertThat(binarySpatialOpType.getGeometry().getValue(), is(instanceOf(PolygonType.class)));
    final PolygonType polygonType = (PolygonType) binarySpatialOpType.getGeometry().getValue();
    assertThat(polygonType.getExterior().getValue().getRing().getValue(), is(instanceOf(LinearRingType.class)));
    final LinearRingType linearRingType = (LinearRingType) polygonType.getExterior().getValue().getRing().getValue();
    assertThat(linearRingType.getCoordinates().getValue(), is("20.0,30.0 40.0,10.0 40.0,45.0 20.0,30.0"));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) LinearRingType(net.opengis.gml.v_3_1_1.LinearRingType) BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType) PolygonType(net.opengis.gml.v_3_1_1.PolygonType) MultiPolygonType(net.opengis.gml.v_3_1_1.MultiPolygonType) Matchers.isEmptyOrNullString(org.hamcrest.Matchers.isEmptyOrNullString) Test(org.junit.Test)

Example 33 with BinarySpatialOpType

use of net.opengis.fes._2.BinarySpatialOpType in project ddf by codice.

the class WfsFilterDelegateTest method testLineStringLatLonOrder.

@Test
public void testLineStringLatLonOrder() {
    final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.INTERSECTS.getValue(), new LatLonCoordinateStrategy());
    final FilterType filter = delegate.intersects(Metacard.ANY_GEO, LINESTRING);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BinarySpatialOpType.class)));
    final BinarySpatialOpType binarySpatialOpType = (BinarySpatialOpType) filter.getSpatialOps().getValue();
    assertThat(binarySpatialOpType.getGeometry().getValue(), is(instanceOf(LineStringType.class)));
    final LineStringType lineStringType = (LineStringType) binarySpatialOpType.getGeometry().getValue();
    assertThat(lineStringType.getCoordinates().getValue(), is("10.0,30.0 30.0,10.0 40.0,50.0"));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType) LineStringType(net.opengis.gml.v_3_1_1.LineStringType) Test(org.junit.Test)

Example 34 with BinarySpatialOpType

use of net.opengis.fes._2.BinarySpatialOpType in project ddf by codice.

the class WfsFilterDelegateTest method testLineStringLonLatOrder.

@Test
public void testLineStringLonLatOrder() {
    final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.INTERSECTS.getValue(), new LonLatCoordinateStrategy());
    final FilterType filter = delegate.intersects(Metacard.ANY_GEO, LINESTRING);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BinarySpatialOpType.class)));
    final BinarySpatialOpType binarySpatialOpType = (BinarySpatialOpType) filter.getSpatialOps().getValue();
    assertThat(binarySpatialOpType.getGeometry().getValue(), is(instanceOf(LineStringType.class)));
    final LineStringType lineStringType = (LineStringType) binarySpatialOpType.getGeometry().getValue();
    assertThat(lineStringType.getCoordinates().getValue(), is("30.0,10.0 10.0,30.0 50.0,40.0"));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType) LineStringType(net.opengis.gml.v_3_1_1.LineStringType) Test(org.junit.Test)

Example 35 with BinarySpatialOpType

use of net.opengis.fes._2.BinarySpatialOpType in project ddf by codice.

the class WfsFilterDelegateTest method testMultiPolygonLonLatOrder.

@Test
public void testMultiPolygonLonLatOrder() {
    final WfsFilterDelegate delegate = setupFilterDelegate(SPATIAL_OPERATORS.INTERSECTS.getValue(), new LonLatCoordinateStrategy());
    final FilterType filter = delegate.intersects(Metacard.ANY_GEO, MULTIPOLYGON);
    assertThat(filter.getSpatialOps().getValue(), is(instanceOf(BinarySpatialOpType.class)));
    final BinarySpatialOpType binarySpatialOpType = (BinarySpatialOpType) filter.getSpatialOps().getValue();
    assertThat(binarySpatialOpType.getGeometry().getValue(), is(instanceOf(MultiPolygonType.class)));
    final MultiPolygonType multiPolygonType = (MultiPolygonType) binarySpatialOpType.getGeometry().getValue();
    assertThat(multiPolygonType.getPolygonMember().size(), is(2));
    final LinearRingType firstLinearRing = (LinearRingType) multiPolygonType.getPolygonMember().get(0).getPolygon().getExterior().getValue().getRing().getValue();
    assertThat(firstLinearRing.getCoordinates().getValue(), is("30.0,20.0 10.0,40.0 45.0,40.0 30.0,20.0"));
}
Also used : FilterType(net.opengis.filter.v_1_1_0.FilterType) LinearRingType(net.opengis.gml.v_3_1_1.LinearRingType) BinarySpatialOpType(net.opengis.filter.v_1_1_0.BinarySpatialOpType) MultiPolygonType(net.opengis.gml.v_3_1_1.MultiPolygonType) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)34 BinarySpatialOpType (net.opengis.filter.v_1_1_0.BinarySpatialOpType)20 BinarySpatialOpType (net.opengis.filter.v_2_0_0.BinarySpatialOpType)18 FilterType (net.opengis.filter.v_2_0_0.FilterType)18 FilterType (net.opengis.filter.v_1_1_0.FilterType)8 ArrayList (java.util.ArrayList)7 FilterCapabilities (net.opengis.filter.v_2_0_0.FilterCapabilities)6 SpatialOperatorType (net.opengis.filter.v_2_0_0.SpatialOperatorType)6 LinearRingType (net.opengis.gml.v_3_1_1.LinearRingType)6 MultiPolygonType (net.opengis.gml.v_3_1_1.MultiPolygonType)6 GeometryOperand (net.opengis.filter.v_2_0_0.GeometryOperandsType.GeometryOperand)4 UnaryLogicOpType (net.opengis.filter.v_2_0_0.UnaryLogicOpType)4 PolygonType (net.opengis.gml.v_3_1_1.PolygonType)4 FeatureAttributeDescriptor (org.codice.ddf.spatial.ogc.wfs.catalog.common.FeatureAttributeDescriptor)3 LineStringType (net.opengis.gml.v_3_1_1.LineStringType)2 JAXBElement (javax.xml.bind.JAXBElement)1 BBOXType (net.opengis.fes._2.BBOXType)1 BinarySpatialOpType (net.opengis.fes._2.BinarySpatialOpType)1 DistanceBufferType (net.opengis.fes._2.DistanceBufferType)1 BBOXType (net.opengis.fes.x20.BBOXType)1