use of org.geotoolkit.gml.xml.v311.PointType in project geo-platform by geosdi.
the class GMLPointGeoJsonParserTest method pointGeoJsonParserTest.
@Test
public void pointGeoJsonParserTest() throws Exception {
PointType pointType = jaxbContextBuilder.unmarshal(new File(dirFiles.concat("Point.xml")), PointType.class);
logger.info("#######################POINT_AS_GEOJSON : \n{}\n", mapper.writeValueAsString(pointParser.parseGeometryAsGeoJson(pointType)));
}
use of org.geotoolkit.gml.xml.v311.PointType in project ddf by codice.
the class SlotWebConverter method getSlotGeoMap.
private Map<String, Object> getSlotGeoMap(SlotType1 slot) {
Map<String, Object> map = new HashMap<>();
if (!slot.isSetValueList()) {
return map;
}
ValueListType valueList = (ValueListType) slot.getValueList().getValue();
for (AnyValueType anyValue : valueList.getAnyValue()) {
anyValue.getContent().stream().filter(content -> content instanceof JAXBElement).forEach(content -> {
JAXBElement jaxbElement = (JAXBElement) content;
if (jaxbElement.getValue() instanceof PointType) {
Map<String, Object> pointMap = getPointMapFromPointType((PointType) jaxbElement.getValue());
if (MapUtils.isNotEmpty(pointMap)) {
Map<String, Object> valueMap = new HashMap<>();
valueMap.put(POINT_KEY, pointMap);
map.put(VALUE, valueMap);
}
}
});
}
return map;
}
use of org.geotoolkit.gml.xml.v311.PointType in project ddf by codice.
the class SlotTypeConverter method getWrsValueList.
private Optional<net.opengis.cat.wrs.v_1_0_2.ValueListType> getWrsValueList(Map<String, Object> map) {
Optional<net.opengis.cat.wrs.v_1_0_2.ValueListType> optionalValueList = Optional.empty();
if (MapUtils.isEmpty(map) || !map.containsKey(VALUE)) {
return optionalValueList;
}
Map<String, Object> valueMap = (Map<String, Object>) map.get(VALUE);
if (valueMap.containsKey(POINT_KEY)) {
Optional<PointType> optionalPoint = getPoint((Map<String, Object>) valueMap.get(POINT_KEY));
if (optionalPoint.isPresent()) {
AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
anyValue.getContent().add(GML_FACTORY.createPoint(optionalPoint.get()));
net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = WRS_FACTORY.createValueListType();
valueList.getAnyValue().add(anyValue);
if (!optionalValueList.isPresent()) {
optionalValueList = Optional.of(WRS_FACTORY.createValueListType());
}
optionalValueList.get().getAnyValue().add(anyValue);
}
} else if (valueMap.containsKey(ENVELOPE_KEY)) {
Optional<EnvelopeType> optionalEnvelope = getEnvelope((Map<String, Object>) valueMap.get(ENVELOPE_KEY));
if (optionalEnvelope.isPresent()) {
AnyValueType anyValue = WRS_FACTORY.createAnyValueType();
anyValue.getContent().add(GML_FACTORY.createEnvelope(optionalEnvelope.get()));
net.opengis.cat.wrs.v_1_0_2.ValueListType valueList = WRS_FACTORY.createValueListType();
valueList.getAnyValue().add(anyValue);
if (!optionalValueList.isPresent()) {
optionalValueList = Optional.of(WRS_FACTORY.createValueListType());
}
optionalValueList.get().getAnyValue().add(anyValue);
}
}
return optionalValueList;
}
use of org.geotoolkit.gml.xml.v311.PointType in project ddf by codice.
the class TestWfs10JTStoGML200Converter method testGMLToGeometryCollectionType.
@Test
public void testGMLToGeometryCollectionType() throws JAXBException, SAXException, IOException, ParseException, NullPointerException {
String geometryCollectionGML = Wfs10JTStoGML200Converter.convertGeometryToGML(getGeometryFromWkt(GEOMETRYCOLLECTION));
GeometryCollectionType geometryCollectionType = (GeometryCollectionType) Wfs10JTStoGML200Converter.convertGMLToGeometryType(geometryCollectionGML, Wfs10Constants.GEOMETRY_COLLECTION);
assertFalse(geometryCollectionType == null);
List<JAXBElement<? extends GeometryAssociationType>> geometryMembers = geometryCollectionType.getGeometryMember();
assertThat(CollectionUtils.isEmpty(geometryMembers), is(Boolean.FALSE));
assertThat(geometryMembers.size() == 2, is(Boolean.TRUE));
GeometryAssociationType geometryAssociationType = geometryMembers.get(0).getValue();
JAXBElement<? extends AbstractGeometryType> jaxbElement = geometryAssociationType.getGeometry();
assertThat(Wfs10Constants.POINT.getLocalPart().equals(jaxbElement.getName().getLocalPart()), is(Boolean.TRUE));
PointType pointType = (PointType) jaxbElement.getValue();
assertThat(pointType == null, is(Boolean.FALSE));
assertThat(GEOMETRYCOLLECTION_POINT_COORD.equals(pointType.getCoordinates().getValue().trim()), is(Boolean.TRUE));
GeometryAssociationType geometryAssociationType2 = geometryMembers.get(1).getValue();
JAXBElement<? extends AbstractGeometryType> jaxbElement2 = geometryAssociationType2.getGeometry();
assertThat(Wfs10Constants.LINESTRING.getLocalPart().equals(jaxbElement2.getName().getLocalPart()), is(Boolean.TRUE));
LineStringType lineStringType = (LineStringType) jaxbElement2.getValue();
assertThat(lineStringType == null, is(Boolean.FALSE));
assertThat(GEOMETRYCOLLECTION_LINESTRING_COORD.equals(lineStringType.getCoordinates().getValue().trim()), is(Boolean.TRUE));
}
use of org.geotoolkit.gml.xml.v311.PointType in project arctic-sea by 52North.
the class GmlEncoderv321 method createMultiPointFromJtsGeometry.
private void createMultiPointFromJtsGeometry(MultiPoint geom, MultiPointType xbMultiPoint, String id) throws EncodingException {
for (int i = 0; i < geom.getNumGeometries(); i++) {
Geometry geometry = geom.getGeometryN(i);
if (geometry instanceof Point) {
PointType pt = xbMultiPoint.addNewPointMember().addNewPoint();
pt.setId(id + "_" + i);
createPointFromJtsGeometry((Point) geometry, pt);
}
}
}
Aggregations