module ADIWG::Mdtranslator::Readers::MdJson::GeometryProperties

Public Class Methods

unpack(hGeoProp, responseObj) click to toggle source
# File lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb, line 17
def self.unpack(hGeoProp, responseObj)

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

   # return nil object if input is empty
   if hGeoProp.empty?
      @MessagePath.issueWarning(390, responseObj)
      return nil
   end

   # instance classes needed in script
   intMetadataClass = InternalMetadata.new
   intGeoProp = intMetadataClass.newGeometryProperties

   # geometry properties - feature name []
   if hGeoProp.has_key?('featureName')
      hGeoProp['featureName'].each do |item|
         if item != ''
            intGeoProp[:featureNames] << item
         end
      end
   end

   # geometry properties - description
   if hGeoProp.has_key?('description')
      unless hGeoProp['description'] == ''
         intGeoProp[:description] = hGeoProp['description']
      end
   end

   # geometry properties - [{Identifier}]
   if hGeoProp.has_key?('identifier')
      aItems = hGeoProp['identifier']
      aItems.each do |item|
         hReturn = Identifier.unpack(item, responseObj)
         unless hReturn.nil?
            intGeoProp[:identifiers] << hReturn
         end
      end
   end

   # geometry properties - feature scope
   if hGeoProp.has_key?('featureScope')
      unless hGeoProp['featureScope'] == ''
         intGeoProp[:featureScope] = hGeoProp['featureScope']
      end
   end

   # geometry properties - acquisition method
   if hGeoProp.has_key?('acquisitionMethod')
      unless hGeoProp['acquisitionMethod'] == ''
         intGeoProp[:acquisitionMethod] = hGeoProp['acquisitionMethod']
      end
   end

   return intGeoProp

end