use of org.n52.shetland.ogc.gml.DomainOfValidity in project arctic-sea by 52North.
the class GmlEncoderv321 method addAbstractCRSValues.
private void addAbstractCRSValues(AbstractCRSType acrst, AbstractCRS abstractCRS) throws EncodingException {
addDefinitonValues(acrst, abstractCRS);
if (abstractCRS.hasDomainOfValidity()) {
for (Referenceable<DomainOfValidity> domainOfValidity : abstractCRS.getDomainOfValidity()) {
net.opengis.gml.x32.DomainOfValidityDocument.DomainOfValidity dov = acrst.addNewDomainOfValidity();
if (domainOfValidity.isReference()) {
Reference reference = domainOfValidity.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(dov::setActuate);
reference.getArcrole().ifPresent(dov::setArcrole);
reference.getHref().map(URI::toString).ifPresent(dov::setHref);
reference.getRole().ifPresent(dov::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(dov::setShow);
reference.getTitle().ifPresent(dov::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(dov::setType);
} else {
if (domainOfValidity.isInstance()) {
Nillable<DomainOfValidity> nillable = domainOfValidity.getInstance();
if (nillable.isPresent()) {
net.opengis.gml.x32.DomainOfValidityDocument.DomainOfValidity xml = createDomainOfValidity(nillable.get(), EncodingContext.empty());
if (xml != null) {
dov.set(xml);
} else {
dov.setNil();
dov.setNilReason(Nillable.missing().get());
}
} else {
dov.setNil();
if (nillable.hasReason()) {
dov.setNilReason(nillable.getNilReason().get());
} else {
dov.setNilReason(Nillable.missing().get());
}
}
}
}
}
}
if (abstractCRS.hasScope()) {
abstractCRS.getScope().forEach(scope -> acrst.addNewScope().setStringValue(scope));
}
}
use of org.n52.shetland.ogc.gml.DomainOfValidity in project arctic-sea by 52North.
the class GmlEncoderv321 method addAbstractDatumValues.
private void addAbstractDatumValues(AbstractDatumType adt, AbstractDatum abstractDatum, EncodingContext ctx) throws EncodingException {
addDefinitonValues(adt, abstractDatum);
if (abstractDatum.hasAnchorDefinition()) {
adt.setAnchorDefinition(createCodeType(abstractDatum.getAnchorDefinition()));
}
if (abstractDatum.hasDomainOfValidity()) {
net.opengis.gml.x32.DomainOfValidityDocument.DomainOfValidity dov = adt.addNewDomainOfValidity();
Referenceable<DomainOfValidity> domainOfValidity = abstractDatum.getDomainOfValidity();
if (domainOfValidity.isReference()) {
Reference reference = domainOfValidity.getReference();
reference.getActuate().map(Actuate::toString).map(ActuateType.Enum::forString).ifPresent(dov::setActuate);
reference.getArcrole().ifPresent(dov::setArcrole);
reference.getHref().map(URI::toString).ifPresent(dov::setHref);
reference.getRole().ifPresent(dov::setRole);
reference.getShow().map(Show::toString).map(ShowType.Enum::forString).ifPresent(dov::setShow);
reference.getTitle().ifPresent(dov::setTitle);
reference.getType().map(Type::toString).map(TypeType.Enum::forString).ifPresent(dov::setType);
} else {
if (domainOfValidity.isInstance()) {
Nillable<DomainOfValidity> nillable = domainOfValidity.getInstance();
if (nillable.isPresent()) {
net.opengis.gml.x32.DomainOfValidityDocument.DomainOfValidity xml = createDomainOfValidity(nillable.get(), EncodingContext.empty());
if (xml != null) {
dov.set(xml);
} else {
dov.setNil();
dov.setNilReason(Nillable.missing().get());
}
} else {
dov.setNil();
if (nillable.hasReason()) {
dov.setNilReason(nillable.getNilReason().get());
} else {
dov.setNilReason(Nillable.missing().get());
}
}
}
}
}
if (abstractDatum.hasRealizationEpoch()) {
adt.setRealizationEpoch(abstractDatum.getRealizationEpoch().toCalendar(Locale.ROOT));
}
abstractDatum.getScope().forEach(scope -> adt.addNewScope().setStringValue(scope));
}
Aggregations