use of org.geotoolkit.gml.xml.v321.DirectPositionType in project arctic-sea by 52North.
the class GmlEncoderv321 method createPointFromJtsGeometry.
/**
* Creates a XML Point from a SOS Point.
*
* @param jtsPoint
* SOS Point
* @param xbPoint
* XML Point
*/
private void createPointFromJtsGeometry(Point jtsPoint, PointType xbPoint) {
DirectPositionType xbPos = xbPoint.addNewPos();
xbPos.setSrsName(getSrsName(jtsPoint));
xbPos.setStringValue(JTSHelper.getCoordinatesString(jtsPoint));
}
use of org.geotoolkit.gml.xml.v321.DirectPositionType 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.v321.DirectPositionType in project geotoolkit by Geomatys.
the class PropertyTypeTest method getValueGeometryNewTest.
/**
* Test simple Record Marshalling.
*
* @throws javax.xml.bind.JAXBException
*/
@Test
public void getValueGeometryNewTest() throws JAXBException {
String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" + '\n' + "<wfs:Transaction xmlns:wfs=\"http://www.opengis.net/wfs\" xmlns:gml=\"http://www.opengis.net/gml\" version=\"1.1.0\" service=\"WFS\" >" + '\n' + " <wfs:Update>" + '\n' + " <wfs:Property>" + '\n' + " <wfs:Name>something</wfs:Name>" + '\n' + " <wfs:Value>" + '\n' + " <gml:Point srsName=\"urn:ogc:def:crs:epsg:7.4:4326\" >" + '\n' + " <gml:pos>2.1 12.6</gml:pos>" + '\n' + " </gml:Point>" + '\n' + " </wfs:Value>" + '\n' + " </wfs:Property>" + '\n' + " </wfs:Update>" + '\n' + "</wfs:Transaction>" + '\n';
TransactionType result = (TransactionType) unmarshaller.unmarshal(new StringReader(xml));
assertTrue(result.getInsertOrUpdateOrDelete().size() == 1);
assertTrue(result.getInsertOrUpdateOrDelete().get(0) instanceof UpdateElementType);
UpdateElementType update = (UpdateElementType) result.getInsertOrUpdateOrDelete().get(0);
assertTrue(update.getProperty().size() == 1);
PropertyType property = update.getProperty().get(0);
PointType pt = new PointType(null, new DirectPositionType(2.1, 12.6));
pt.setSrsName("urn:ogc:def:crs:epsg:7.4:4326");
assertEquals(pt, property.getValue());
}
use of org.geotoolkit.gml.xml.v321.DirectPositionType in project geotoolkit by Geomatys.
the class WfsXMLBindingTest method marshallingTest.
@Test
public void marshallingTest() throws JAXBException {
WFSCapabilitiesType capa = new WFSCapabilitiesType();
List<FeatureTypeType> featList = new ArrayList<>();
List<String> otherSRS = Arrays.asList("urn:ogc:def:crs", "crs:EPSG::32615", "crs:EPSG::5773");
WGS84BoundingBoxType bbox = new WGS84BoundingBoxType(29.8, -90.1, 30, -89.9);
FeatureTypeType ft1 = new FeatureTypeType(new QName("http://www.opengis.net/ows-6/utds/0.3", "Building", "utds"), "", "urn:ogc:def:crs:EPSG::4979", otherSRS, Arrays.asList(bbox));
featList.add(ft1);
FeatureTypeListType featureList = new FeatureTypeListType(null, featList);
capa.setFeatureTypeList(featureList);
StringWriter sw = new StringWriter();
marshaller.marshal(capa, sw);
DeleteElementType del = null;
TransactionType transac = new TransactionType("WFS", "1.1.0", null, AllSomeType.ALL, del);
PropertyIsLikeType pis = new PropertyIsLikeType("NAME", "Ashton", "*", "?", "\\");
FilterType filter = new FilterType(pis);
DirectPositionType dp = new DirectPositionType(21400.0, 2001368.0);
PointType pt = new PointType(null, dp);
pt.setSrsName("urn:ogc:def:crs:epsg:7.4:27582");
PropertyType property = new PropertyType(new QName("the_geom"), new ValueType(pt));
UpdateElementType update = new UpdateElementType(null, Arrays.asList(property), filter, new QName("http://www.opengis.net/gml", "NamedPlaces"), null);
transac.getInsertOrUpdateOrDelete().add(update);
// marshaller.marshal(transac, System.out);
}
use of org.geotoolkit.gml.xml.v321.DirectPositionType in project geotoolkit by Geomatys.
the class WfsXMLBindingTest method marshallingTest.
@Test
public void marshallingTest() throws JAXBException {
WFSCapabilitiesType capa = new WFSCapabilitiesType();
List<FeatureTypeType> featList = new ArrayList<>();
List<String> otherSRS = Arrays.asList("urn:ogc:def:crs", "crs:EPSG::32615", "crs:EPSG::5773");
WGS84BoundingBoxType bbox = new WGS84BoundingBoxType(29.8, -90.1, 30, -89.9);
FeatureTypeType ft1 = new FeatureTypeType(new QName("http://www.opengis.net/ows-6/utds/0.3", "Building", "utds"), "", "urn:ogc:def:crs:EPSG::4979", otherSRS, Arrays.asList(bbox));
featList.add(ft1);
FeatureTypeListType featureList = new FeatureTypeListType(null, featList);
capa.setFeatureTypeList(featureList);
StringWriter sw = new StringWriter();
marshaller.marshal(capa, sw);
DeleteType del = null;
TransactionType transac = new TransactionType("WFS", "1.1.0", null, AllSomeType.ALL, del);
PropertyIsLikeType pis = new PropertyIsLikeType("NAME", "Ashton", "*", "?", "\\");
FilterType filter = new FilterType(pis);
DirectPositionType dp = new DirectPositionType(21400.0, 2001368.0);
PointType pt = new PointType(null, dp);
pt.setSrsName("urn:ogc:def:crs:epsg:7.4:27582");
PropertyType property = new PropertyType(new ValueReference(), pt);
UpdateType update = new UpdateType(null, Arrays.asList(property), filter, new QName("http://www.opengis.net/gml", "NamedPlaces"), null);
final ObjectFactory factory = new ObjectFactory();
transac.getAbstractTransactionAction().add(factory.createUpdate(update));
sw = new StringWriter();
marshaller.marshal(transac, sw);
final List<StoredQueryDescription> descriptions = new ArrayList<>();
final ParameterExpressionType param = new ParameterExpressionType("param1", "parameter 1", "a test parameter", new QName("http://www.w3.org/2001/XMLSchema", "string", "xs"));
final List<QName> types = Arrays.asList(new QName("http://test.com", "someType"));
final QueryType query = new QueryType(filter, types, "2.0.0");
final QueryExpressionTextType queryEx = new QueryExpressionTextType("urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression", query, types);
final StoredQueryDescriptionType des1 = new StoredQueryDescriptionType("query1", "title1", "abstract1", param, queryEx);
descriptions.add(des1);
final StoredQueries storesQueries = new StoredQueries(descriptions);
sw = new StringWriter();
marshaller.marshal(storesQueries, sw);
// System.out.println(sw.toString());
StoredQueryListItemType item = new StoredQueryListItemType("someid", Arrays.asList(new Title("some title")), null);
ListStoredQueriesResponseType lsqr = new ListStoredQueriesResponseType(Arrays.asList(item));
sw = new StringWriter();
marshaller.marshal(lsqr, sw);
System.out.println(sw.toString());
item = new StoredQueryListItemType("someid", Arrays.asList(new Title("some title")), Arrays.asList(new QName("")));
lsqr = new ListStoredQueriesResponseType(Arrays.asList(item));
sw = new StringWriter();
marshaller.marshal(lsqr, sw);
System.out.println(sw.toString());
}
Aggregations