use of org.geotoolkit.gml.xml.v311.EnvelopeType in project arctic-sea by 52North.
the class SweCommonEncoderv101 method createEnvelope.
private EnvelopeType createEnvelope(SweEnvelope sosSweEnvelope) throws EncodingException {
EnvelopeType envelopeType = EnvelopeType.Factory.newInstance(getXmlOptions());
addAbstractDataComponentValues(envelopeType, sosSweEnvelope);
if (sosSweEnvelope.isReferenceFrameSet()) {
envelopeType.setReferenceFrame(sosSweEnvelope.getReferenceFrame());
}
if (sosSweEnvelope.isLowerCornerSet()) {
envelopeType.setLowerCorner(createVectorProperty(sosSweEnvelope.getLowerCorner()));
}
if (sosSweEnvelope.isUpperCornerSet()) {
envelopeType.setUpperCorner(createVectorProperty(sosSweEnvelope.getUpperCorner()));
}
if (sosSweEnvelope.isTimeSet()) {
envelopeType.addNewTime().setTimeRange(createTimeRange(sosSweEnvelope.getTime()));
}
return envelopeType;
}
use of org.geotoolkit.gml.xml.v311.EnvelopeType in project arctic-sea by 52North.
the class GmlEncoderv321 method createEnvelope.
private XmlObject createEnvelope(ReferencedEnvelope sosEnvelope) {
int srid = sosEnvelope.getSrid();
EnvelopeType envelopeType = EnvelopeType.Factory.newInstance();
MinMax<String> minmax = sosEnvelope.getMinMaxFromEnvelope();
envelopeType.addNewLowerCorner().setStringValue(minmax.getMinimum());
envelopeType.addNewUpperCorner().setStringValue(minmax.getMaximum());
envelopeType.setSrsName(getSrsName(srid));
return envelopeType;
}
use of org.geotoolkit.gml.xml.v311.EnvelopeType in project geo-platform by geosdi.
the class WFSGetFeatureRequestV110 method createAreaOperator.
/**
* @param bbox
* @return {@link JAXBElement<BBOXType>}
*/
private JAXBElement<BBOXType> createAreaOperator(BBox bbox) {
logger.debug("#######################BBOX : {}\n.", bbox);
BBOXType bBoxType = new BBOXType();
PropertyNameType propertyNameType = new PropertyNameType();
propertyNameType.setContent(asList(super.getGeometryName()));
bBoxType.setPropertyName(propertyNameType);
EnvelopeType envelope = this.createEnvelope(bbox);
if (srs != null) {
envelope.setSrsName(srs);
}
bBoxType.setEnvelope(gmlFactory.createEnvelope(envelope));
return filterFactory.createBBOX(bBoxType);
}
use of org.geotoolkit.gml.xml.v311.EnvelopeType in project geo-platform by geosdi.
the class AreaSearchRequestFilter method createEnvelope.
/**
* @param bbox
* @return {@link EnvelopeType}
*/
private EnvelopeType createEnvelope(BBox bbox) {
EnvelopeType envelope = new EnvelopeType();
DirectPositionType lower = new DirectPositionType();
lower.setValue(Arrays.asList(bbox.getMinX(), bbox.getMinY()));
envelope.setLowerCorner(lower);
DirectPositionType upper = new DirectPositionType();
upper.setValue(Arrays.asList(bbox.getMaxX(), bbox.getMaxY()));
envelope.setUpperCorner(upper);
return envelope;
}
use of org.geotoolkit.gml.xml.v311.EnvelopeType in project geotoolkit by Geomatys.
the class FilterFactoryImpl method GeometryToGML.
/**
* Transform a JTS geometric object into a GML marshallable object
*/
public Object GeometryToGML(final Object geom) {
Object result = null;
if (geom instanceof Polygon) {
final Polygon p = (Polygon) geom;
final Coordinate[] coord = p.getCoordinates();
// an envelope
if (coord.length == 5) {
final DirectPositionType lowerCorner = new DirectPositionType(coord[0].y, coord[0].x);
final DirectPositionType upperCorner = new DirectPositionType(coord[2].y, coord[2].x);
result = new EnvelopeType(null, lowerCorner, upperCorner, "EPSG:4326");
}
} else if (geom instanceof Point) {
final Point p = (Point) geom;
final Coordinate[] coord = p.getCoordinates();
result = new PointType(null, new DirectPositionType(coord[0].x, coord[0].y, coord[0].z));
((PointType) result).setSrsName("EPSG:4326");
} else if (geom instanceof LineString) {
final LineString ls = (LineString) geom;
final Coordinate[] coord = ls.getCoordinates();
result = new LineStringType(new CoordinatesType(coord[0].x + "," + coord[0].y + " " + coord[1].x + "," + coord[1].y));
((LineStringType) result).setSrsName("EPSG:4326");
} else {
LOGGER.severe("unable to create GML geometry with: " + geom.getClass().getSimpleName());
}
return result;
}
Aggregations