use of org.n52.shetland.ogc.gml.VerticalCS in project arctic-sea by 52North.
the class GmlEncoderv321 method createVerticalCRS.
private XmlObject createVerticalCRS(VerticalCRS verticalCRS, EncodingContext ctx) throws EncodingException {
VerticalCRSType vcrst = VerticalCRSType.Factory.newInstance();
addAbstractCRSValues(vcrst, verticalCRS);
// verticalCS
Referenceable<VerticalCS> verticalCS = verticalCRS.getVerticalCS();
VerticalCSPropertyType vcspt = vcrst.addNewVerticalCS();
if (verticalCS.isReference()) {
Reference reference = verticalCS.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(vcspt::setActuate);
reference.getArcrole().ifPresent(vcspt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(vcspt::setHref);
reference.getRole().ifPresent(vcspt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(vcspt::setShow);
reference.getTitle().ifPresent(vcspt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(vcspt::setType);
} else {
if (verticalCS.isInstance()) {
Nillable<VerticalCS> nillable = verticalCS.getInstance();
if (nillable.isPresent()) {
XmlObject xml = createVerticalCS(nillable.get(), EncodingContext.empty());
if (xml != null && xml instanceof VerticalCSType) {
vcspt.set((VerticalCSType) xml);
} else {
vcspt.setNil();
vcspt.setNilReason(Nillable.missing().get());
}
} else {
vcspt.setNil();
if (nillable.hasReason()) {
vcspt.setNilReason(nillable.getNilReason().get());
} else {
vcspt.setNilReason(Nillable.missing().get());
}
}
}
}
// verticalDatum
Referenceable<VerticalDatum> verticalDatum = verticalCRS.getVerticalDatum();
VerticalDatumPropertyType vdpt = vcrst.addNewVerticalDatum();
if (verticalDatum.isReference()) {
Reference reference = verticalDatum.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(vdpt::setActuate);
reference.getArcrole().ifPresent(vdpt::setArcrole);
reference.getHref().map(URI::toString).ifPresent(vdpt::setHref);
reference.getRole().ifPresent(vdpt::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(vdpt::setShow);
reference.getTitle().ifPresent(vdpt::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(vdpt::setType);
} else {
if (verticalDatum.isInstance()) {
Nillable<VerticalDatum> nillable = verticalDatum.getInstance();
if (nillable.isPresent()) {
XmlObject xml = createVerticalDatum(nillable.get(), EncodingContext.empty());
if (xml != null && xml instanceof VerticalDatumType) {
vdpt.setVerticalDatum((VerticalDatumType) xml);
} else {
vdpt.setNil();
vdpt.setNilReason(Nillable.missing().get());
}
} else {
vdpt.setNil();
if (nillable.hasReason()) {
vdpt.setNilReason(nillable.getNilReason().get());
} else {
vdpt.setNilReason(Nillable.missing().get());
}
}
}
}
if (ctx.has(XmlBeansEncodingFlags.PROPERTY_TYPE)) {
VerticalCRSPropertyType vcrspt = VerticalCRSPropertyType.Factory.newInstance();
vcrspt.setVerticalCRS(vcrst);
return vcrspt;
}
return vcrst;
}
Aggregations