Search in sources :

Example 1 with GmlBaseUnit

use of org.n52.shetland.iso.gmd.GmlBaseUnit in project arctic-sea by 52North.

the class Iso19139GmdEncoder method encodeGmdQuantitativeResult.

private void encodeGmdQuantitativeResult(DQResultPropertyType xbResult, GmdQuantitativeResult gmdQuantitativeResult) {
    DQQuantitativeResultType dqQuantitativeResultType = (DQQuantitativeResultType) xbResult.addNewAbstractDQResult().substitute(QN_GMD_QUANTITATIVE_RESULT, DQQuantitativeResultType.type);
    GmlBaseUnit unit = gmdQuantitativeResult.getUnit();
    UnitOfMeasurePropertyType valueUnit = dqQuantitativeResultType.addNewValueUnit();
    BaseUnitType xbBaseUnit = (BaseUnitType) valueUnit.addNewUnitDefinition().substitute(QN_GML_BASE_UNIT, BaseUnitType.type);
    CodeType xbCatalogSymbol = xbBaseUnit.addNewCatalogSymbol();
    xbCatalogSymbol.setCodeSpace(unit.getCatalogSymbol().getCodeSpace().toString());
    xbCatalogSymbol.setStringValue(unit.getCatalogSymbol().getValue());
    xbBaseUnit.setId(unit.getId());
    xbBaseUnit.addNewUnitsSystem().setHref(unit.getUnitSystem());
    xbBaseUnit.addNewIdentifier().setCodeSpace(unit.getIdentifier());
    if (gmdQuantitativeResult.isSetValueNilReason()) {
        dqQuantitativeResultType.addNewValue().setNilReason(gmdQuantitativeResult.getValueNilReason().name());
    } else {
        XmlCursor cursor = dqQuantitativeResultType.addNewValue().addNewRecord().newCursor();
        cursor.toNextToken();
        cursor.insertChars(gmdQuantitativeResult.getValue());
        cursor.dispose();
    }
}
Also used : UnitOfMeasurePropertyType(org.isotc211.x2005.gco.UnitOfMeasurePropertyType) BaseUnitType(net.opengis.gml.x32.BaseUnitType) CodeType(net.opengis.gml.x32.CodeType) GmlBaseUnit(org.n52.shetland.iso.gmd.GmlBaseUnit) DQQuantitativeResultType(org.isotc211.x2005.gmd.DQQuantitativeResultType) XmlCursor(org.apache.xmlbeans.XmlCursor)

Aggregations

BaseUnitType (net.opengis.gml.x32.BaseUnitType)1 CodeType (net.opengis.gml.x32.CodeType)1 XmlCursor (org.apache.xmlbeans.XmlCursor)1 UnitOfMeasurePropertyType (org.isotc211.x2005.gco.UnitOfMeasurePropertyType)1 DQQuantitativeResultType (org.isotc211.x2005.gmd.DQQuantitativeResultType)1 GmlBaseUnit (org.n52.shetland.iso.gmd.GmlBaseUnit)1