use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class FesEncoderv20 method encodeTemporalFilterDuring.
private XmlObject encodeTemporalFilterDuring(TemporalFilter temporalFilter) throws EncodingException {
final DuringDocument duringDoc = DuringDocument.Factory.newInstance(getXmlOptions());
final BinaryTemporalOpType during = duringDoc.addNewDuring();
if (temporalFilter.getTime() instanceof TimePeriod) {
during.set(encodeObjectToXml(GmlConstants.NS_GML_32, temporalFilter.getTime(), EncodingContext.of(XmlBeansEncodingFlags.DOCUMENT)));
} else {
throw new EncodingException("The temporal filter value is not a TimePeriod!");
}
checkAndAddValueReference(during, temporalFilter);
return duringDoc;
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class ODataFesParserTest method testFeatureOfInterestShapeGeoIntersectsPolygon.
@Test
public void testFeatureOfInterestShapeGeoIntersectsPolygon() throws Exception {
Filter<?> filter = parser.decode(String.format("geo.intersects(featureOfInterest/shape,'SRID=%s;%s')", polygon.getSRID(), wktGeometry));
assertThat(filter, is(instanceOf(SpatialFilter.class)));
SpatialFilter sf = (SpatialFilter) filter;
errors.checkThat(sf.getSrid(), is(4326));
errors.checkThat(sf.getGeometry().isEnvelope(), is(false));
errors.checkThat(sf.getGeometry().isGeometry(), is(true));
errors.checkThat(sf.getGeometry().getGeometry().get(), is(instanceOf(Polygon.class)));
errors.checkThat(sf.getValueReference(), is("om:featureOfInterest/*/sams:shape"));
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class ODataFesParserTest method testSamplingGeometryGeoIntersectsPolygon.
@Test
public void testSamplingGeometryGeoIntersectsPolygon() throws Exception {
Filter<?> filter = parser.decode(String.format("geo.intersects(samplingGeometry,'SRID=%s;%s')", polygon.getSRID(), wktGeometry));
assertThat(filter, is(instanceOf(SpatialFilter.class)));
SpatialFilter sf = (SpatialFilter) filter;
errors.checkThat(sf.getSrid(), is(4326));
errors.checkThat(sf.getGeometry().isEnvelope(), is(false));
errors.checkThat(sf.getGeometry().isGeometry(), is(true));
errors.checkThat(sf.getGeometry().getGeometry().get(), is(instanceOf(Polygon.class)));
errors.checkThat(sf.getValueReference(), is("http://www.opengis.net/req/omxml/2.0/data/samplingGeometry"));
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class ODataFesParserTest method testContains.
@Test
public void testContains() throws DecodingException {
Filter<?> filter = parser.decode("contains(textValue,'as%df')");
assertThat(filter, is(instanceOf(ComparisonFilter.class)));
ComparisonFilter cf = (ComparisonFilter) filter;
errors.checkThat(cf.getOperator(), is(ComparisonOperator.PropertyIsLike));
errors.checkThat(cf.getValue(), is("%as%df%"));
errors.checkThat(cf.getValueReference(), is("om:result"));
}
use of org.n52.shetland.ogc.filter.Filter in project arctic-sea by 52North.
the class ODataFesParserTest method testConjunction.
@Test
@SuppressWarnings("unchecked")
public void testConjunction() throws Exception {
Filter<?> filter = parser.decode("countValue lt 10 and textValue eq 'thetext'");
assertThat(filter, is(instanceOf(BinaryLogicFilter.class)));
BinaryLogicFilter blf = (BinaryLogicFilter) filter;
errors.checkThat(blf.getOperator(), is(BinaryLogicOperator.And));
Set<Filter<?>> filterPredicates = blf.getFilterPredicates();
errors.checkThat(filterPredicates, Matchers.containsInAnyOrder(Matchers.instanceOf(ComparisonFilter.class), Matchers.instanceOf(ComparisonFilter.class)));
}
Aggregations