use of org.geotoolkit.gml.xml.v321.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);
}
}
}
use of org.geotoolkit.gml.xml.v321.PointType 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<FeatureTypeType>();
LatLongBoundingBoxType bbox = new LatLongBoundingBoxType(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", 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", "*", "?", "\\");
org.geotoolkit.ogc.xml.v100.ObjectFactory factory = new org.geotoolkit.ogc.xml.v100.ObjectFactory();
final JAXBElement<? extends ComparisonOpsType> jbPis = factory.createPropertyIsLike(pis);
FilterType filter = new FilterType(null, jbPis, null, null);
CoordType dp = new CoordType(21400.0, 2001368.0);
PointType pt = new PointType(dp);
pt.setSrsName("urn:ogc:def:crs:epsg:7.4:27582");
PropertyType property = new PropertyType("the_geom", pt);
UpdateElementType update = new UpdateElementType(Arrays.asList(property), filter, new QName("http://www.opengis.net/gml", "NamedPlaces"));
transac.getInsertOrUpdateOrDelete().add(update);
// marshaller.marshal(transac, System.out);
}
use of org.geotoolkit.gml.xml.v321.PointType 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.PointType 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.PointType 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