adiwg-mdtranslator 2.16.1 → 2.17.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +29 -2
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +2 -3
- data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +6 -2
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +3 -14
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processing.rb +4 -5
- data/lib/adiwg/mdtranslator/version.rb +3 -1
- data/lib/adiwg/mdtranslator/writers/html/sections/html_algorithm.rb +48 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_nominalResolution.rb +51 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_processReport.rb +47 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_processStep.rb +35 -8
- data/lib/adiwg/mdtranslator/writers/html/sections/html_processing.rb +89 -0
- data/lib/adiwg/mdtranslator/writers/html/sections/html_source.rb +25 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_algorithm.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_leProcessStep.rb +167 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_leSource.rb +150 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_liProcessStep.rb +130 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_liSource.rb +126 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineage.rb +5 -4
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_nominalResolution.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processReport.rb +66 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb +22 -101
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processing.rb +110 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +19 -95
- data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer_messages_eng.yml +11 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_algorithm.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_leProcessStep.rb +153 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_leSource.rb +134 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liProcessStep.rb +126 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liSource.rb +114 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +13 -11
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_nominalResolution.rb +61 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processReport.rb +66 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +22 -96
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processing.rb +110 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +20 -82
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +2 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +9 -0
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processStep.rb +0 -1
- data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processing.rb +1 -1
- metadata +22 -2
@@ -0,0 +1,126 @@
|
|
1
|
+
# ISO <<Class>> LI_Source
|
2
|
+
# 19115-1 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2019-04-10 original script.
|
6
|
+
|
7
|
+
require_relative 'class_resolution'
|
8
|
+
require_relative 'class_referenceSystem'
|
9
|
+
require_relative 'class_citation'
|
10
|
+
require_relative 'class_scope'
|
11
|
+
require_relative 'class_processStep'
|
12
|
+
|
13
|
+
module ADIWG
|
14
|
+
module Mdtranslator
|
15
|
+
module Writers
|
16
|
+
module Iso19115_1
|
17
|
+
|
18
|
+
class LI_Source
|
19
|
+
|
20
|
+
def initialize(xml, hResponseObj)
|
21
|
+
@xml = xml
|
22
|
+
@hResponseObj = hResponseObj
|
23
|
+
end
|
24
|
+
|
25
|
+
def writeXML(hSource, inContext = nil)
|
26
|
+
|
27
|
+
# classes used
|
28
|
+
resolutionClass = MD_Resolution.new(@xml, @hResponseObj)
|
29
|
+
referenceClass = MD_ReferenceSystem.new(@xml, @hResponseObj)
|
30
|
+
citationClass = CI_Citation.new(@xml, @hResponseObj)
|
31
|
+
scopeClass = MD_Scope.new(@xml, @hResponseObj)
|
32
|
+
stepClass = ProcessStep.new(@xml, @hResponseObj)
|
33
|
+
|
34
|
+
outContext = 'source'
|
35
|
+
outContext = outContext + ' ' + hSource[:sourceId].to_s unless hSource[:sourceId].nil?
|
36
|
+
outContext = inContext + ' source' unless inContext.nil?
|
37
|
+
|
38
|
+
# source - id (tag attribute id="")
|
39
|
+
attributes = {}
|
40
|
+
s = hSource[:sourceId]
|
41
|
+
unless s.nil?
|
42
|
+
attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
|
43
|
+
end
|
44
|
+
|
45
|
+
@xml.tag!('mrl:LI_Source', attributes) do
|
46
|
+
|
47
|
+
# source - description
|
48
|
+
unless hSource[:description].nil?
|
49
|
+
@xml.tag!('mrl:description') do
|
50
|
+
@xml.tag!('gco:CharacterString', hSource[:description])
|
51
|
+
end
|
52
|
+
end
|
53
|
+
if hSource[:description].nil? && @hResponseObj[:writerShowTags]
|
54
|
+
@xml.tag!('mrl:description')
|
55
|
+
end
|
56
|
+
|
57
|
+
# source - spatial resolution {MD_Resolution}
|
58
|
+
unless hSource[:spatialResolution].empty?
|
59
|
+
@xml.tag!('mrl:sourceSpatialResolution') do
|
60
|
+
resolutionClass.writeXML(hSource[:spatialResolution], outContext)
|
61
|
+
end
|
62
|
+
end
|
63
|
+
if hSource[:spatialResolution].empty? && @hResponseObj[:writerShowTags]
|
64
|
+
@xml.tag!('mrl:sourceSpatialResolution')
|
65
|
+
end
|
66
|
+
|
67
|
+
# source - reference system {MD_ReferenceSystem}
|
68
|
+
unless hSource[:referenceSystem].empty?
|
69
|
+
@xml.tag!('mrl:sourceReferenceSystem') do
|
70
|
+
referenceClass.writeXML(hSource[:referenceSystem])
|
71
|
+
end
|
72
|
+
end
|
73
|
+
if hSource[:referenceSystem].empty? && @hResponseObj[:writerShowTags]
|
74
|
+
@xml.tag!('mrl:sourceReferenceSystem')
|
75
|
+
end
|
76
|
+
|
77
|
+
# source - citation {CI_Citation}
|
78
|
+
unless hSource[:sourceCitation].empty?
|
79
|
+
@xml.tag!('mrl:sourceCitation') do
|
80
|
+
citationClass.writeXML(hSource[:sourceCitation], outContext)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
if hSource[:sourceCitation].empty? && @hResponseObj[:writerShowTags]
|
84
|
+
@xml.tag!('mrl:sourceCitation')
|
85
|
+
end
|
86
|
+
|
87
|
+
# source - metadata [] {CI_Citation}
|
88
|
+
aCitations = hSource[:metadataCitations]
|
89
|
+
aCitations.each do |hCitation|
|
90
|
+
@xml.tag!('mrl:sourceMetadata') do
|
91
|
+
citationClass.writeXML(hCitation, outContext)
|
92
|
+
end
|
93
|
+
end
|
94
|
+
if aCitations.empty? && @hResponseObj[:writerShowTags]
|
95
|
+
@xml.tag!('mrl:sourceMetadata')
|
96
|
+
end
|
97
|
+
|
98
|
+
# source - scope {MD_Scope}
|
99
|
+
unless hSource[:scope].empty?
|
100
|
+
@xml.tag!('mrl:scope') do
|
101
|
+
scopeClass.writeXML(hSource[:scope], outContext)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
if hSource[:scope].empty? && @hResponseObj[:writerShowTags]
|
105
|
+
@xml.tag!('mrl:scope')
|
106
|
+
end
|
107
|
+
|
108
|
+
# source - process step [] {ProcessStep}
|
109
|
+
aSteps = hSource[:sourceSteps]
|
110
|
+
aSteps.each do |hStep|
|
111
|
+
@xml.tag!('mrl:sourceStep') do
|
112
|
+
stepClass.writeXML(hStep)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
if aSteps.empty? && @hResponseObj[:writerShowTags]
|
116
|
+
@xml.tag!('mrl:sourceStep')
|
117
|
+
end
|
118
|
+
|
119
|
+
end # mrl:LI_Source tag
|
120
|
+
end # writeXML
|
121
|
+
end # LI_Source class
|
122
|
+
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# 19115-1 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
+
# Stan Smith 2019-09-25 add support for LE_Source and LE_ProcessStep
|
5
6
|
# Stan Smith 2019-04-10 original script.
|
6
7
|
|
7
8
|
require_relative 'class_scope'
|
@@ -26,8 +27,8 @@ module ADIWG
|
|
26
27
|
# classes used
|
27
28
|
scopeClass = MD_Scope.new(@xml, @hResponseObj)
|
28
29
|
citationClass = CI_Citation.new(@xml, @hResponseObj)
|
29
|
-
sourceClass =
|
30
|
-
processClass =
|
30
|
+
sourceClass = Source.new(@xml, @hResponseObj)
|
31
|
+
processClass = ProcessStep.new(@xml, @hResponseObj)
|
31
32
|
|
32
33
|
outContext = 'resource lineage'
|
33
34
|
outContext = inContext + ' resource lineage' unless inContext.nil?
|
@@ -65,7 +66,7 @@ module ADIWG
|
|
65
66
|
@xml.tag!('mrl:additionalDocumentation')
|
66
67
|
end
|
67
68
|
|
68
|
-
# lineage - source [] {
|
69
|
+
# lineage - source [] {Source}
|
69
70
|
aSources = hLineage[:dataSources]
|
70
71
|
aSources.each do |hSource|
|
71
72
|
@xml.tag!('mrl:source') do
|
@@ -76,7 +77,7 @@ module ADIWG
|
|
76
77
|
@xml.tag!('mrl:source')
|
77
78
|
end
|
78
79
|
|
79
|
-
# lineage - process step [] {
|
80
|
+
# lineage - process step [] {ProcessStep}
|
80
81
|
aSteps = hLineage[:processSteps]
|
81
82
|
aSteps.each do |pStep|
|
82
83
|
@xml.tag!('mrl:processStep') do
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# ISO <<Class>> LE_NominalResolution
|
2
|
+
# 19115-1 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 201-09-27 original script.
|
6
|
+
|
7
|
+
require_relative '../iso19115_1_writer'
|
8
|
+
require_relative 'class_measure'
|
9
|
+
|
10
|
+
module ADIWG
|
11
|
+
module Mdtranslator
|
12
|
+
module Writers
|
13
|
+
module Iso19115_1
|
14
|
+
|
15
|
+
class LE_NominalResolution
|
16
|
+
|
17
|
+
def initialize(xml, hResponseObj)
|
18
|
+
@xml = xml
|
19
|
+
@hResponseObj = hResponseObj
|
20
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
|
21
|
+
end
|
22
|
+
|
23
|
+
def writeXML(hResolution, inContext = nil)
|
24
|
+
|
25
|
+
# classes used
|
26
|
+
measureClass = Measure.new(@xml, @hResponseObj)
|
27
|
+
|
28
|
+
outContext = 'resolution'
|
29
|
+
outContext = inContext + ' ' + outContext unless inContext.nil?
|
30
|
+
|
31
|
+
@xml.tag!('mrl:LE_NominalResolution') do
|
32
|
+
|
33
|
+
haveResolution = false
|
34
|
+
|
35
|
+
# resolution - scanning resolution {Measure} (required if)
|
36
|
+
unless hResolution[:scanningResolution].empty?
|
37
|
+
@xml.tag!('mrl:scanningResolution') do
|
38
|
+
measureClass.writeXML(hResolution[:scanningResolution], outContext)
|
39
|
+
haveResolution = true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
unless hResolution[:groundResolution].empty?
|
44
|
+
@xml.tag!('mrl:groundResolution') do
|
45
|
+
measureClass.writeXML(hResolution[:groundResolution], outContext)
|
46
|
+
haveResolution = true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
unless haveResolution
|
51
|
+
@NameSpace.issueWarning(450, 'mrl:scanningResolution', outContext)
|
52
|
+
end
|
53
|
+
|
54
|
+
end # mrl:LE_NominalResolution
|
55
|
+
end # writeXML
|
56
|
+
end # LE_NominalResolution class
|
57
|
+
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
# ISO <<Class>> LE_ProcessStepReport
|
2
|
+
# 19115-1 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2019-09-27 original script.
|
6
|
+
|
7
|
+
require_relative '../iso19115_1_writer'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Iso19115_1
|
13
|
+
|
14
|
+
class LE_ProcessStepReport
|
15
|
+
|
16
|
+
def initialize(xml, hResponseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = hResponseObj
|
19
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
|
20
|
+
end
|
21
|
+
|
22
|
+
def writeXML(hReport, inContext = nil)
|
23
|
+
|
24
|
+
outContext = 'process step report'
|
25
|
+
outContext = inContext + ' ' + outContext unless inContext.nil?
|
26
|
+
|
27
|
+
@xml.tag!('mrl:LE_ProcessStepReport') do
|
28
|
+
|
29
|
+
# process step report - name (required)
|
30
|
+
unless hReport[:name].nil?
|
31
|
+
@xml.tag!('mrl:name') do
|
32
|
+
@xml.tag!('gco:CharacterString', hReport[:name])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
if hReport[:name].nil?
|
36
|
+
@NameSpace.issueWarning(440, 'mrl:name', outContext)
|
37
|
+
end
|
38
|
+
|
39
|
+
# process step report - description
|
40
|
+
unless hReport[:description].nil?
|
41
|
+
@xml.tag!('mrl:description') do
|
42
|
+
@xml.tag!('gco:CharacterString', hReport[:description])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
if hReport[:description].nil? && @hResponseObj[:writerShowTags]
|
46
|
+
@xml.tag!('mrl:description')
|
47
|
+
end
|
48
|
+
|
49
|
+
# process step report - file type
|
50
|
+
unless hReport[:fileType].nil?
|
51
|
+
@xml.tag!('mrl:fileType') do
|
52
|
+
@xml.tag!('gco:CharacterString', hReport[:fileType])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
if hReport[:fileType].nil? && @hResponseObj[:writerShowTags]
|
56
|
+
@xml.tag!('mrl:fileType')
|
57
|
+
end
|
58
|
+
|
59
|
+
end # mrl:LE_ProcessStepReport
|
60
|
+
end # writeXML
|
61
|
+
end # LE_ProcessStepReport class
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,128 +1,49 @@
|
|
1
|
-
# ISO <<
|
1
|
+
# ISO <<Abstract>> ProcessStep
|
2
2
|
# 19115-1 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
# Stan Smith 2019-
|
5
|
+
# Stan Smith 2019-09-27 original script.
|
6
6
|
|
7
|
-
require_relative '
|
8
|
-
require_relative '
|
9
|
-
require_relative 'class_source'
|
10
|
-
require_relative 'class_timePeriod'
|
11
|
-
require_relative 'class_citation'
|
12
|
-
require_relative 'class_scope'
|
7
|
+
require_relative 'class_liProcessStep'
|
8
|
+
require_relative 'class_leProcessStep'
|
13
9
|
|
14
10
|
module ADIWG
|
15
11
|
module Mdtranslator
|
16
12
|
module Writers
|
17
13
|
module Iso19115_1
|
18
14
|
|
19
|
-
class
|
15
|
+
class ProcessStep
|
20
16
|
|
21
17
|
def initialize(xml, hResponseObj)
|
22
18
|
@xml = xml
|
23
19
|
@hResponseObj = hResponseObj
|
24
|
-
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
|
25
20
|
end
|
26
21
|
|
27
|
-
def writeXML(
|
22
|
+
def writeXML(hProcess, inContext = nil)
|
28
23
|
|
29
24
|
# classes used
|
30
|
-
|
31
|
-
|
32
|
-
periodClass = TimePeriod.new(@xml, @hResponseObj)
|
33
|
-
citationClass = CI_Citation.new(@xml, @hResponseObj)
|
34
|
-
scopeClass = MD_Scope.new(@xml, @hResponseObj)
|
25
|
+
liProcessClass = LI_ProcessStep.new(@xml, @hResponseObj)
|
26
|
+
leProcessClass = LE_ProcessStep.new(@xml, @hResponseObj)
|
35
27
|
|
36
|
-
outContext =
|
37
|
-
outContext = inContext + ' process step ' unless inContext.nil?
|
38
|
-
outContext = outContext + ' ' + hStep[:stepId].to_s unless hStep[:stepId].nil?
|
28
|
+
outContext = inContext
|
39
29
|
|
40
|
-
#
|
41
|
-
|
42
|
-
|
43
|
-
unless s.nil?
|
44
|
-
attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
|
45
|
-
end
|
46
|
-
|
47
|
-
@xml.tag!('mrl:LI_ProcessStep', attributes) do
|
48
|
-
|
49
|
-
# process step - description (required)
|
50
|
-
unless hStep[:description].nil?
|
51
|
-
@xml.tag!('mrl:description') do
|
52
|
-
@xml.tag!('gco:CharacterString', hStep[:description])
|
53
|
-
end
|
54
|
-
end
|
55
|
-
if hStep[:description].nil?
|
56
|
-
@NameSpace.issueWarning(260, 'mrl:description')
|
57
|
-
end
|
58
|
-
|
59
|
-
# process step - rationale
|
60
|
-
unless hStep[:rationale].nil?
|
61
|
-
@xml.tag!('mrl:rationale') do
|
62
|
-
@xml.tag!('gco:CharacterString', hStep[:rationale])
|
63
|
-
end
|
64
|
-
end
|
65
|
-
if hStep[:rationale].nil? && @hResponseObj[:writerShowTags]
|
66
|
-
@xml.tag!('mrl:rationale')
|
67
|
-
end
|
30
|
+
# use LE_ProcessStep if hProcess has any ...
|
31
|
+
# processingInformation, reports
|
32
|
+
# stepProducts (output)
|
68
33
|
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
periodClass.writeXML(hStep[:timePeriod])
|
74
|
-
end
|
75
|
-
end
|
76
|
-
if hStep[:timePeriod].empty? && @hResponseObj[:writerShowTags]
|
77
|
-
@xml.tag!('mrl:stepDateTime')
|
78
|
-
end
|
34
|
+
useLE = false
|
35
|
+
useLE = true unless hProcess[:processingInformation].empty?
|
36
|
+
useLE = true unless hProcess[:reports].empty?
|
37
|
+
useLE = true unless hProcess[:stepProducts].empty?
|
79
38
|
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
end
|
86
|
-
end
|
87
|
-
if aProcessors.empty? && @hResponseObj[:writerShowTags]
|
88
|
-
@xml.tag!('mrl:processor')
|
89
|
-
end
|
90
|
-
|
91
|
-
# process step - reference [] {CI_Citation}
|
92
|
-
aReferences = hStep[:references]
|
93
|
-
aReferences.each do |hCitation|
|
94
|
-
@xml.tag!('mrl:reference') do
|
95
|
-
citationClass.writeXML(hCitation, outContext)
|
96
|
-
end
|
97
|
-
end
|
98
|
-
if aReferences.empty? && @hResponseObj[:writerShowTags]
|
99
|
-
@xml.tag!('mrl:reference')
|
100
|
-
end
|
101
|
-
|
102
|
-
# process step - scope {MD_Scope}
|
103
|
-
unless hStep[:scope].empty?
|
104
|
-
@xml.tag!('mrl:scope') do
|
105
|
-
scopeClass.writeXML(hStep[:scope], outContext)
|
106
|
-
end
|
107
|
-
end
|
108
|
-
if hStep[:scope].empty? && @hResponseObj[:writerShowTags]
|
109
|
-
@xml.tag!('mrl:scope')
|
110
|
-
end
|
111
|
-
|
112
|
-
# process step - source [] {LI_Source}
|
113
|
-
aSources = hStep[:stepSources]
|
114
|
-
aSources.each do |hSource|
|
115
|
-
@xml.tag!('mrl:source') do
|
116
|
-
sourceClass.writeXML(hSource)
|
117
|
-
end
|
118
|
-
end
|
119
|
-
if aSources.empty? && @hResponseObj[:writerShowTags]
|
120
|
-
@xml.tag!('mrl:source')
|
121
|
-
end
|
39
|
+
if useLE
|
40
|
+
leProcessClass.writeXML(hProcess, outContext)
|
41
|
+
else
|
42
|
+
liProcessClass.writeXML(hProcess, outContext)
|
43
|
+
end
|
122
44
|
|
123
|
-
end # mrl:LI_ProcessStep tag
|
124
45
|
end # writeXML
|
125
|
-
end #
|
46
|
+
end # processStep class
|
126
47
|
|
127
48
|
end
|
128
49
|
end
|
@@ -0,0 +1,110 @@
|
|
1
|
+
# ISO <<Class>> LE_Processing
|
2
|
+
# 19115-1 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 201-09-27 original script.
|
6
|
+
|
7
|
+
require_relative '../iso19115_1_writer'
|
8
|
+
require_relative 'class_identifier'
|
9
|
+
require_relative 'class_citation'
|
10
|
+
require_relative 'class_algorithm'
|
11
|
+
|
12
|
+
module ADIWG
|
13
|
+
module Mdtranslator
|
14
|
+
module Writers
|
15
|
+
module Iso19115_1
|
16
|
+
|
17
|
+
class LE_Processing
|
18
|
+
|
19
|
+
def initialize(xml, hResponseObj)
|
20
|
+
@xml = xml
|
21
|
+
@hResponseObj = hResponseObj
|
22
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
|
23
|
+
end
|
24
|
+
|
25
|
+
def writeXML(hProcessing, inContext = nil)
|
26
|
+
|
27
|
+
# classes used
|
28
|
+
identifierClass = MD_Identifier.new(@xml, @hResponseObj)
|
29
|
+
citationClass = CI_Citation.new(@xml, @hResponseObj)
|
30
|
+
algorithmClass = LE_Algorithm.new(@xml, @hResponseObj)
|
31
|
+
|
32
|
+
outContext = 'processing'
|
33
|
+
outContext = inContext + ' ' + outContext unless inContext.nil?
|
34
|
+
|
35
|
+
@xml.tag!('mrl:LE_Processing') do
|
36
|
+
|
37
|
+
# processing - algorithm [] {LE_Algorithm}
|
38
|
+
aAlgorithms = hProcessing[:algorithms]
|
39
|
+
aAlgorithms.each do |hAlgorithm|
|
40
|
+
@xml.tag!('mrl:algorithm') do
|
41
|
+
algorithmClass.writeXML(hAlgorithm, outContext)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
if aAlgorithms.empty? && @hResponseObj[:writerShowTags]
|
45
|
+
@xml.tag!('mrl:algorithm')
|
46
|
+
end
|
47
|
+
|
48
|
+
# processing - identifier {MD_Identifier} (required)
|
49
|
+
unless hProcessing[:identifier].empty?
|
50
|
+
hIdentifier = hProcessing[:identifier]
|
51
|
+
unless hIdentifier.empty?
|
52
|
+
@xml.tag!('mrl:identifier') do
|
53
|
+
identifierClass.writeXML(hIdentifier, outContext)
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
if hProcessing[:identifier].nil?
|
58
|
+
@NameSpace.issueWarning(430, 'mrl:identifier', outContext)
|
59
|
+
end
|
60
|
+
|
61
|
+
# processing - software reference {CI_Citation}
|
62
|
+
hCitation = hProcessing[:softwareReference]
|
63
|
+
unless hCitation.empty?
|
64
|
+
@xml.tag!('mrl:softwareReference') do
|
65
|
+
citationClass.writeXML(hCitation, outContext)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
if hCitation.empty? && @hResponseObj[:writerShowTags]
|
69
|
+
@xml.tag!('mrl:softwareReference')
|
70
|
+
end
|
71
|
+
|
72
|
+
# processing - procedure description
|
73
|
+
unless hProcessing[:procedureDescription].nil?
|
74
|
+
@xml.tag!('mrl:procedureDescription') do
|
75
|
+
@xml.tag!('gco:CharacterString', hProcessing[:procedureDescription])
|
76
|
+
end
|
77
|
+
end
|
78
|
+
if hProcessing[:procedureDescription].nil? && @hResponseObj[:writerShowTags]
|
79
|
+
@xml.tag!('mrl:procedureDescription')
|
80
|
+
end
|
81
|
+
|
82
|
+
# processing - documentation [] {CI_Citation}
|
83
|
+
aCitations = hProcessing[:documentation]
|
84
|
+
aCitations.each do |hCitation|
|
85
|
+
@xml.tag!('mrl:documentation') do
|
86
|
+
citationClass.writeXML(hCitation, outContext)
|
87
|
+
end
|
88
|
+
end
|
89
|
+
if aCitations.empty? && @hResponseObj[:writerShowTags]
|
90
|
+
@xml.tag!('mrl:documentation')
|
91
|
+
end
|
92
|
+
|
93
|
+
# processing - runtime parameters
|
94
|
+
unless hProcessing[:runtimeParameters].nil?
|
95
|
+
@xml.tag!('mrl:runTimeParameters') do
|
96
|
+
@xml.tag!('gco:CharacterString', hProcessing[:runtimeParameters])
|
97
|
+
end
|
98
|
+
end
|
99
|
+
if hProcessing[:runtimeParameters].nil? && @hResponseObj[:writerShowTags]
|
100
|
+
@xml.tag!('mrl:runTimeParameters')
|
101
|
+
end
|
102
|
+
|
103
|
+
end # mrl:LE_ProcessStepReport
|
104
|
+
end # writeXML
|
105
|
+
end # LE_ProcessStepReport class
|
106
|
+
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|