Module: ADIWG::Mdtranslator::Readers::MdJson::GeometryProperties

Defined in:
lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryProperties.rb

Class Method Summary collapse

Class Method Details

.unpack(hGeoProp, responseObj) ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# 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