use of net.opengis.gml.x32.FeatureCollectionDocument in project arctic-sea by 52North.
the class GmlEncoderv321 method createFeatureCollection.
private XmlObject createFeatureCollection(FeatureCollection element, EncodingContext ctx) throws EncodingException {
FeatureCollectionDocument featureCollectionDoc = FeatureCollectionDocument.Factory.newInstance(getXmlOptions());
FeatureCollectionType featureCollection = featureCollectionDoc.addNewFeatureCollection();
featureCollection.setId(element.getGmlId());
EncodingContext context = ctx.with(XmlBeansEncodingFlags.PROPERTY_TYPE).without(XmlBeansEncodingFlags.DOCUMENT);
if (element.isSetMembers()) {
for (AbstractFeature abstractFeature : element.getMembers().values()) {
featureCollection.addNewFeatureMember().set(createFeaturePropertyType(abstractFeature, context));
}
}
if (ctx.has(XmlBeansEncodingFlags.DOCUMENT)) {
return featureCollectionDoc;
}
FeaturePropertyType featurePropertyType = FeaturePropertyType.Factory.newInstance(getXmlOptions());
featurePropertyType.addNewAbstractFeature().set(featureCollection);
return XmlHelper.substituteElement(featurePropertyType.getAbstractFeature(), featurePropertyType);
// return featureCollection;
}
Aggregations