adiwg-mdtranslator 2.16.1 → 2.18.0rc2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (72) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +29 -2
  3. data/Rakefile +1 -0
  4. data/adiwg-mdtranslator.gemspec +1 -1
  5. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +8 -3
  6. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_attribute.rb +6 -2
  7. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_attribute.rb +12 -0
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +11 -0
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +9 -0
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georeferenceableRepresentation.rb +9 -0
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gridRepresentation.rb +10 -0
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processStep.rb +3 -14
  13. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_processing.rb +4 -5
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_rangeElementDescription.rb +38 -0
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_vectorRepresentation.rb +10 -0
  16. data/lib/adiwg/mdtranslator/version.rb +3 -1
  17. data/lib/adiwg/mdtranslator/writers/html/sections/html_algorithm.rb +48 -0
  18. data/lib/adiwg/mdtranslator/writers/html/sections/html_attribute.rb +12 -0
  19. data/lib/adiwg/mdtranslator/writers/html/sections/html_georectifiedRepresentation.rb +12 -0
  20. data/lib/adiwg/mdtranslator/writers/html/sections/html_georeferenceableRepresentation.rb +13 -0
  21. data/lib/adiwg/mdtranslator/writers/html/sections/html_gridRepresentation.rb +13 -0
  22. data/lib/adiwg/mdtranslator/writers/html/sections/html_nominalResolution.rb +51 -0
  23. data/lib/adiwg/mdtranslator/writers/html/sections/html_processReport.rb +47 -0
  24. data/lib/adiwg/mdtranslator/writers/html/sections/html_processStep.rb +35 -8
  25. data/lib/adiwg/mdtranslator/writers/html/sections/html_processing.rb +89 -0
  26. data/lib/adiwg/mdtranslator/writers/html/sections/html_rangeElementDescription.rb +40 -0
  27. data/lib/adiwg/mdtranslator/writers/html/sections/html_source.rb +25 -0
  28. data/lib/adiwg/mdtranslator/writers/html/sections/html_vectorRepresentation.rb +13 -0
  29. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_algorithm.rb +61 -0
  30. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georectified.rb +9 -0
  31. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georeferenceable.rb +10 -0
  32. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_grid.rb +11 -1
  33. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_identifier.rb +2 -2
  34. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +22 -0
  35. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_leProcessStep.rb +167 -0
  36. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_leSource.rb +150 -0
  37. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_liProcessStep.rb +130 -0
  38. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_liSource.rb +126 -0
  39. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineage.rb +5 -4
  40. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_nominalResolution.rb +61 -0
  41. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +22 -0
  42. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_partyIdentifier.rb +92 -0
  43. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processReport.rb +66 -0
  44. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb +22 -101
  45. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processing.rb +110 -0
  46. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeElementDescription.rb +45 -0
  47. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +8 -0
  48. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +19 -95
  49. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb +9 -0
  50. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer_messages_eng.yml +11 -0
  51. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_algorithm.rb +61 -0
  52. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_leProcessStep.rb +153 -0
  53. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_leSource.rb +134 -0
  54. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liProcessStep.rb +126 -0
  55. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_liSource.rb +114 -0
  56. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +13 -11
  57. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_nominalResolution.rb +61 -0
  58. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processReport.rb +66 -0
  59. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +22 -96
  60. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processing.rb +110 -0
  61. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +20 -82
  62. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +2 -2
  63. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +9 -0
  64. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_attribute.rb +1 -0
  65. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_contact.rb +1 -0
  66. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georectifiedRepresentation.rb +1 -0
  67. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_georeferenceableRepresentation.rb +1 -0
  68. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_gridRepresentation.rb +1 -0
  69. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processStep.rb +0 -1
  70. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_processing.rb +1 -1
  71. data/lib/adiwg/mdtranslator/writers/mdJson/sections/mdJson_vectorRepresentation.rb +1 -0
  72. metadata +36 -12
@@ -0,0 +1,167 @@
1
+ # ISO <<Class>> LE_ProcessStep
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
+ require_relative 'class_responsibility'
9
+ require_relative 'class_source'
10
+ require_relative 'class_timePeriod'
11
+ require_relative 'class_citation'
12
+ require_relative 'class_scope'
13
+ require_relative 'class_processing'
14
+ require_relative 'class_processReport'
15
+
16
+ module ADIWG
17
+ module Mdtranslator
18
+ module Writers
19
+ module Iso19115_1
20
+
21
+ class LE_ProcessStep
22
+
23
+ def initialize(xml, hResponseObj)
24
+ @xml = xml
25
+ @hResponseObj = hResponseObj
26
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
27
+ end
28
+
29
+ def writeXML(hStep, inContext = nil)
30
+
31
+ # classes used
32
+ responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj)
33
+ sourceClass = Source.new(@xml, @hResponseObj)
34
+ periodClass = TimePeriod.new(@xml, @hResponseObj)
35
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
36
+ scopeClass = MD_Scope.new(@xml, @hResponseObj)
37
+ processingClass = LE_Processing.new(@xml, @hResponseObj)
38
+ reportClass = LE_ProcessStepReport.new(@xml, @hResponseObj)
39
+
40
+ outContext = 'process step'
41
+ outContext = inContext + ' process step' unless inContext.nil?
42
+ outContext = outContext + ' ' + hStep[:stepId].to_s unless hStep[:stepId].nil?
43
+
44
+ # process step - id
45
+ attributes = {}
46
+ s = hStep[:stepId]
47
+ unless s.nil?
48
+ attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
49
+ end
50
+
51
+ @xml.tag!('mrl:LE_ProcessStep', attributes) do
52
+
53
+ # process step - description (required)
54
+ unless hStep[:description].nil?
55
+ @xml.tag!('mrl:description') do
56
+ @xml.tag!('gco:CharacterString', hStep[:description])
57
+ end
58
+ end
59
+ if hStep[:description].nil?
60
+ @NameSpace.issueWarning(260, 'mrl:description')
61
+ end
62
+
63
+ # process step - rationale
64
+ unless hStep[:rationale].nil?
65
+ @xml.tag!('mrl:rationale') do
66
+ @xml.tag!('gco:CharacterString', hStep[:rationale])
67
+ end
68
+ end
69
+ if hStep[:rationale].nil? && @hResponseObj[:writerShowTags]
70
+ @xml.tag!('mrl:rationale')
71
+ end
72
+
73
+ # process step - step datetime {TimePeriod}
74
+ # {TimeInstant} - not implemented
75
+ unless hStep[:timePeriod].empty?
76
+ @xml.tag!('mrl:stepDateTime') do
77
+ periodClass.writeXML(hStep[:timePeriod])
78
+ end
79
+ end
80
+ if hStep[:timePeriod].empty? && @hResponseObj[:writerShowTags]
81
+ @xml.tag!('mrl:stepDateTime')
82
+ end
83
+
84
+ # process step - processor [] {CI_Responsibility}
85
+ aProcessors = hStep[:processors]
86
+ aProcessors.each do |hProcessor|
87
+ @xml.tag!('mrl:processor') do
88
+ responsibilityClass.writeXML(hProcessor, outContext)
89
+ end
90
+ end
91
+ if aProcessors.empty? && @hResponseObj[:writerShowTags]
92
+ @xml.tag!('mrl:processor')
93
+ end
94
+
95
+ # process step - reference [] {CI_Citation}
96
+ aReferences = hStep[:references]
97
+ aReferences.each do |hCitation|
98
+ @xml.tag!('mrl:reference') do
99
+ citationClass.writeXML(hCitation, outContext)
100
+ end
101
+ end
102
+ if aReferences.empty? && @hResponseObj[:writerShowTags]
103
+ @xml.tag!('mrl:reference')
104
+ end
105
+
106
+ # process step - scope {MD_Scope}
107
+ unless hStep[:scope].empty?
108
+ @xml.tag!('mrl:scope') do
109
+ scopeClass.writeXML(hStep[:scope], outContext)
110
+ end
111
+ end
112
+ if hStep[:scope].empty? && @hResponseObj[:writerShowTags]
113
+ @xml.tag!('mrl:scope')
114
+ end
115
+
116
+ # process step - source [] {Source}
117
+ aSources = hStep[:stepSources]
118
+ aSources.each do |hSource|
119
+ @xml.tag!('mrl:source') do
120
+ sourceClass.writeXML(hSource)
121
+ end
122
+ end
123
+ if aSources.empty? && @hResponseObj[:writerShowTags]
124
+ @xml.tag!('mrl:source')
125
+ end
126
+
127
+ # process step - processing information {LE_Processing}
128
+ hProcessing = hStep[:processingInformation]
129
+ unless hProcessing.empty?
130
+ @xml.tag!('mrl:processingInformation') do
131
+ processingClass.writeXML(hProcessing, outContext)
132
+ end
133
+ end
134
+ if hProcessing.empty? && @hResponseObj[:writerShowTags]
135
+ @xml.tag!('mrl:processingInformation')
136
+ end
137
+
138
+ # process step - report [] {LE_ProcessStepReport}
139
+ aReports = hStep[:reports]
140
+ aReports.each do |hReport|
141
+ @xml.tag!('mrl:report') do
142
+ reportClass.writeXML(hReport)
143
+ end
144
+ end
145
+ if aReports.empty? && @hResponseObj[:writerShowTags]
146
+ @xml.tag!('mrl:report')
147
+ end
148
+
149
+ # process step - output [] {Source}
150
+ aOutput = hStep[:stepProducts]
151
+ aOutput.each do |hSource|
152
+ @xml.tag!('mrl:output') do
153
+ sourceClass.writeXML(hSource)
154
+ end
155
+ end
156
+ if aOutput.empty? && @hResponseObj[:writerShowTags]
157
+ @xml.tag!('mrl:output')
158
+ end
159
+
160
+ end # mrl:LI_ProcessStep tag
161
+ end # writeXML
162
+ end # LI_ProcessStep class
163
+
164
+ end
165
+ end
166
+ end
167
+ end
@@ -0,0 +1,150 @@
1
+ # ISO <<Class>> LE_Source
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-09-27 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
+ require_relative 'class_identifier'
13
+ require_relative 'class_nominalResolution'
14
+
15
+ module ADIWG
16
+ module Mdtranslator
17
+ module Writers
18
+ module Iso19115_1
19
+
20
+ class LE_Source
21
+
22
+ def initialize(xml, hResponseObj)
23
+ @xml = xml
24
+ @hResponseObj = hResponseObj
25
+ end
26
+
27
+ def writeXML(hSource, inContext = nil)
28
+
29
+ # classes used
30
+ resolutionClass = MD_Resolution.new(@xml, @hResponseObj)
31
+ referenceClass = MD_ReferenceSystem.new(@xml, @hResponseObj)
32
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
33
+ scopeClass = MD_Scope.new(@xml, @hResponseObj)
34
+ stepClass = ProcessStep.new(@xml, @hResponseObj)
35
+ identifierClass = MD_Identifier.new(@xml, @hResponseObj)
36
+ nominalClass = LE_NominalResolution.new(@xml, @hResponseObj)
37
+
38
+ outContext = 'source'
39
+ outContext = outContext + ' ' + hSource[:sourceId].to_s unless hSource[:sourceId].nil?
40
+ outContext = inContext + ' source' unless inContext.nil?
41
+
42
+ # source - id (tag attribute id="")
43
+ attributes = {}
44
+ s = hSource[:sourceId]
45
+ unless s.nil?
46
+ attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
47
+ end
48
+
49
+ @xml.tag!('mrl:LE_Source', attributes) do
50
+
51
+ # source - description
52
+ unless hSource[:description].nil?
53
+ @xml.tag!('mrl:description') do
54
+ @xml.tag!('gco:CharacterString', hSource[:description])
55
+ end
56
+ end
57
+ if hSource[:description].nil? && @hResponseObj[:writerShowTags]
58
+ @xml.tag!('mrl:description')
59
+ end
60
+
61
+ # source - spatial resolution {MD_Resolution}
62
+ unless hSource[:spatialResolution].empty?
63
+ @xml.tag!('mrl:sourceSpatialResolution') do
64
+ resolutionClass.writeXML(hSource[:spatialResolution], outContext)
65
+ end
66
+ end
67
+ if hSource[:spatialResolution].empty? && @hResponseObj[:writerShowTags]
68
+ @xml.tag!('mrl:sourceSpatialResolution')
69
+ end
70
+
71
+ # source - reference system {MD_ReferenceSystem}
72
+ unless hSource[:referenceSystem].empty?
73
+ @xml.tag!('mrl:sourceReferenceSystem') do
74
+ referenceClass.writeXML(hSource[:referenceSystem])
75
+ end
76
+ end
77
+ if hSource[:referenceSystem].empty? && @hResponseObj[:writerShowTags]
78
+ @xml.tag!('mrl:sourceReferenceSystem')
79
+ end
80
+
81
+ # source - citation {CI_Citation}
82
+ unless hSource[:sourceCitation].empty?
83
+ @xml.tag!('mrl:sourceCitation') do
84
+ citationClass.writeXML(hSource[:sourceCitation], outContext)
85
+ end
86
+ end
87
+ if hSource[:sourceCitation].empty? && @hResponseObj[:writerShowTags]
88
+ @xml.tag!('mrl:sourceCitation')
89
+ end
90
+
91
+ # source - metadata [] {CI_Citation}
92
+ aCitations = hSource[:metadataCitations]
93
+ aCitations.each do |hCitation|
94
+ @xml.tag!('mrl:sourceMetadata') do
95
+ citationClass.writeXML(hCitation, outContext)
96
+ end
97
+ end
98
+ if aCitations.empty? && @hResponseObj[:writerShowTags]
99
+ @xml.tag!('mrl:sourceMetadata')
100
+ end
101
+
102
+ # source - scope {MD_Scope}
103
+ unless hSource[:scope].empty?
104
+ @xml.tag!('mrl:scope') do
105
+ scopeClass.writeXML(hSource[:scope], outContext)
106
+ end
107
+ end
108
+ if hSource[:scope].empty? && @hResponseObj[:writerShowTags]
109
+ @xml.tag!('mrl:scope')
110
+ end
111
+
112
+ # source - process step [] {ProcessStep}
113
+ aSteps = hSource[:sourceSteps]
114
+ aSteps.each do |hStep|
115
+ @xml.tag!('mrl:sourceStep') do
116
+ stepClass.writeXML(hStep)
117
+ end
118
+ end
119
+ if aSteps.empty? && @hResponseObj[:writerShowTags]
120
+ @xml.tag!('mrl:sourceStep')
121
+ end
122
+
123
+ # source - processed level {MD_Identifier}
124
+ unless hSource[:processedLevel].empty?
125
+ @xml.tag!('mrl:processedLevel') do
126
+ identifierClass.writeXML(hSource[:processedLevel], outContext)
127
+ end
128
+ end
129
+ if hSource[:processedLevel].empty? && @hResponseObj[:writerShowTags]
130
+ @xml.tag!('mrl:processedLevel')
131
+ end
132
+
133
+ # source - resolution {LE_NominalResolution}
134
+ unless hSource[:resolution].empty?
135
+ @xml.tag!('mrl:resolution') do
136
+ nominalClass.writeXML(hSource[:resolution], outContext)
137
+ end
138
+ end
139
+ if hSource[:resolution].empty? && @hResponseObj[:writerShowTags]
140
+ @xml.tag!('mrl:resolution')
141
+ end
142
+
143
+ end # mrl:LI_Source tag
144
+ end # writeXML
145
+ end # LI_Source class
146
+
147
+ end
148
+ end
149
+ end
150
+ end
@@ -0,0 +1,130 @@
1
+ # ISO <<Class>> LI_ProcessStep
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-10 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_responsibility'
9
+ require_relative 'class_source'
10
+ require_relative 'class_timePeriod'
11
+ require_relative 'class_citation'
12
+ require_relative 'class_scope'
13
+
14
+ module ADIWG
15
+ module Mdtranslator
16
+ module Writers
17
+ module Iso19115_1
18
+
19
+ class LI_ProcessStep
20
+
21
+ def initialize(xml, hResponseObj)
22
+ @xml = xml
23
+ @hResponseObj = hResponseObj
24
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
25
+ end
26
+
27
+ def writeXML(hStep, inContext = nil)
28
+
29
+ # classes used
30
+ responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj)
31
+ sourceClass = Source.new(@xml, @hResponseObj)
32
+ periodClass = TimePeriod.new(@xml, @hResponseObj)
33
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
34
+ scopeClass = MD_Scope.new(@xml, @hResponseObj)
35
+
36
+ outContext = 'process step'
37
+ outContext = inContext + ' process step' unless inContext.nil?
38
+ outContext = outContext + ' ' + hStep[:stepId].to_s unless hStep[:stepId].nil?
39
+
40
+ # process step - id
41
+ attributes = {}
42
+ s = hStep[:stepId]
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
68
+
69
+ # process step - step datetime {TimePeriod}
70
+ # {TimeInstant} - not implemented
71
+ unless hStep[:timePeriod].empty?
72
+ @xml.tag!('mrl:stepDateTime') do
73
+ periodClass.writeXML(hStep[:timePeriod])
74
+ end
75
+ end
76
+ if hStep[:timePeriod].empty? && @hResponseObj[:writerShowTags]
77
+ @xml.tag!('mrl:stepDateTime')
78
+ end
79
+
80
+ # process step - processor [] {CI_Responsibility}
81
+ aProcessors = hStep[:processors]
82
+ aProcessors.each do |hProcessor|
83
+ @xml.tag!('mrl:processor') do
84
+ responsibilityClass.writeXML(hProcessor, outContext)
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 [] {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
122
+
123
+ end # mrl:LI_ProcessStep tag
124
+ end # writeXML
125
+ end # LI_ProcessStep class
126
+
127
+ end
128
+ end
129
+ end
130
+ end
@@ -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 = LI_Source.new(@xml, @hResponseObj)
30
- processClass = LI_ProcessStep.new(@xml, @hResponseObj)
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 [] {LI_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 [] {LI_ProcessStep}
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