Search in sources :

Example 1 with FeatureCollectionDocument

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;
}
Also used : FeatureCollectionType(net.opengis.gml.x32.FeatureCollectionType) FeatureCollectionDocument(net.opengis.gml.x32.FeatureCollectionDocument) AbstractFeature(org.n52.shetland.ogc.gml.AbstractFeature) FeaturePropertyType(net.opengis.gml.x32.FeaturePropertyType)

Aggregations

FeatureCollectionDocument (net.opengis.gml.x32.FeatureCollectionDocument)1 FeatureCollectionType (net.opengis.gml.x32.FeatureCollectionType)1 FeaturePropertyType (net.opengis.gml.x32.FeaturePropertyType)1 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)1