Search in sources :

Example 6 with PropertyNameType

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));
}
Also used : QueryRequest(ddf.catalog.operation.QueryRequest) SortBy(org.opengis.filter.sort.SortBy) GetRecordsType(net.opengis.cat.csw.v_2_0_2.GetRecordsType) SortPropertyType(net.opengis.filter.v_1_1_0.SortPropertyType) SortByType(net.opengis.filter.v_1_1_0.SortByType) JAXBElement(javax.xml.bind.JAXBElement) QueryType(net.opengis.cat.csw.v_2_0_2.QueryType) PropertyNameType(net.opengis.filter.v_1_1_0.PropertyNameType) Test(org.junit.Test)

Example 7 with PropertyNameType

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;
}
Also used : UnaryLogicOpType(org.geosdi.geoplatform.xml.filter.v110.UnaryLogicOpType) EnvelopeType(org.geosdi.geoplatform.xml.gml.v311.EnvelopeType) ArrayList(java.util.ArrayList) BinarySpatialOpType(org.geosdi.geoplatform.xml.filter.v110.BinarySpatialOpType) JAXBElement(javax.xml.bind.JAXBElement) PropertyNameType(org.geosdi.geoplatform.xml.filter.v110.PropertyNameType)

Example 8 with PropertyNameType

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;
}
Also used : FilterType(org.geosdi.geoplatform.xml.filter.v110.FilterType) EnvelopeType(org.geosdi.geoplatform.xml.gml.v311.EnvelopeType) BBOXType(org.geosdi.geoplatform.xml.filter.v110.BBOXType) DirectPositionType(org.geosdi.geoplatform.xml.gml.v311.DirectPositionType) ObjectFactory(org.geosdi.geoplatform.xml.gml.v311.ObjectFactory) BBox(org.geosdi.geoplatform.gui.shared.bean.BBox) PropertyNameType(org.geosdi.geoplatform.xml.filter.v110.PropertyNameType)

Example 9 with PropertyNameType

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);
}
Also used : Marshaller(javax.xml.bind.Marshaller) Color(java.awt.Color) JAXBElement(javax.xml.bind.JAXBElement) LineSymbolizer(org.opengis.style.LineSymbolizer) Unmarshaller(javax.xml.bind.Unmarshaller) PropertyNameType(org.geotoolkit.ogc.xml.v110.PropertyNameType) Test(org.junit.Test)

Example 10 with PropertyNameType

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);
}
Also used : PropertyIsEqualToType(org.geotoolkit.ogc.xml.v110.PropertyIsEqualToType) LiteralType(org.geotoolkit.ogc.xml.v110.LiteralType) PropertyNameType(org.geotoolkit.ogc.xml.v110.PropertyNameType)

Aggregations

PropertyNameType (org.geotoolkit.ogc.xml.v110.PropertyNameType)62 JAXBElement (javax.xml.bind.JAXBElement)47 Test (org.junit.Test)39 Unmarshaller (javax.xml.bind.Unmarshaller)38 LiteralType (org.geotoolkit.ogc.xml.v110.LiteralType)38 Marshaller (javax.xml.bind.Marshaller)37 ValueReference (org.opengis.filter.ValueReference)37 Literal (org.opengis.filter.Literal)31 Filter (org.opengis.filter.Filter)27 PropertyNameType (org.geotoolkit.ogc.xml.v100.PropertyNameType)20 BinaryComparisonOperator (org.opengis.filter.BinaryComparisonOperator)20 FilterType (org.geotoolkit.ogc.xml.v110.FilterType)17 LiteralType (org.geotoolkit.ogc.xml.v100.LiteralType)16 PropertyNameType (net.opengis.filter.v_1_1_0.PropertyNameType)13 FilterType (org.geotoolkit.ogc.xml.v100.FilterType)12 Expression (org.opengis.filter.Expression)12 ComparisonOpsType (org.geotoolkit.ogc.xml.v100.ComparisonOpsType)10 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v100.BinaryComparisonOpType)9 BinaryComparisonOpType (org.geotoolkit.ogc.xml.v110.BinaryComparisonOpType)9 ComparisonOpsType (org.geotoolkit.ogc.xml.v110.ComparisonOpsType)9