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_ProcessStep
|
2
|
+
# 19115-2 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2018-04-10 add error and warning messaging
|
6
|
+
# Stan Smith 2017-08-30 added support for step sources
|
7
|
+
# Stan Smith 2016-12-13 refactored for mdTranslator/mdJson 2.0
|
8
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
9
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
10
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
11
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
12
|
+
# Stan Smith 2014-07-09 modify require statements to function in RubyGem structure
|
13
|
+
# Stan Smith 2013-11-20 original script.
|
14
|
+
|
15
|
+
require_relative '../iso19115_2_writer'
|
16
|
+
require_relative 'class_responsibleParty'
|
17
|
+
require_relative 'class_source'
|
18
|
+
|
19
|
+
module ADIWG
|
20
|
+
module Mdtranslator
|
21
|
+
module Writers
|
22
|
+
module Iso19115_2
|
23
|
+
|
24
|
+
class LI_ProcessStep
|
25
|
+
|
26
|
+
def initialize(xml, hResponseObj)
|
27
|
+
@xml = xml
|
28
|
+
@hResponseObj = hResponseObj
|
29
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
30
|
+
end
|
31
|
+
|
32
|
+
def writeXML(hStep, inContext = nil)
|
33
|
+
|
34
|
+
# classes used
|
35
|
+
partyClass = CI_ResponsibleParty.new(@xml, @hResponseObj)
|
36
|
+
sourceClass = Source.new(@xml, @hResponseObj)
|
37
|
+
|
38
|
+
outContext = 'process step'
|
39
|
+
outContext = outContext + ' ' + hStep[:stepId].to_s unless hStep[:stepId].nil?
|
40
|
+
outContext = inContext + ' ' + outContext unless inContext.nil?
|
41
|
+
|
42
|
+
# process step - id
|
43
|
+
attributes = {}
|
44
|
+
s = hStep[:stepId]
|
45
|
+
unless s.nil?
|
46
|
+
attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
|
47
|
+
end
|
48
|
+
|
49
|
+
@xml.tag!('gmd:LI_ProcessStep', attributes) do
|
50
|
+
|
51
|
+
# process step - description (required)
|
52
|
+
s = hStep[:description]
|
53
|
+
unless s.nil?
|
54
|
+
@xml.tag!('gmd:description') do
|
55
|
+
@xml.tag!('gco:CharacterString', s)
|
56
|
+
end
|
57
|
+
end
|
58
|
+
if s.nil?
|
59
|
+
@NameSpace.issueWarning(260, 'gmd:description', outContext)
|
60
|
+
end
|
61
|
+
|
62
|
+
# process step - rationale
|
63
|
+
s = hStep[:rationale]
|
64
|
+
unless s.nil?
|
65
|
+
@xml.tag!('gmd:rationale') do
|
66
|
+
@xml.tag!('gco:CharacterString', s)
|
67
|
+
end
|
68
|
+
end
|
69
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
70
|
+
@xml.tag!('gmd:rationale')
|
71
|
+
end
|
72
|
+
|
73
|
+
# process step - datetime
|
74
|
+
hPeriod = hStep[:timePeriod]
|
75
|
+
unless hPeriod.empty?
|
76
|
+
hDate = hPeriod[:startDateTime]
|
77
|
+
if hDate.empty?
|
78
|
+
hDate = hPeriod[:endDateTime]
|
79
|
+
end
|
80
|
+
date = hDate[:dateTime]
|
81
|
+
dateResolution = hDate[:dateResolution]
|
82
|
+
s = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, dateResolution)
|
83
|
+
if s != 'ERROR'
|
84
|
+
@xml.tag!('gmd:dateTime') do
|
85
|
+
@xml.tag!('gco:DateTime', s)
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
if hPeriod.empty? && @hResponseObj[:writerShowTags]
|
90
|
+
@xml.tag!('gmd:dateTime')
|
91
|
+
end
|
92
|
+
|
93
|
+
# process step - processor [] {CI_ResponsibleParty}
|
94
|
+
aParties = hStep[:processors]
|
95
|
+
aParties.each do |hRParty|
|
96
|
+
role = hRParty[:roleName]
|
97
|
+
aParties = hRParty[:parties]
|
98
|
+
aParties.each do |hParty|
|
99
|
+
@xml.tag!('gmd:processor') do
|
100
|
+
partyClass.writeXML(role, hParty, outContext)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
if aParties.empty? && @hResponseObj[:writerShowTags]
|
105
|
+
@xml.tag!('gmd:processor')
|
106
|
+
end
|
107
|
+
|
108
|
+
# process step - source [] {Source}
|
109
|
+
aSources = hStep[:stepSources]
|
110
|
+
aSources.each do |hSource|
|
111
|
+
@xml.tag!('gmd:source') do
|
112
|
+
sourceClass.writeXML(hSource)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
if aSources.empty? && @hResponseObj[:writerShowTags]
|
116
|
+
@xml.tag!('gmd:source')
|
117
|
+
end
|
118
|
+
|
119
|
+
end # gmd:LI_ProcessStep tag
|
120
|
+
end # writeXML
|
121
|
+
end # LI_ProcessStep class
|
122
|
+
|
123
|
+
end
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
@@ -0,0 +1,114 @@
|
|
1
|
+
# ISO <<Class>> LI_Source
|
2
|
+
# 19115-2 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2016-12-07 refactored for mdTranslator/mdJson 2.0
|
6
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
7
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
8
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
9
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
10
|
+
# Stan Smith 2014-07-09 modify require statements to function in RubyGem structure
|
11
|
+
# Stan Smith 2013-11-20 original script.
|
12
|
+
|
13
|
+
require_relative 'class_fraction'
|
14
|
+
require_relative 'class_referenceSystem'
|
15
|
+
require_relative 'class_citation'
|
16
|
+
require_relative 'class_processStep'
|
17
|
+
|
18
|
+
module ADIWG
|
19
|
+
module Mdtranslator
|
20
|
+
module Writers
|
21
|
+
module Iso19115_2
|
22
|
+
|
23
|
+
class LI_Source
|
24
|
+
|
25
|
+
def initialize(xml, hResponseObj)
|
26
|
+
@xml = xml
|
27
|
+
@hResponseObj = hResponseObj
|
28
|
+
end
|
29
|
+
|
30
|
+
def writeXML(hSource, inContext = nil)
|
31
|
+
|
32
|
+
# classes used
|
33
|
+
fractionClass = MD_RepresentativeFraction.new(@xml, @hResponseObj)
|
34
|
+
systemClass = MD_ReferenceSystem.new(@xml, @hResponseObj)
|
35
|
+
citationClass = CI_Citation.new(@xml, @hResponseObj)
|
36
|
+
stepClass = ProcessStep.new(@xml, @hResponseObj)
|
37
|
+
|
38
|
+
# source - id
|
39
|
+
attributes = {}
|
40
|
+
s = hSource[:sourceId]
|
41
|
+
unless s.nil?
|
42
|
+
attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
|
43
|
+
end
|
44
|
+
|
45
|
+
outContext = 'source'
|
46
|
+
outContext = outContext + ' ' + hSource[:sourceId].to_s unless hSource[:sourceId].nil?
|
47
|
+
outContext = inContext + ' ' + outContext unless inContext.nil?
|
48
|
+
|
49
|
+
@xml.tag!('gmd:LI_Source', attributes) do
|
50
|
+
|
51
|
+
# source - description
|
52
|
+
unless hSource[:description].nil?
|
53
|
+
@xml.tag!('gmd:description') do
|
54
|
+
@xml.tag!('gco:CharacterString', hSource[:description])
|
55
|
+
end
|
56
|
+
end
|
57
|
+
if hSource[:description].nil? && @hResponseObj[:writerShowTags]
|
58
|
+
@xml.tag!('gmd:description')
|
59
|
+
end
|
60
|
+
|
61
|
+
# source - scale denominator {MD_RepresentativeFraction}
|
62
|
+
hResolution = hSource[:spatialResolution]
|
63
|
+
unless hResolution[:scaleFactor].nil?
|
64
|
+
@xml.tag!('gmd:scaleDenominator') do
|
65
|
+
fractionClass.writeXML(hResolution[:scaleFactor])
|
66
|
+
end
|
67
|
+
end
|
68
|
+
if hResolution[:scaleFactor].nil? && @hResponseObj[:writerShowTags]
|
69
|
+
@xml.tag!('gmd:scaleDenominator')
|
70
|
+
end
|
71
|
+
|
72
|
+
# source - reference system {MD_ReferenceSystem}
|
73
|
+
hSystem = hSource[:referenceSystem]
|
74
|
+
unless hSystem.empty?
|
75
|
+
@xml.tag!('gmd:sourceReferenceSystem') do
|
76
|
+
systemClass.writeXML(hSystem)
|
77
|
+
end
|
78
|
+
end
|
79
|
+
if hSystem.empty? && @hResponseObj[:writerShowTags]
|
80
|
+
@xml.tag!('gmd:sourceReferenceSystem')
|
81
|
+
end
|
82
|
+
|
83
|
+
# source - citation {CI_Citation}
|
84
|
+
hCitation = hSource[:sourceCitation]
|
85
|
+
unless hCitation.empty?
|
86
|
+
@xml.tag!('gmd:sourceCitation') do
|
87
|
+
citationClass.writeXML(hCitation, outContext)
|
88
|
+
end
|
89
|
+
end
|
90
|
+
if hCitation.empty? && @hResponseObj[:writerShowTags]
|
91
|
+
@xml.tag!('gmd:sourceCitation')
|
92
|
+
end
|
93
|
+
|
94
|
+
# source - extent [] {EX_Extent} (not implemented)
|
95
|
+
|
96
|
+
# source - source step [] {ProcessStep}
|
97
|
+
aSteps = hSource[:sourceSteps]
|
98
|
+
aSteps.each do |hStep|
|
99
|
+
@xml.tag!('gmd:sourceStep') do
|
100
|
+
stepClass.writeXML(hStep)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
if aSteps.empty? && @hResponseObj[:writerShowTags]
|
104
|
+
@xml.tag!('gmd:sourceStep')
|
105
|
+
end
|
106
|
+
|
107
|
+
end # gmd:LI_Source tag
|
108
|
+
end # writeXML
|
109
|
+
end # LI_Source class
|
110
|
+
|
111
|
+
end
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -2,6 +2,7 @@
|
|
2
2
|
# 19115-2 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 2016-12-13 refactored for mdTranslator/mdJson 2.0
|
6
7
|
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
7
8
|
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
@@ -28,38 +29,39 @@ module ADIWG
|
|
28
29
|
def writeXML(hLineage)
|
29
30
|
|
30
31
|
# classes used
|
31
|
-
sourceClass =
|
32
|
-
|
32
|
+
sourceClass = Source.new(@xml, @hResponseObj)
|
33
|
+
processClass = ProcessStep.new(@xml, @hResponseObj)
|
34
|
+
|
35
|
+
outContext = 'lineage'
|
33
36
|
|
34
37
|
@xml.tag!('gmd:LI_Lineage') do
|
35
38
|
|
36
39
|
# lineage - statement
|
37
|
-
|
38
|
-
unless s.nil?
|
40
|
+
unless hLineage[:statement].nil?
|
39
41
|
@xml.tag!('gmd:statement') do
|
40
|
-
@xml.tag!('gco:CharacterString',
|
42
|
+
@xml.tag!('gco:CharacterString', hLineage[:statement])
|
41
43
|
end
|
42
44
|
end
|
43
|
-
if
|
45
|
+
if hLineage[:statement].nil? && @hResponseObj[:writerShowTags]
|
44
46
|
@xml.tag!('gmd:statement')
|
45
47
|
end
|
46
48
|
|
47
|
-
# lineage - process step [{
|
49
|
+
# lineage - process step [] {ProcessStep}
|
48
50
|
aProcSteps = hLineage[:processSteps]
|
49
|
-
aProcSteps.each do |
|
51
|
+
aProcSteps.each do |hStep|
|
50
52
|
@xml.tag!('gmd:processStep') do
|
51
|
-
|
53
|
+
processClass.writeXML(hStep, outContext)
|
52
54
|
end
|
53
55
|
end
|
54
56
|
if aProcSteps.empty? && @hResponseObj[:writerShowTags]
|
55
57
|
@xml.tag!('gmd:processStep')
|
56
58
|
end
|
57
59
|
|
58
|
-
# lineage - source [{
|
60
|
+
# lineage - source [] {Source}
|
59
61
|
aSources = hLineage[:dataSources]
|
60
62
|
aSources.each do |hSource|
|
61
63
|
@xml.tag!('gmd:source') do
|
62
|
-
sourceClass.writeXML(hSource)
|
64
|
+
sourceClass.writeXML(hSource, outContext)
|
63
65
|
end
|
64
66
|
end
|
65
67
|
if aSources.empty? && @hResponseObj[:writerShowTags]
|
@@ -0,0 +1,61 @@
|
|
1
|
+
# ISO <<Class>> LE_NominalResolution
|
2
|
+
# 19115-2 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 201-09-25 original script.
|
6
|
+
|
7
|
+
require_relative '../iso19115_2_writer'
|
8
|
+
require_relative 'class_measure'
|
9
|
+
|
10
|
+
module ADIWG
|
11
|
+
module Mdtranslator
|
12
|
+
module Writers
|
13
|
+
module Iso19115_2
|
14
|
+
|
15
|
+
class LE_NominalResolution
|
16
|
+
|
17
|
+
def initialize(xml, hResponseObj)
|
18
|
+
@xml = xml
|
19
|
+
@hResponseObj = hResponseObj
|
20
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
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!('gmi:LE_NominalResolution') do
|
32
|
+
|
33
|
+
haveResolution = false
|
34
|
+
|
35
|
+
# resolution - scanning resolution {Measure} (required if)
|
36
|
+
unless hResolution[:scanningResolution].empty?
|
37
|
+
@xml.tag!('gmi:scanningResolution') do
|
38
|
+
measureClass.writeXML(hResolution[:scanningResolution], outContext)
|
39
|
+
haveResolution = true
|
40
|
+
end
|
41
|
+
end
|
42
|
+
|
43
|
+
unless hResolution[:groundResolution].empty?
|
44
|
+
@xml.tag!('gmi:groundResolution') do
|
45
|
+
measureClass.writeXML(hResolution[:groundResolution], outContext)
|
46
|
+
haveResolution = true
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
unless haveResolution
|
51
|
+
@NameSpace.issueWarning(400, 'gmi:scanningResolution', outContext)
|
52
|
+
end
|
53
|
+
|
54
|
+
end # gmi: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-2 writer output in XML
|
3
|
+
|
4
|
+
# History:
|
5
|
+
# Stan Smith 2019-09-25 original script.
|
6
|
+
|
7
|
+
require_relative '../iso19115_2_writer'
|
8
|
+
|
9
|
+
module ADIWG
|
10
|
+
module Mdtranslator
|
11
|
+
module Writers
|
12
|
+
module Iso19115_2
|
13
|
+
|
14
|
+
class LE_ProcessStepReport
|
15
|
+
|
16
|
+
def initialize(xml, hResponseObj)
|
17
|
+
@xml = xml
|
18
|
+
@hResponseObj = hResponseObj
|
19
|
+
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
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!('gmi:LE_ProcessStepReport') do
|
28
|
+
|
29
|
+
# process step report - name (required)
|
30
|
+
unless hReport[:name].nil?
|
31
|
+
@xml.tag!('gmi:name') do
|
32
|
+
@xml.tag!('gco:CharacterString', hReport[:name])
|
33
|
+
end
|
34
|
+
end
|
35
|
+
if hReport[:name].nil?
|
36
|
+
@NameSpace.issueWarning(410, 'gmi:name', outContext)
|
37
|
+
end
|
38
|
+
|
39
|
+
# process step report - description
|
40
|
+
unless hReport[:description].nil?
|
41
|
+
@xml.tag!('gmi:description') do
|
42
|
+
@xml.tag!('gco:CharacterString', hReport[:description])
|
43
|
+
end
|
44
|
+
end
|
45
|
+
if hReport[:description].nil? && @hResponseObj[:writerShowTags]
|
46
|
+
@xml.tag!('gmi:description')
|
47
|
+
end
|
48
|
+
|
49
|
+
# process step report - file type
|
50
|
+
unless hReport[:fileType].nil?
|
51
|
+
@xml.tag!('gmi:fileType') do
|
52
|
+
@xml.tag!('gco:CharacterString', hReport[:fileType])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
if hReport[:fileType].nil? && @hResponseObj[:writerShowTags]
|
56
|
+
@xml.tag!('gmi:fileType')
|
57
|
+
end
|
58
|
+
|
59
|
+
end # gmi:LE_ProcessStepReport
|
60
|
+
end # writeXML
|
61
|
+
end # LE_ProcessStepReport class
|
62
|
+
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -1,123 +1,49 @@
|
|
1
|
-
# ISO <<
|
1
|
+
# ISO <<Abstract>> ProcessStep
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
# Stan Smith 2017-08-30 added support for step sources
|
7
|
-
# Stan Smith 2016-12-13 refactored for mdTranslator/mdJson 2.0
|
8
|
-
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
9
|
-
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
10
|
-
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
11
|
-
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
12
|
-
# Stan Smith 2014-07-09 modify require statements to function in RubyGem structure
|
13
|
-
# Stan Smith 2013-11-20 original script.
|
5
|
+
# Stan Smith 2019-09-25 original script.
|
14
6
|
|
15
|
-
require_relative '
|
16
|
-
require_relative '
|
17
|
-
require_relative 'class_source'
|
7
|
+
require_relative 'class_liProcessStep'
|
8
|
+
require_relative 'class_leProcessStep'
|
18
9
|
|
19
10
|
module ADIWG
|
20
11
|
module Mdtranslator
|
21
12
|
module Writers
|
22
13
|
module Iso19115_2
|
23
14
|
|
24
|
-
class
|
15
|
+
class ProcessStep
|
25
16
|
|
26
17
|
def initialize(xml, hResponseObj)
|
27
18
|
@xml = xml
|
28
19
|
@hResponseObj = hResponseObj
|
29
|
-
@NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
|
30
20
|
end
|
31
21
|
|
32
|
-
def writeXML(
|
22
|
+
def writeXML(hProcess, inContext = nil)
|
33
23
|
|
34
24
|
# classes used
|
35
|
-
|
36
|
-
|
25
|
+
liProcessClass = LI_ProcessStep.new(@xml, @hResponseObj)
|
26
|
+
leProcessClass = LE_ProcessStep.new(@xml, @hResponseObj)
|
37
27
|
|
38
|
-
outContext =
|
39
|
-
outContext = 'process step ' + hStep[:stepId].to_s unless hStep[:stepId].nil?
|
28
|
+
outContext = inContext
|
40
29
|
|
41
|
-
#
|
42
|
-
|
43
|
-
|
44
|
-
unless s.nil?
|
45
|
-
attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
|
46
|
-
end
|
47
|
-
|
48
|
-
@xml.tag!('gmd:LI_ProcessStep', attributes) do
|
49
|
-
|
50
|
-
# process step - description (required)
|
51
|
-
s = hStep[:description]
|
52
|
-
unless s.nil?
|
53
|
-
@xml.tag!('gmd:description') do
|
54
|
-
@xml.tag!('gco:CharacterString', s)
|
55
|
-
end
|
56
|
-
end
|
57
|
-
if s.nil?
|
58
|
-
@NameSpace.issueWarning(260, 'gmd:description')
|
59
|
-
end
|
30
|
+
# use LE_ProcessStep if hProcess has any ...
|
31
|
+
# processingInformation, reports
|
32
|
+
# stepProducts (output)
|
60
33
|
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
@xml.tag!('gco:CharacterString', s)
|
66
|
-
end
|
67
|
-
end
|
68
|
-
if s.nil? && @hResponseObj[:writerShowTags]
|
69
|
-
@xml.tag!('gmd:rationale')
|
70
|
-
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?
|
71
38
|
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
hDate = hPeriod[:endDateTime]
|
78
|
-
end
|
79
|
-
date = hDate[:dateTime]
|
80
|
-
dateResolution = hDate[:dateResolution]
|
81
|
-
s = AdiwgDateTimeFun.stringDateTimeFromDateTime(date, dateResolution)
|
82
|
-
if s != 'ERROR'
|
83
|
-
@xml.tag!('gmd:dateTime') do
|
84
|
-
@xml.tag!('gco:DateTime', s)
|
85
|
-
end
|
86
|
-
end
|
87
|
-
end
|
88
|
-
if hPeriod.empty? && @hResponseObj[:writerShowTags]
|
89
|
-
@xml.tag!('gmd:dateTime')
|
90
|
-
end
|
91
|
-
|
92
|
-
# process step - processor [] {CI_ResponsibleParty}
|
93
|
-
aParties = hStep[:processors]
|
94
|
-
aParties.each do |hRParty|
|
95
|
-
role = hRParty[:roleName]
|
96
|
-
aParties = hRParty[:parties]
|
97
|
-
aParties.each do |hParty|
|
98
|
-
@xml.tag!('gmd:processor') do
|
99
|
-
partyClass.writeXML(role, hParty, outContext)
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
103
|
-
if aParties.empty? && @hResponseObj[:writerShowTags]
|
104
|
-
@xml.tag!('gmd:processor')
|
105
|
-
end
|
106
|
-
|
107
|
-
# process step - source [] {LI_Source}
|
108
|
-
aSources = hStep[:stepSources]
|
109
|
-
aSources.each do |hSource|
|
110
|
-
@xml.tag!('gmd:source') do
|
111
|
-
sourceClass.writeXML(hSource)
|
112
|
-
end
|
113
|
-
end
|
114
|
-
if aSources.empty? && @hResponseObj[:writerShowTags]
|
115
|
-
@xml.tag!('gmd:source')
|
116
|
-
end
|
39
|
+
if useLE
|
40
|
+
leProcessClass.writeXML(hProcess, outContext)
|
41
|
+
else
|
42
|
+
liProcessClass.writeXML(hProcess, outContext)
|
43
|
+
end
|
117
44
|
|
118
|
-
end # gmd:LI_ProcessStep tag
|
119
45
|
end # writeXML
|
120
|
-
end #
|
46
|
+
end # processStep class
|
121
47
|
|
122
48
|
end
|
123
49
|
end
|