Class: ADIWG::Mdtranslator::Writers::Iso19115_2::DQ_Scope

Inherits:
Object
  • Object
show all
Defined in:
lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb

Instance Method Summary collapse

Constructor Details

#initialize(xml, responseObj) ⇒ DQ_Scope



20
21
22
23
24
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb', line 20

def initialize(xml, responseObj)
   @xml = xml
   @hResponseObj = responseObj
   @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
end

Instance Method Details

#writeXML(hScope, inContext = nil) ⇒ Object



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
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb', line 26

def writeXML(hScope, inContext = nil)

   # classes used
   codelistClass = MD_Codelist.new(@xml, @hResponseObj)
   extentClass = EX_Extent.new(@xml, @hResponseObj)
   descriptionClass = MD_ScopeDescription.new(@xml, @hResponseObj)

   @xml.tag!('gmd:DQ_Scope') do

      # scope - level (required)
      s = hScope[:scopeCode]
      unless s.nil?
         @xml.tag!('gmd:level') do
            codelistClass.writeXML('gmd', 'iso_scope', s)
         end
      end
      if s.nil?
         @NameSpace.issueWarning(280, 'gmd:level', inContext)
      end

      # scope - extent [0] {EX_Extent}
      # ... only one extent allowed in ISO 19115-2
      aExtents = hScope[:extents]
      unless aExtents.empty?
         @xml.tag!('gmd:extent') do
            extentClass.writeXML(aExtents[0])
         end
      end
      if aExtents.empty? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:extent')
      end

      # scope - level description [{MD_ScopeDescription}]
      # ... write gmd:levelDescription tag from class_scopeDescription
      aDescription = hScope[:scopeDescriptions]
      aDescription.each do |hDescription|
         descriptionClass.writeXML(hDescription)
      end
      if aDescription.empty? && @hResponseObj[:writerShowTags]
         @xml.tag!('gmd:levelDescription')
      end

   end # gmd:DQ_Scope tag
end