Module: Adiwg_Extent

Defined in:
lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_extent.rb

Class Method Summary collapse

Class Method Details

.unpack(hExtent) ⇒ Object



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
# File 'lib/adiwg/mdtranslator/readers/adiwgJson/modules_0.9.0/module_extent.rb', line 18

def self.unpack(hExtent)

  # instance classes needed in script
  intMetadataClass = .new
  intExtent = intMetadataClass.newExtent

  # extent - description
  if hExtent.has_key?('description')
    s = hExtent['description']
    if s != ''
      intExtent[:extDesc] = s
    end
  end

  # extent - geographic elements
  if hExtent.has_key?('geographicElement')
    aGeoElements = hExtent['geographicElement']
    unless aGeoElements.empty?
      intExtent[:extGeoElements] = Adiwg_GeographicElement.unpack(aGeoElements)
    end
  end

  # extent - temporal elements
  if hExtent.has_key?('temporalElement')
    hTempElement = hExtent['temporalElement']
    unless hTempElement.empty?
      intExtent[:extTempElements] = Adiwg_TemporalElement.unpack(hTempElement)
    end
  end

  # extent - vertical elements
  if hExtent.has_key?('verticalElement')
    aVertElements = hExtent['verticalElement']
    unless aVertElements.empty?
      aVertElements.each do |hVertElement|
        intExtent[:extVertElements] << Adiwg_VerticalElement.unpack(hVertElement)
      end
    end
  end

  return intExtent

end