module ADIWG::Mdtranslator::Readers::MdJson::SpatialResolution
Public Class Methods
unpack(hResolution, responseObj, inContext = nil)
click to toggle source
# File lib/adiwg/mdtranslator/readers/mdJson/modules/module_spatialResolution.rb, line 27 def self.unpack(hResolution, responseObj, inContext = nil) @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson # return nil object if input is empty if hResolution.empty? @MessagePath.issueWarning(800, responseObj, inContext) return nil end # instance classes needed in script intMetadataClass = InternalMetadata.new intResolution = intMetadataClass.newSpatialResolution outContext = 'spatial resolution' outContext = inContext + ' > ' + outContext unless inContext.nil? haveOne = false # spatial resolution - scale factor (required if not others) if hResolution.has_key?('scaleFactor') unless hResolution['scaleFactor'] == '' intResolution[:scaleFactor] = hResolution['scaleFactor'] haveOne = true end end # spatial resolution - measure (required if not others) if hResolution.has_key?('measure') hMeasure = hResolution['measure'] unless hMeasure.empty? hObject = Measure.unpack(hMeasure, responseObj, outContext) unless hObject.nil? intResolution[:measure] = hObject haveOne = true end end end # spatial resolution - coordinate resolution (required if not others) if hResolution.has_key?('coordinateResolution') hCoordRes = hResolution['coordinateResolution'] unless hCoordRes.empty? hReturn = CoordinateResolution.unpack(hCoordRes, responseObj, outContext) unless hReturn.nil? intResolution[:coordinateResolution] = hReturn haveOne = true end end end # spatial resolution - bearing distance resolution (required if not others) if hResolution.has_key?('bearingDistanceResolution') hBearRes = hResolution['bearingDistanceResolution'] unless hBearRes.empty? hReturn = BearingDistanceResolution.unpack(hBearRes, responseObj, outContext) unless hReturn.nil? intResolution[:bearingDistanceResolution] = hReturn haveOne = true end end end # spatial resolution - geographic resolution (required if not others) if hResolution.has_key?('geographicResolution') hGeoRes = hResolution['geographicResolution'] unless hGeoRes.empty? hReturn = GeographicResolution.unpack(hGeoRes, responseObj, outContext) unless hReturn.nil? intResolution[:geographicResolution] = hReturn haveOne = true end end end # spatial resolution - level of detail (required if not others) if hResolution.has_key?('levelOfDetail') unless hResolution['levelOfDetail'] == '' intResolution[:levelOfDetail] = hResolution['levelOfDetail'] haveOne = true end end # error messages unless haveOne @MessagePath.issueError(801, responseObj, inContext) end return intResolution end