Class: MD_Usage

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

Instance Method Summary collapse

Constructor Details

#initialize(xml) ⇒ MD_Usage

Returns a new instance of MD_Usage.



12
13
14
# File 'lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_usage.rb', line 12

def initialize(xml)
  @xml = xml
end

Instance Method Details

#writeXML(hUsage) ⇒ Object



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

def writeXML(hUsage)

  # classes used in MD_Usage
  rPartyClass = CI_ResponsibleParty.new(@xml)

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

    # usage - specific usage - required
    s = hUsage[:specificUsage]
    if s.nil?
      @xml.tag!('gmd:specificUsage',{'gco:nilReason'=>'missing'})
    else
      @xml.tag!('gmd:specificUsage') do
        @xml.tag!('gco:CharacterString',s)
      end
    end

    # usage - user determined limitations
    s = hUsage[:userLimits]
    if !s.nil?
      @xml.tag!('gmd:userDeterminedLimitations') do
        @xml.tag!('gco:CharacterString',s)
      end
    elsif $showAllTags
      @xml.tag!('gmd:userDeterminedLimitations')
    end

    # usage - user contact info - responsible party
    aContacts = hUsage[:userContacts]
    if !aContacts.empty?
      aContacts.each do |rParty|
        @xml.tag!('gmd:userContactInfo') do
          rPartyClass.writeXML(rParty)
        end
      end
    elsif $showAllTags
      @xml.tag!('gmd:userContactInfo')
    end

  end

end