-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update mdMetadata to include MI_AcquisitionInformation class. Add sev…
…eral classes to support Acquisition.
- Loading branch information
1 parent
1587fa6
commit ee0d58b
Showing
7 changed files
with
454 additions
and
0 deletions.
There are no files selected for viewing
45 changes: 45 additions & 0 deletions
45
lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_acquisition.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
require_relative 'class_scope' | ||
require_relative 'class_instrument' | ||
|
||
module ADIWG | ||
module Mdtranslator | ||
module Writers | ||
module Iso19115_3 | ||
|
||
class MI_AcquisitionInformation | ||
def initialize(xml, hResponseObj) | ||
@xml = xml | ||
@hResponseObj = hResponseObj | ||
end | ||
|
||
def writeXML(hAcquisition) | ||
|
||
scopeClass = MD_Scope.new(@xml, @hResponseObj) | ||
instrumentClass = MI_Instrument.new(@xml, @hResponseObj) | ||
|
||
unless hAcquisition.empty? | ||
@xml.tag!('mac:MI_AcquisitionInformation') do | ||
unless hAcquisition[:scope].empty? | ||
@xml.tag!('mac:scope') do | ||
scopeClass.writeXML(hAcquisition[:scope]) | ||
end | ||
end | ||
|
||
unless hAcquisition[:instruments].empty? | ||
hAcquisition[:instruments].each do |hInstrument| | ||
@xml.tag!('mac:instrument') do | ||
instrumentClass.writeXML(hInstrument) | ||
end | ||
end | ||
end | ||
|
||
end | ||
end | ||
|
||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end |
95 changes: 95 additions & 0 deletions
95
lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrument.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
require_relative 'class_codelist' | ||
require_relative 'class_citation' | ||
require_relative 'class_identifier' | ||
require_relative 'class_platform' | ||
require_relative 'class_instrumentationEventList' | ||
|
||
|
||
module ADIWG | ||
module Mdtranslator | ||
module Writers | ||
module Iso19115_3 | ||
|
||
class MI_Instrument | ||
def initialize(xml, hResponseObj) | ||
@xml = xml | ||
@hResponseObj = hResponseObj | ||
end | ||
|
||
def writeXML(hInstrument) | ||
|
||
# classes used | ||
codelistClass = MD_Codelist.new(@xml, @hResponseObj) | ||
citationClass = CI_Citation.new(@xml, @hResponseObj) | ||
identifierClass = MD_Identifier.new(@xml, @hResponseObj) | ||
platformClass = MI_Platform.new(@xml, @hResponseObj) | ||
instrumentationEventListClass = MI_InstrumentationEventList.new(@xml, @hResponseObj) | ||
|
||
@xml.tag!('mac:MI_Instrument', id: hInstrument[:instrumentId]) do | ||
unless hInstrument[:citation].empty? | ||
@xml.tag!('mac:citation') do | ||
citationClass.writeXML(hInstrument[:citation]) | ||
end | ||
else | ||
if hInstrument[:citation].empty? && @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:citation') | ||
end | ||
end | ||
|
||
unless hInstrument[:identifier].empty? | ||
@xml.tag!('mac:identifier') do | ||
identifierClass.writeXML(hInstrument[:identifier]) | ||
end | ||
else | ||
if hInstrument[:identifier].empty? && @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:identifier') | ||
end | ||
end | ||
|
||
unless hInstrument[:instrumentType].empty? | ||
@xml.tag!('mac:type') do | ||
@xml.tag!('gco:CharacterString', hInstrument[:instrumentType]) | ||
end | ||
else | ||
if hInstrument[:instrumentType].empty? && @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:type') | ||
end | ||
end | ||
|
||
unless hInstrument[:description].nil? | ||
@xml.tag!('mac:description') do | ||
@xml.tag!('gco:CharacterString', hInstrument[:description]) | ||
end | ||
else | ||
if hInstrument[:description].empty? && @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:description') | ||
end | ||
end | ||
|
||
unless hInstrument[:mountedOn].empty? | ||
@xml.tag!('mac:mountedOn') do | ||
platformClass.writeXML(hInstrument[:mountedOn]) | ||
end | ||
else | ||
if hInstrument[:mountedOn].empty? && @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:mountedOn') | ||
end | ||
end | ||
|
||
unless hInstrument[:histories].empty? | ||
@xml.tag!('mac:history') do | ||
hInstrument[:histories].each do |history| | ||
instrumentationEventListClass.writeXML(history) | ||
end | ||
end | ||
end | ||
|
||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
80 changes: 80 additions & 0 deletions
80
lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrumentationEvent.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
require_relative 'class_citation' | ||
require_relative 'class_extent' | ||
require_relative 'class_revision' | ||
|
||
module ADIWG | ||
module Mdtranslator | ||
module Writers | ||
module Iso19115_3 | ||
|
||
class MI_InstrumentationEvent | ||
def initialize(xml, hResponseObj) | ||
@xml = xml | ||
@hResponseObj = hResponseObj | ||
end | ||
|
||
def writeXML(hInstrumentationEvent) | ||
|
||
citationClass = CI_Citation.new(@xml, @hResponseObj) | ||
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) | ||
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') | ||
end | ||
end | ||
|
||
unless hInstrumentationEvent[:extent].empty? | ||
@xml.tag!('mac:extent') do | ||
extentClass.writeXML(hInstrumentationEvent[:extent]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:extent') | ||
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') | ||
end | ||
end | ||
|
||
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 | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
71 changes: 71 additions & 0 deletions
71
lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_instrumentationEventList.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
require_relative 'class_citation' | ||
require_relative 'class_locale' | ||
require_relative 'class_constraint' | ||
require_relative 'class_instrumentationEvent' | ||
|
||
module ADIWG | ||
module Mdtranslator | ||
module Writers | ||
module Iso19115_3 | ||
|
||
class MI_InstrumentationEventList | ||
def initialize(xml, hResponseObj) | ||
@xml = xml | ||
@hResponseObj = hResponseObj | ||
end | ||
|
||
def writeXML(hInstrumentationEventList) | ||
|
||
citationClass = CI_Citation.new(@xml, @hResponseObj) | ||
localeClass = PT_Locale.new(@xml, @hResponseObj) | ||
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') | ||
end | ||
end | ||
|
||
unless hInstrumentationEventList[:description].nil? | ||
@xml.tag!('mac:description') do | ||
@xml.tag!('gco:CharacterString', hInstrumentationEventList[: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') | ||
end | ||
end | ||
|
||
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 | ||
|
||
end | ||
|
||
end | ||
|
||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.