-
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.
Add plan, operation, requirement, requestedDate classes to iso19115-3…
… writer. Update acquisitions class to include plan
- Loading branch information
1 parent
ee0d58b
commit 6bc9739
Showing
6 changed files
with
352 additions
and
2 deletions.
There are no files selected for viewing
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
110 changes: 110 additions & 0 deletions
110
lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_operation.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,110 @@ | ||
module ADIWG | ||
module Mdtranslator | ||
module Writers | ||
module Iso19115_3 | ||
|
||
class MI_Operation | ||
def initialize(xml, hResponseObj) | ||
@xml = xml | ||
@hResponseObj = hResponseObj | ||
end | ||
|
||
def writeXML(hOperation) | ||
|
||
@xml.tag!('mac:MI_Operation') do | ||
|
||
unless hOperation[:description].nil? | ||
@xml.tag!('mac:description') do | ||
@xml.tag!('gco:CharacterString', hOperation[:description]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:description') | ||
end | ||
end | ||
|
||
unless hOperation[:citation].empty? | ||
@xml.tag!('mac:citation') do | ||
citationClass.writeXML(hOperation[:citation]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:citation') | ||
end | ||
end | ||
|
||
unless hOperation[:identifier].empty? | ||
@xml.tag!('mac:identifier') do | ||
identifierClass.writeXML(hOperation[:identifier]) | ||
end | ||
end | ||
|
||
unless hOperation[:status].nil? | ||
@xml.tag!('mac:status') do | ||
codelistClass.writeXML('mcc', 'iso_progress', hOperation[:status]) | ||
end | ||
end | ||
|
||
unless hOperation[:childOperations].empty? | ||
hOperation[:childOperations].each do |hChildOp| | ||
@xml.tag!('mac:childOperation') do | ||
operationClass.writeXML(hChildOp) | ||
end | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:childOperation') | ||
end | ||
end | ||
|
||
unless hOperation[:objectives].empty? | ||
hOperation[:objectives].each do |hObjective| | ||
@xml.tag!('mac:objective') do | ||
objectiveClass.writeXML(hObjective) | ||
end | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:objective') | ||
end | ||
end | ||
|
||
unless hOperation[:parentOperations].empty? | ||
hOperation[:parentOperations].each do |hParentOp| | ||
@xml.tag!('mac:parentOperation') do | ||
operationClass.writeXML(hParentOp) | ||
end | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:parentOperation') | ||
end | ||
end | ||
|
||
unless hOperation[:plan].empty? | ||
@xml.tag!('mac:plan') do | ||
planClass.writeXML(hOperation[:plan]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:plan') | ||
end | ||
end | ||
|
||
unless hOperation[:platform].empty? | ||
@xml.tag!('mac:platform') do | ||
platformClass.writeXML(hOperation[:platform]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:platform') | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
end |
76 changes: 76 additions & 0 deletions
76
lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_plan.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,76 @@ | ||
require_relative 'class_citation' | ||
require_relative 'class_operation' | ||
require_relative 'class_requirement' | ||
|
||
module ADIWG | ||
module Mdtranslator | ||
module Writers | ||
module Iso19115_3 | ||
|
||
class MI_Plan | ||
def initialize(xml, hResponseObj) | ||
@xml = xml | ||
@hResponseObj = hResponseObj | ||
end | ||
|
||
def writeXML(hPlan) | ||
|
||
codelistClass = MD_Codelist.new(@xml, @hResponseObj) | ||
citationClass = CI_Citation.new(@xml, @hResponseObj) | ||
operationClass = MI_Operation.new(@xml, @hResponseObj) | ||
requirementClass = MI_Requirement.new(@xml, @hResponseObj) | ||
|
||
@xml.tag!('mac:MI_Plan', type: hPlan[:planType], id: hPlan[:planId]) do | ||
unless hPlan[:planType].nil? | ||
@xml.tag!('mac:type') do | ||
codelistClass.writeXML('mac', 'iso_geometryTypeCode', hPlan[:planType]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:type') | ||
end | ||
end | ||
|
||
unless hPlan[:status].nil? | ||
@xml.tag!('mac:status') do | ||
codelistClass.writeXML('mcc', 'iso_progress', hPlan[:status]) | ||
end | ||
end | ||
|
||
unless hPlan[:citation].empty? | ||
@xml.tag!('mac:citation') do | ||
citationClass.writeXML(hPlan[:citation]) | ||
end | ||
end | ||
|
||
unless hPlan[:planOperations].empty? | ||
hPlan[:planOperations].each do |hOperation| | ||
@xml.tag!('mac:operation') do | ||
operationClass.writeXML(hOperation) | ||
end | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:operation') | ||
end | ||
end | ||
|
||
unless hPlan[:satisfiedRequirements].empty? | ||
hPlan[:satisfiedRequirements].each do |hRequirement| | ||
@xml.tag!('mac:satisfiedRequirement') do | ||
requirementClass.writeXML(hRequirement) | ||
end | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:satisfiedRequirement') | ||
end | ||
end | ||
end | ||
|
||
end | ||
end | ||
end | ||
end | ||
end | ||
end |
42 changes: 42 additions & 0 deletions
42
lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_requestedDate.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,42 @@ | ||
module ADIWG | ||
module Mdtranslator | ||
module Writers | ||
module Iso19115_3 | ||
|
||
class MI_RequestedDate | ||
def initialize(xml, hResponseObj) | ||
@xml = xml | ||
@hResponseObj = hResponseObj | ||
end | ||
|
||
def writeXML(hRequestedDate) | ||
|
||
gcoDateTimeClass = GcoDateTime.new(@xml, @hResponseObj) | ||
|
||
unless hRequestedDate[:requestedDateOfCollection].empty? | ||
@xml.tag!('mac:requestedDateOfCollection') do | ||
gcoDateTimeClass.writeXML(hRequestedDate[:requestedDateOfCollection]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:requestedDateOfCollection') | ||
end | ||
end | ||
|
||
unless hRequestedDate[:latestAcceptableDate].empty? | ||
@xml.tag!('mac:latestAcceptableDate') do | ||
gcoDateTimeClass.writeXML(hRequestedDate[:latestAcceptableDate]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:latestAcceptableDate') | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
end | ||
|
||
|
109 changes: 109 additions & 0 deletions
109
lib/adiwg/mdtranslator/writers/iso19115_3/classes/class_requirement.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,109 @@ | ||
require_relative 'class_citation' | ||
require_relative 'class_identifier' | ||
require_relative 'class_responsibility' | ||
require_relative 'class_codelist' | ||
require_relative 'class_requestedDate' | ||
require_relative 'class_gcoDateTime' | ||
require_relative 'class_plan' | ||
|
||
module ADIWG | ||
module Mdtranslator | ||
module Writers | ||
module Iso19115_3 | ||
|
||
class MI_Requirement | ||
def initialize(xml, hResponseObj) | ||
@xml = xml | ||
@hResponseObj = hResponseObj | ||
end | ||
|
||
def writeXML(hRequirement) | ||
|
||
citationClass = CI_Citation.new(@xml, @hResponseObj) | ||
identifierClass = MD_Identifier.new(@xml, @hResponseObj) | ||
responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj) | ||
codelistClass = MD_Codelist.new(@xml, @hResponseObj) | ||
requestedDateClass = MI_RequestedDate.new(@xml, @hResponseObj) | ||
gcoDateTimeClass = GcoDateTime.new(@xml, @hResponseObj) | ||
planClass = MI_Plan.new(@xml, @hResponseObj) | ||
|
||
unless hRequirement[:citation].empty? | ||
@xml.tag!('mac:citation') do | ||
citationClass.writeXML(hRequirement[:citation]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:citation') | ||
end | ||
end | ||
|
||
unless hRequirement[:identifier].empty? | ||
@xml.tag!('mac:identifier') do | ||
identifierClass.writeXML(hRequirement[:identifier]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:identifier') | ||
end | ||
end | ||
|
||
unless hRequirement[:requestors].empty? | ||
hRequirement[:requestors].each do |hResponsibility| | ||
@xml.tag!('mac:request') do | ||
responsibilityClass.writeXML(hResponsibility) | ||
end | ||
end | ||
end | ||
|
||
unless hRequirement[:recipients].empty? | ||
hRequirement[:recipients].each do |hResponsibility| | ||
@xml.tag!('mac:recipient') do | ||
responsibilityClass.writeXML(hResponsibility) | ||
end | ||
end | ||
end | ||
|
||
unless hRequirement[:priority].nil? | ||
@xml.tag!('mac:priority') do | ||
codelistClass.writeXML('mcc', 'iso_priorityCode', hRequirement[:priority]) | ||
end | ||
end | ||
|
||
unless hRequirement[:requestedDate].nil? | ||
@xml.tag!('mac:requestedDate') do | ||
requestedDateClass.writeXML(hRequirement[:requestedDate]) | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:requestedDate') | ||
end | ||
end | ||
|
||
# unless hRequirement[:expiryDate].nil? | ||
# @xml.tag!('mac:expiryDate') do | ||
# gcoDateTimeClass.writeXML(hRequirement[:expiryDate]) | ||
# end | ||
# else | ||
# if @hResponseObj[:writerShowTags] | ||
# @xml.tag!('mac:expiryDate') | ||
# end | ||
# end | ||
|
||
unless hRequirement[:satisfiedPlans].empty? | ||
hRequirement[:satisfiedPlans].each do |hPlan| | ||
@xml.tag!('mac:satisifiedPlan') do | ||
planClass.writeXML(hPlan) | ||
end | ||
end | ||
else | ||
if @hResponseObj[:writerShowTags] | ||
@xml.tag!('mac:satisifiedPlan') | ||
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