module ADIWG::Mdtranslator::Readers::MdJson::VerticalExtent

Public Class Methods

unpack(hVertical, responseObj, inContext = nil) click to toggle source
# File lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalExtent.rb, line 17
def self.unpack(hVertical, responseObj, inContext = nil)

   @MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson

   # return nil object if input is empty
   if hVertical.empty?
      @MessagePath.issueWarning(930, responseObj, inContext)
      return nil
   end

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new
   intVertical = intMetadataClass.newVerticalExtent

   outContext = 'vertical extent'
   outContext = inContext + ' > ' + outContext unless inContext.nil?

   # vertical extent - description
   if hVertical.has_key?('description')
      unless hVertical['description'] == ''
         intVertical[:description] = hVertical['description']
      end
   end

   # vertical extent - min value (required)
   if hVertical.has_key?('minValue')
      intVertical[:minValue] = hVertical['minValue']
   end
   if intVertical[:minValue].nil? || intVertical[:minValue] == ''
      @MessagePath.issueError(931, responseObj, inContext)
   end

   # vertical extent - max value (required)
   if hVertical.has_key?('maxValue')
      intVertical[:maxValue] = hVertical['maxValue']
   end
   if intVertical[:maxValue].nil? || intVertical[:maxValue] == ''
      @MessagePath.issueError(932, responseObj, inContext)
   end

   # vertical extent - crs ID {spatialReference} (required)
   if hVertical.has_key?('crsId')
      hObject = hVertical['crsId']
      unless hObject.empty?
         hReturn = SpatialReferenceSystem.unpack(hObject, responseObj, outContext)
         unless hReturn.nil?
            intVertical[:crsId] = hReturn
         end
      end
   end
   if intVertical[:crsId].empty?
      @MessagePath.issueError(933, responseObj, inContext)
   end

   return intVertical

end