use of net.opengis.gml.FeaturePropertyType in project arctic-sea by 52North.
the class GmlEncoderv311 method createFeature.
private XmlObject createFeature(AbstractFeature sosAbstractFeature) throws EncodingException {
if (sosAbstractFeature instanceof SamplingFeature) {
SamplingFeature sampFeat = (SamplingFeature) sosAbstractFeature;
if (sosAbstractFeature.isSetGmlID()) {
FeaturePropertyType featureProperty = FeaturePropertyType.Factory.newInstance(getXmlOptions());
featureProperty.setHref("#" + sosAbstractFeature.getGmlId());
return featureProperty;
} else {
if (!sampFeat.isSetGeometry()) {
FeaturePropertyType featureProperty = FeaturePropertyType.Factory.newInstance(getXmlOptions());
featureProperty.setHref(sosAbstractFeature.getIdentifierCodeWithAuthority().getValue());
if (sampFeat.isSetName()) {
featureProperty.setTitle(sampFeat.getFirstName().getValue());
}
return featureProperty;
}
StringBuilder builder = new StringBuilder();
builder.append("sf_");
builder.append(JavaHelper.generateID(sosAbstractFeature.getIdentifierCodeWithAuthority().getValue()));
sosAbstractFeature.setGmlId(builder.toString());
Encoder<XmlObject, SamplingFeature> encoder = getEncoder(SfConstants.NS_SA, sampFeat);
return encoder.encode(sampFeat);
}
} else if (sosAbstractFeature instanceof FeatureCollection) {
return createFeatureCollection((FeatureCollection) sosAbstractFeature);
}
throw new UnsupportedEncoderInputException(this, sosAbstractFeature);
}
use of net.opengis.gml.FeaturePropertyType in project arctic-sea by 52North.
the class SamplingEncoderv100 method addValuesToFeature.
private void addValuesToFeature(SamplingFeatureType xbSamplingFeature, AbstractSamplingFeature sampFeat) throws EncodingException {
xbSamplingFeature.setId(sampFeat.getGmlId());
if (sampFeat.isSetIdentifier()) {
sampFeat.getIdentifierCodeWithAuthority().setCodeSpace("uniquID");
xbSamplingFeature.addNewName().set(encodeObjectToXml(GmlConstants.NS_GML, sampFeat.getIdentifierCodeWithAuthority()));
}
if (sampFeat.isSetName()) {
for (CodeType sosName : sampFeat.getName()) {
xbSamplingFeature.addNewName().set(encodeObjectToXml(GmlConstants.NS_GML, sosName));
}
}
// TODO: CHECK
if (sampFeat.getSampledFeatures() != null && !sampFeat.getSampledFeatures().isEmpty()) {
for (AbstractFeature sampledFeature : sampFeat.getSampledFeatures()) {
FeaturePropertyType sp = xbSamplingFeature.addNewSampledFeature();
sp.setHref(sampledFeature.getIdentifier());
if (sampFeat.isSetName() && sampFeat.getFirstName().isSetValue()) {
sp.setTitle(sampFeat.getFirstName().getValue());
}
// xbSamplingFeature.addNewSampledFeature().set(createFeature(sampledFeature));
}
} else {
xbSamplingFeature.addNewSampledFeature().setHref(GmlConstants.NIL_UNKNOWN);
}
// set metadataProperty
setMetaDataProperty(xbSamplingFeature, sampFeat);
}
Aggregations