Class: ADIWG::Mdtranslator::Writers::Iso19115_3::ConstraintCommon

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

Instance Method Summary collapse

Constructor Details

#initialize(xml, hResponseObj) ⇒ ConstraintCommon

Returns a new instance of ConstraintCommon.



20
21
22
23
# File 'lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_constraintCommon.rb', line 20

def initialize(xml, hResponseObj)
   @xml = xml
   @hResponseObj = hResponseObj
end

Instance Method Details

#writeXML(hConstraint, inContext = nil) ⇒ Object



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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_constraintCommon.rb', line 25

def writeXML(hConstraint, inContext = nil)

   # classes used
   scopeClass = MD_Scope.new(@xml, @hResponseObj)
   graphClass = MD_BrowseGraphic.new(@xml, @hResponseObj)
   citationClass = CI_Citation.new(@xml, @hResponseObj)
   releaseClass = MD_Releasability.new(@xml, @hResponseObj)
   responsibleClass = CI_Responsibility.new(@xml, @hResponseObj)

   # use constraints - use limitation []
   aCons = hConstraint[:useLimitation]
   aCons.each do |useCon|
      @xml.tag!('mco:useLimitation') do
         @xml.tag!('gco:CharacterString', useCon)
      end
   end
   if aCons.empty? && @hResponseObj[:writerShowTags]
      @xml.tag!('mco:useLimitation')
   end

   # use constraints - constraint application scope {MD_Scope}
   unless hConstraint[:scope].empty?
      @xml.tag!('mco:constraintApplicationScope') do
         scopeClass.writeXML(hConstraint[:scope], inContext)
      end
   end
   if hConstraint[:scope].empty? && @hResponseObj[:writerShowTags]
      @xml.tag!('mco:constraintApplicationScope')
   end

   # use constraints - graphic [] {MD_BrowseGraphic}
   aGraphics = hConstraint[:graphic]
   aGraphics.each do |hGraphic|
      @xml.tag!('mco:graphic') do
         graphClass.writeXML(hGraphic, inContext)
      end
   end
   if aGraphics.empty? && @hResponseObj[:writerShowTags]
      @xml.tag!('mco:graphic')
   end

   # use constraints - reference [] {CI_Citation}
   aReferences = hConstraint[:reference]
   aReferences.each do |hCitation|
      @xml.tag!('mco:reference') do
         citationClass.writeXML(hCitation, inContext)
      end
   end
   if aReferences.empty? && @hResponseObj[:writerShowTags]
      @xml.tag!('mco:reference')
   end

   # use constraints - releasability {MD_Releasability}
   unless hConstraint[:releasability].empty?
      @xml.tag!('mco:releasability') do
         releaseClass.writeXML(hConstraint[:releasability], inContext)
      end
   end
   if hConstraint[:releasability].empty? && @hResponseObj[:writerShowTags]
      @xml.tag!('mco:releasability')
   end

   # use constraints - responsible party [] {CI_Responsibility}
   aParties = hConstraint[:responsibleParty]
   aParties.each do |hRParty|
      @xml.tag!('mco:responsibleParty') do
         responsibleClass.writeXML(hRParty, inContext)
      end
   end
   if aParties.empty? && @hResponseObj[:writerShowTags]
      @xml.tag!('mco:responsibleParty')
   end

end