use of org.geotoolkit.ogc.xml.v110.PropertyNameType in project ddf by codice.
the class CswQueryFactoryTest method testPostGetRecordsValidSort.
@Test
public void testPostGetRecordsValidSort() throws CswException, UnsupportedQueryException, SourceUnavailableException, FederationException {
GetRecordsType grr = createDefaultPostRecordsRequest();
grr.setResultType(ResultType.RESULTS);
QueryType query = new QueryType();
SortByType incomingSort = new SortByType();
SortPropertyType propType = new SortPropertyType();
PropertyNameType propName = new PropertyNameType();
propName.setContent(Collections.singletonList(TITLE_TEST_ATTRIBUTE));
propType.setPropertyName(propName);
incomingSort.getSortProperty().add(propType);
query.setSortBy(incomingSort);
JAXBElement<QueryType> jaxbQuery = new JAXBElement<>(cswQnameOutPutSchema, QueryType.class, query);
grr.setAbstractQuery(jaxbQuery);
QueryRequest queryRequest = queryFactory.getQuery(grr);
SortBy resultSort = queryRequest.getQuery().getSortBy();
assertThat(resultSort.getPropertyName().getPropertyName(), is(CQL_FRAMEWORK_TEST_ATTRIBUTE));
assertThat(resultSort.getSortOrder(), is(SortOrder.ASCENDING));
}
use of org.geotoolkit.ogc.xml.v110.PropertyNameType in project geo-platform by geosdi.
the class AreaSearchRequestFilter method createFilterAreaPredicate.
/**
* @param areaSearchType
* @param bBox
* @return {@link List<JAXBElement<?>}
*/
private List<JAXBElement<?>> createFilterAreaPredicate(AreaSearchType areaSearchType, BBox bBox) {
List<JAXBElement<?>> areaPredicate = new ArrayList(2);
BinarySpatialOpType binarySpatial = new BinarySpatialOpType();
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(Arrays.<Object>asList(BOUNDING_BOX));
binarySpatial.setPropertyName(propertyNameType);
EnvelopeType envelope = this.createEnvelope(bBox);
binarySpatial.setEnvelope(gmlFactory.createEnvelope(envelope));
switch(areaSearchType) {
case ENCLOSES:
areaPredicate.add(filterFactory.createContains(binarySpatial));
break;
case IS:
areaPredicate.add(filterFactory.createEquals(binarySpatial));
break;
case OUTSIDE:
// Workaround for GeoNetwork bug: DISJOINT = NOT(INTERSECTS)
UnaryLogicOpType unary = new UnaryLogicOpType();
unary.setSpatialOps(filterFactory.createIntersects(binarySpatial));
areaPredicate.add(filterFactory.createNot(unary));
// areaPredicate.add(filterFactory.createDisjoint(binarySpatial));
break;
case OVERLAP:
areaPredicate.add(filterFactory.createIntersects(binarySpatial));
break;
}
return areaPredicate;
}
use of org.geotoolkit.ogc.xml.v110.PropertyNameType in project geo-platform by geosdi.
the class QueryRestrictionsBuilderTest method createFilterType.
/**
* @return {@link FilterType}
*/
private FilterType createFilterType() {
FilterType filter = new FilterType();
BBox bbox = new BBox(14.131237640976908, 36.56356461583572, 15.821758881211283, 37.143760728459014);
BBOXType bBoxType = new BBOXType();
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(Arrays.asList("the_geom"));
bBoxType.setPropertyName(propertyNameType);
EnvelopeType envelope = new EnvelopeType();
DirectPositionType lower = new DirectPositionType();
lower.setValue(asList(bbox.getMinX(), bbox.getMinY()));
envelope.setLowerCorner(lower);
DirectPositionType upper = new DirectPositionType();
upper.setValue(asList(bbox.getMaxX(), bbox.getMaxY()));
envelope.setUpperCorner(upper);
envelope.setSrsName("EPSG:4326");
bBoxType.setEnvelope(new ObjectFactory().createEnvelope(envelope));
filter.setSpatialOps(new org.geosdi.geoplatform.xml.filter.v110.ObjectFactory().createBBOX(bBoxType));
return filter;
}
use of org.geotoolkit.ogc.xml.v110.PropertyNameType in project geotoolkit by Geomatys.
the class SEforSLD110Test method testLineSymbolizer.
@Test
public void testLineSymbolizer() throws JAXBException {
final Unmarshaller UNMARSHALLER = POOL.acquireUnmarshaller();
final Marshaller MARSHALLER = POOL.acquireMarshaller();
// Read test
Object obj = UNMARSHALLER.unmarshal(FILE_SE_SYMBOL_LINE);
assertNotNull(obj);
JAXBElement<org.geotoolkit.se.xml.v110.LineSymbolizerType> jax = (JAXBElement<org.geotoolkit.se.xml.v110.LineSymbolizerType>) obj;
LineSymbolizer lineSymbol = TRANSFORMER_GT.visit(jax.getValue());
assertNotNull(lineSymbol);
assertEquals("the_geom", lineSymbol.getGeometryPropertyName());
assertEquals(Units.METRE, lineSymbol.getUnitOfMeasure());
assertNotNull(lineSymbol.getStroke());
assertEquals(floatValue(lineSymbol.getStroke().getWidth()), 13f, DELTA);
assertEquals(floatValue(lineSymbol.getStroke().getOpacity()), 0.4f, DELTA);
assertEquals(stringValue(lineSymbol.getStroke().getLineJoin()), "bevel");
assertEquals(stringValue(lineSymbol.getStroke().getLineCap()), "butt");
assertEquals(floatValue(lineSymbol.getStroke().getDashOffset()), 2.3f, DELTA);
assertEquals(colorValue(lineSymbol.getStroke().getColor()), ObjectConverters.convert("#FF0000", Color.class));
// Write test
JAXBElement<org.geotoolkit.se.xml.v110.LineSymbolizerType> pvt = TRANSFORMER_OGC.visit(lineSymbol, null);
assertNotNull(pvt);
assertEquals(new PropertyNameType("the_geom"), ((JAXBElement) pvt.getValue().getGeometry().getContent().get(0)).getValue());
assertNotNull(pvt.getValue().getStroke());
MARSHALLER.marshal(pvt, TEST_FILE_SE_SYMBOL_LINE);
POOL.recycle(MARSHALLER);
POOL.recycle(UNMARSHALLER);
}
use of org.geotoolkit.ogc.xml.v110.PropertyNameType in project geotoolkit by Geomatys.
the class FilterFactoryImpl method equal.
@Override
public BinaryComparisonOperator<Object> equal(final Expression<Object, ?> expr1, final Expression<Object, ?> expr2) {
LiteralType lit = null;
PropertyNameType propName = null;
if (expr1 instanceof PropertyNameType) {
propName = (PropertyNameType) expr1;
} else if (expr2 instanceof PropertyNameType) {
propName = (PropertyNameType) expr2;
}
if (expr1 instanceof LiteralType) {
lit = (LiteralType) expr1;
} else if (expr2 instanceof LiteralType) {
lit = (LiteralType) expr2;
}
return new PropertyIsEqualToType(lit, propName, null);
}
Aggregations