use of net.opengis.samplingSpatial.x20.SFSpatialSamplingFeatureDocument in project arctic-sea by 52North.
the class SamplingDecoderv20 method getXmlDescription.
private String getXmlDescription(final SFSpatialSamplingFeatureType spatialSamplingFeature) {
final SFSpatialSamplingFeatureDocument featureDoc = SFSpatialSamplingFeatureDocument.Factory.newInstance(getXmlOptions());
featureDoc.setSFSpatialSamplingFeature(spatialSamplingFeature);
return featureDoc.xmlText(getXmlOptions());
}
use of net.opengis.samplingSpatial.x20.SFSpatialSamplingFeatureDocument in project arctic-sea by 52North.
the class SamplingEncoderv20 method createFeature.
protected XmlObject createFeature(final AbstractFeature absFeature) throws EncodingException {
if (absFeature instanceof AbstractSamplingFeature) {
final AbstractSamplingFeature sampFeat = (AbstractSamplingFeature) absFeature;
final SFSpatialSamplingFeatureDocument xbSampFeatDoc = SFSpatialSamplingFeatureDocument.Factory.newInstance(getXmlOptions());
if (sampFeat.isSetXml()) {
try {
final XmlObject feature = XmlObject.Factory.parse(sampFeat.getXml(), getXmlOptions());
if (XmlHelper.getNamespace(feature).equals(SfConstants.NS_SAMS)) {
XmlHelper.updateGmlIDs(feature.getDomNode().getFirstChild(), absFeature.getGmlId(), null);
if (feature instanceof SFSpatialSamplingFeatureType) {
xbSampFeatDoc.setSFSpatialSamplingFeature((SFSpatialSamplingFeatureType) feature);
encodeShape(xbSampFeatDoc.getSFSpatialSamplingFeature().getShape(), sampFeat);
addNameDescription(xbSampFeatDoc.getSFSpatialSamplingFeature(), sampFeat);
return xbSampFeatDoc;
}
encodeShape(((SFSpatialSamplingFeatureDocument) feature).getSFSpatialSamplingFeature().getShape(), sampFeat);
addNameDescription(((SFSpatialSamplingFeatureDocument) feature).getSFSpatialSamplingFeature(), sampFeat);
sampFeat.wasEncoded();
return feature;
} else {
return encodeObjectToXml(XmlHelper.getNamespace(feature), absFeature);
}
} catch (final XmlException xmle) {
throw new EncodingException("Error while encoding GetFeatureOfInterest response, invalid samplingFeature description!", xmle);
}
}
final SFSpatialSamplingFeatureType xbSampFeature = xbSampFeatDoc.addNewSFSpatialSamplingFeature();
// TODO: CHECK for all fields set gml:id
addId(xbSampFeature, sampFeat);
addIdentifier(xbSampFeature, sampFeat);
// set type
addFeatureType(xbSampFeature, sampFeat);
// set type
addNameDescription(xbSampFeature, sampFeat);
setMetaDataProperty(xbSampFeature, sampFeat);
// set sampledFeatures
// TODO: CHECK
addSampledFeatures(xbSampFeature, sampFeat);
addParameter(xbSampFeature, sampFeat);
// set position
encodeShape(xbSampFeature.addNewShape(), sampFeat);
sampFeat.wasEncoded();
return xbSampFeatDoc;
}
throw new UnsupportedEncoderInputException(this, absFeature);
}
Aggregations