Search in sources :

Example 26 with CodeType

use of org.n52.shetland.ogc.gml.CodeType in project arctic-sea by 52North.

the class GmlEncoderv321 method createAbstractGeometry.

private AbstractGeometryType createAbstractGeometry(AbstractGeometry element, EncodingContext ctx) throws EncodingException {
    XmlObject xbGeometry = createPosition(element.getGeometry(), ctx);
    AbstractGeometryType abstractGeometryType = null;
    if (xbGeometry instanceof AbstractGeometryType) {
        abstractGeometryType = (AbstractGeometryType) xbGeometry;
    } else if (xbGeometry instanceof GeometryPropertyType) {
        abstractGeometryType = ((GeometryPropertyType) xbGeometry).getAbstractGeometry();
    } else {
        throw new UnsupportedEncoderInputException(this, element);
    }
    if (element.isSetIdentifier()) {
        abstractGeometryType.setIdentifier(createCodeWithAuthorityType(element.getIdentifierCodeWithAuthority()));
    }
    if (element.isSetName()) {
        for (org.n52.shetland.ogc.gml.CodeType codeType : element.getName()) {
            abstractGeometryType.addNewName().set(createCodeType(codeType));
        }
    }
    if (element.isSetDescription()) {
        abstractGeometryType.addNewDescription().setStringValue(element.getDescription());
    }
    return abstractGeometryType;
}
Also used : AbstractGeometryType(net.opengis.gml.x32.AbstractGeometryType) XmlObject(org.apache.xmlbeans.XmlObject) GeometryPropertyType(net.opengis.gml.x32.GeometryPropertyType) UnsupportedEncoderInputException(org.n52.svalbard.encode.exception.UnsupportedEncoderInputException)

Aggregations

CodeType (org.n52.shetland.ogc.gml.CodeType)23 XmlObject (org.apache.xmlbeans.XmlObject)9 CodeWithAuthority (org.n52.shetland.ogc.gml.CodeWithAuthority)7 SamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.SamplingFeature)7 Test (org.junit.Test)5 AbstractFeature (org.n52.shetland.ogc.gml.AbstractFeature)5 XmlException (org.apache.xmlbeans.XmlException)4 OmObservationConstellation (org.n52.shetland.ogc.om.OmObservationConstellation)4 URI (java.net.URI)3 ArrayList (java.util.ArrayList)3 GeographicalName (org.n52.shetland.inspire.GeographicalName)3 Spelling (org.n52.shetland.inspire.Spelling)3 TimeInstant (org.n52.shetland.ogc.gml.time.TimeInstant)3 OmObservableProperty (org.n52.shetland.ogc.om.OmObservableProperty)3 AbstractSamplingFeature (org.n52.shetland.ogc.om.features.samplingFeatures.AbstractSamplingFeature)3 QuantityValue (org.n52.shetland.ogc.om.values.QuantityValue)3 DecodingException (org.n52.svalbard.decode.exception.DecodingException)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 XmlOptions (org.apache.xmlbeans.XmlOptions)2 Before (org.junit.Before)2