use of org.geotoolkit.gml.xml.v311.EnvelopeType in project ddf by codice.
the class WfsFilterDelegate method createEnvelope.
private JAXBElement<EnvelopeType> createEnvelope(Geometry geometry) {
EnvelopeType envelopeType = gml320ObjectFactory.createEnvelopeType();
envelopeType.setSrsName(GeospatialUtil.EPSG_4326_URN);
Envelope envelope = geometry.getEnvelopeInternal();
DirectPositionType lowerCorner = gml320ObjectFactory.createDirectPositionType();
lowerCorner.getValue().add(envelope.getMinX());
lowerCorner.getValue().add(envelope.getMinY());
envelopeType.setLowerCorner(lowerCorner);
DirectPositionType upperCorner = gml320ObjectFactory.createDirectPositionType();
upperCorner.getValue().add(envelope.getMaxX());
upperCorner.getValue().add(envelope.getMaxY());
envelopeType.setUpperCorner(upperCorner);
return gml320ObjectFactory.createEnvelope(envelopeType);
}
use of org.geotoolkit.gml.xml.v311.EnvelopeType in project arctic-sea by 52North.
the class SweCommonEncoderv101Test method should_encode_ReferencedEnvelope.
@Test
public void should_encode_ReferencedEnvelope() throws EncodingException {
final int srid = 4326;
final double y1 = 7.0;
final double x1 = 51.0;
final double y2 = 8.0;
final double x2 = 52.0;
final String uom = "test-uom";
final String definition = "test-definition";
final SweEnvelope sweEnvelope = new SweEnvelope(new ReferencedEnvelope(new Envelope(x1, x2, y1, y2), srid), uom, true);
final String xAxisId = "x";
final String yAxisId = "y";
final String northing = "northing";
final String easting = "easting";
sweEnvelope.setDefinition(definition);
final XmlObject encode = sweCommonEncoderv101.encode(sweEnvelope);
assertThat(encode, instanceOf(EnvelopeType.class));
final EnvelopeType xbEnvelope = (EnvelopeType) encode;
assertThat(xbEnvelope.isSetDefinition(), is(true));
assertThat(xbEnvelope.getDefinition(), is(definition));
final Coordinate lcX = xbEnvelope.getLowerCorner().getVector().getCoordinateArray(0);
assertThat(lcX.getName(), is(easting));
assertThat(lcX.getQuantity().getAxisID(), is(xAxisId));
assertThat(lcX.getQuantity().getUom().getCode(), is(uom));
assertThat(lcX.getQuantity().getValue(), is(y1));
final Coordinate lcY = xbEnvelope.getLowerCorner().getVector().getCoordinateArray(1);
assertThat(lcY.getName(), is(northing));
assertThat(lcY.getQuantity().getAxisID(), is(yAxisId));
assertThat(lcY.getQuantity().getUom().getCode(), is(uom));
assertThat(lcY.getQuantity().getValue(), is(x1));
final Coordinate ucX = xbEnvelope.getUpperCorner().getVector().getCoordinateArray(0);
assertThat(ucX.getName(), is(easting));
assertThat(ucX.getQuantity().getAxisID(), is(xAxisId));
assertThat(ucX.getQuantity().getUom().getCode(), is(uom));
assertThat(ucX.getQuantity().getValue(), is(y2));
final Coordinate ucY = xbEnvelope.getUpperCorner().getVector().getCoordinateArray(1);
assertThat(ucY.getName(), is(northing));
assertThat(ucY.getQuantity().getAxisID(), is(yAxisId));
assertThat(ucY.getQuantity().getUom().getCode(), is(uom));
assertThat(ucY.getQuantity().getValue(), is(x2));
assertThat(xbEnvelope.isSetReferenceFrame(), is(true));
assertThat(xbEnvelope.getReferenceFrame(), is("" + srid));
}
use of org.geotoolkit.gml.xml.v311.EnvelopeType 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.gml.xml.v311.EnvelopeType in project geo-platform by geosdi.
the class WFSGetFeatureRequestV110 method createEnvelope.
/**
* @param bbox
* @return {@link EnvelopeType}
*/
private EnvelopeType createEnvelope(BBox bbox) {
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);
return envelope;
}
use of org.geotoolkit.gml.xml.v311.EnvelopeType 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;
}
Aggregations