Skip to content

Commit

Permalink
Fix outermost tags for several classes. Add event, operation and pass…
Browse files Browse the repository at this point in the history
… classes to iso 19115-3 writer.
  • Loading branch information
J-Oliveros committed Jun 4, 2024
1 parent 6bc9739 commit bf8091a
Show file tree
Hide file tree
Showing 9 changed files with 492 additions and 161 deletions.
123 changes: 123 additions & 0 deletions lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_event.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
require_relative 'class_identifier'
require_relative 'class_codelist'
require_relative 'class_gcoDateTime'
require_relative 'class_objective'
require_relative 'class_pass'
require_relative 'class_instrument'

module ADIWG
module Mdtranslator
module Writers
module Iso19115_3

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

def writeXML(hEvent)

identifierClass = Identifier.new(@xml, @hResponseObj)
codelistClass = MD_Codelist.new(@xml, @hResponseObj)
gcoDateTimeClass = GcoDateTime.new(@xml, @hResponseObj)
objectiveClass = MI_Objective.new(@xml, @hResponseObj)
passClass = MI_Pass.new(@xml, @hResponseObj)
instrumentClass = MI_Instrument.new(@xml, @hResponseObj)

@xml.tag!('mac:MI_Event') do

unless hEvent[:identifier].empty?
@xml.tag!('mac:identifier') do
identifierClass.writeXML(hEvent[:identifier])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:identifier')
end
end

unless hEvent[:trigger].nil?
@xml.tag!('mac:trigger') do
codelistClass.writeXML('mac', 'iso_triggerCode', hEvent[:trigger])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:trigger')
end
end

unless hEvent[:context].nil?
@xml.tag!('mac:context') do
codeListClass.writeXML('mac', 'iso_contextCode', hEvent[:context])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:context')
end
end

unless hEvent[:sequence].nil?
@xml.tag!('mac:sequence') do
codelistClass.writeXML('mac', 'iso_sequenceCode', hEvent[:sequence])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:sequence')
end
end

unless hEvent[:time].nil?
@xml.tag!('mac:time') do
gcoDateTimeClass.writeXML(hEvent[:time])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:time')
end
end

unless hEvent[:expectedObjectives].empty?
hEvent[:expectedObjectives].each do |hObjective|
@xml.tag!('mac:expectedObjective') do
objectiveClass.writeXML(hObjective)
end
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:expectedObjective')
end
end

unless hEvent[:relatedPass].empty?
hEvent[:relatedPass].each do |hPass|
@xml.tag!('mac:relatedPass') do
passClass.writeXML(hPass)
end
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:relatedPass')
end
end

unless hEvent[:relatedSensors].empty?
hEvent[:relatedSensors].each do |hSensor|
@xml.tag!('mac:relatedInstrument') do
instrumentClass.writeXML(hSensor)
end
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:relatedInstrument')
end
end

end
end
end

end
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -19,57 +19,59 @@ def writeXML(hInstrumentationEvent)
extentClass = EX_Extent.new(@xml, @hResponseObj)
revisionClass = MI_Revision.new(@xml, @hResponseObj)

unless hInstrumentationEvent[:citations].empty?
hInstrumentationEvent[:citations].each do |hCitation|
@xml.tag!('mac:citation') do
citationClass.writeXML(hCitation)
@xml.tag!('mac:MI_InstrumentationEvent') do
unless hInstrumentationEvent[:citations].empty?
hInstrumentationEvent[:citations].each do |hCitation|
@xml.tag!('mac:citation') do
citationClass.writeXML(hCitation)
end
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:citation')
end
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:citation')
end
end

unless hInstrumentationEvent[:description].nil?
@xml.tag!('mac:description') do
@xml.tag!('gco:CharacterString', hInstrumentationEvent[:description])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:description')
unless hInstrumentationEvent[:description].nil?
@xml.tag!('mac:description') do
@xml.tag!('gco:CharacterString', hInstrumentationEvent[:description])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:description')
end
end
end

unless hInstrumentationEvent[:extent].empty?
@xml.tag!('mac:extent') do
extentClass.writeXML(hInstrumentationEvent[:extent])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:extent')
unless hInstrumentationEvent[:extent].empty?
@xml.tag!('mac:extent') do
extentClass.writeXML(hInstrumentationEvent[:extent])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:extent')
end
end
end

unless hInstrumentationEvent[:eventType].nil?
@xml.tag!('mac:eventType') do
@xml.tag!('gco:CharacterString', hInstrumentationEvent[:eventType])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:eventType')
unless hInstrumentationEvent[:eventType].nil?
@xml.tag!('mac:eventType') do
@xml.tag!('gco:CharacterString', hInstrumentationEvent[:eventType])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:eventType')
end
end
end

unless hInstrumentationEvent[:revisionHistories].empty?
hInstrumentationEvent[:revisionHistories].each do |hRevision|
@xml.tag!('mac:revision') do
revisionClass.writeXML(hRevision)
unless hInstrumentationEvent[:revisionHistories].empty?
hInstrumentationEvent[:revisionHistories].each do |hRevision|
@xml.tag!('mac:revision') do
revisionClass.writeXML(hRevision)
end
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:revision')
end
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:revision')
end
end
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,43 +21,45 @@ def writeXML(hInstrumentationEventList)
constraintClass = Constraint.new(@xml, @hResponseObj)
instrumentationEventClass = MI_InstrumentationEvent.new(@xml, @hResponseObj)

unless hInstrumentationEventList[:citation].empty?
@xml.tag!('mac:citation') do
citationClass.writeXML(hInstrumentationEventList[:citation])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:citation')
@xml.tag!('mac:MI_InstrumentationEventList') do
unless hInstrumentationEventList[:citation].empty?
@xml.tag!('mac:citation') do
citationClass.writeXML(hInstrumentationEventList[:citation])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:citation')
end
end
end

unless hInstrumentationEventList[:description].nil?
@xml.tag!('mac:description') do
@xml.tag!('gco:CharacterString', hInstrumentationEventList[:description])
unless hInstrumentationEventList[:description].nil?
@xml.tag!('mac:description') do
@xml.tag!('gco:CharacterString', hInstrumentationEventList[:description])
end
else
@xml.tag!('mac:description')
end
else
@xml.tag!('mac:description')
end

unless hInstrumentationEventList[:locale].empty?
@xml.tag!('mac:locale') do
localeClass.writeXML(hInstrumentationEventList[:locale])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:locale')
unless hInstrumentationEventList[:locale].empty?
@xml.tag!('mac:locale') do
localeClass.writeXML(hInstrumentationEventList[:locale])
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:locale')
end
end
end

unless hInstrumentationEventList[:instrumentationEvents].empty?
hInstrumentationEventList[:instrumentationEvents].each do |hEvent|
@xml.tag!('mac:instrumentationEvent') do
instrumentationEventClass.writeXML(hEvent)
unless hInstrumentationEventList[:instrumentationEvents].empty?
hInstrumentationEventList[:instrumentationEvents].each do |hEvent|
@xml.tag!('mac:instrumentationEvent') do
instrumentationEventClass.writeXML(hEvent)
end
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:instrumentationEvent')
end
end
else
if @hResponseObj[:writerShowTags]
@xml.tag!('mac:instrumentationEvent')
end
end

Expand Down
Loading

0 comments on commit bf8091a

Please sign in to comment.