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
@@ -8,6 +8,7 @@ require_relative '../iso19115_1_writer'
8
8
  require_relative 'class_contact'
9
9
  require_relative 'class_browseGraphic'
10
10
  require_relative 'class_individual'
11
+ require_relative 'class_partyIdentifier'
11
12
 
12
13
  module ADIWG
13
14
  module Mdtranslator
@@ -28,6 +29,7 @@ module ADIWG
28
29
  contactClass = CI_Contact.new(@xml, @hResponseObj)
29
30
  graphicClass = MD_BrowseGraphic.new(@xml, @hResponseObj)
30
31
  individualClass = CI_Individual.new(@xml, @hResponseObj)
32
+ identifierClass = MD_PartyIdentifier.new(@xml, @hResponseObj)
31
33
 
32
34
  outContext = 'responsible party'
33
35
  outContext = inContext + ' responsible party' unless inContext.nil?
@@ -91,6 +93,26 @@ module ADIWG
91
93
  @xml.tag!('cit:individual')
92
94
  end
93
95
 
96
+ # organization - party identifier
97
+ if hContact[:externalIdentifier] && hContact[:externalIdentifier].length > 0
98
+ hContact[:externalIdentifier].each do |identifier|
99
+ @xml.tag!('cit:partyIdentifier') do
100
+ identifierClass.writeXML(identifier);
101
+ end
102
+ end
103
+ else
104
+ if hContact[:contactId] &&
105
+ hContact[:contactId].is_a?(Hash)
106
+ @xml.tag!('cit:partyIdentifier') do
107
+ identifierClass.writeXML(hContact[:contactId]);
108
+ end
109
+ elsif hContact[:contactId].is_a?(String)
110
+ @xml.tag!('cit:partyIdentifier') do
111
+ identifierClass.writeXML({ identifier: hContact[:contactId] })
112
+ end
113
+ end
114
+ end
115
+
94
116
  end
95
117
  if hContact.empty?
96
118
  @NameSpace.issueWarning(271, nil, outContext)
@@ -0,0 +1,92 @@
1
+ # ISO <<Class>> MD_Identifier for specific party identfier features for individual and organization
2
+ # 19115-3 output for ISO 19115-1 XML
3
+
4
+ require_relative '../iso19115_1_writer'
5
+ require_relative 'class_citation'
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Iso19115_1
11
+
12
+ class MD_PartyIdentifier
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
18
+ end
19
+
20
+ def writeXML(hIdentifier, inContext = nil)
21
+
22
+ outContext = 'identifier'
23
+ outContext = inContext + ' authority' unless inContext.nil?
24
+
25
+ # classes used in MD_Metadata
26
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
27
+
28
+ @xml.tag!('mcc:MD_Identifier') do
29
+
30
+ # identifier - authority {CI_Citation}
31
+ hCitation = hIdentifier[:citation]
32
+ unless hCitation.nil? || hCitation.empty?
33
+ @xml.tag!('mcc:authority') do
34
+ citationClass.writeXML(hCitation, outContext)
35
+ end
36
+ end
37
+ if hCitation.nil? || hCitation.empty? && @hResponseObj[:writerShowTags]
38
+ @xml.tag!('mcc:authority')
39
+ end
40
+
41
+ # identifier - code (required)
42
+ s = hIdentifier[:identifier]
43
+ unless s.nil?
44
+ @xml.tag!('mcc:code') do
45
+ @xml.tag!('gco:CharacterString', s)
46
+ end
47
+ end
48
+ if s.nil?
49
+ @NameSpace.issueWarning(230, 'mcc:code', inContext)
50
+ end
51
+
52
+ # identifier - codeSpace
53
+ s = hIdentifier[:namespace]
54
+ unless s.nil?
55
+ @xml.tag!('mcc:codeSpace') do
56
+ @xml.tag!('gco:CharacterString', s)
57
+ end
58
+ end
59
+ if s.nil? && @hResponseObj[:writerShowTags]
60
+ @xml.tag!('mcc:codeSpace')
61
+ end
62
+
63
+ # identifier - codeSpace version
64
+ s = hIdentifier[:version]
65
+ unless s.nil?
66
+ @xml.tag!('mcc:version') do
67
+ @xml.tag!('gco:CharacterString', s)
68
+ end
69
+ end
70
+ if s.nil? && @hResponseObj[:writerShowTags]
71
+ @xml.tag!('mcc:version')
72
+ end
73
+
74
+ # identifier - description
75
+ s = hIdentifier[:description]
76
+ unless s.nil?
77
+ @xml.tag!('mcc:description') do
78
+ @xml.tag!('gco:CharacterString', s)
79
+ end
80
+ end
81
+ if s.nil? && @hResponseObj[:writerShowTags]
82
+ @xml.tag!('mcc:description')
83
+ end
84
+
85
+ end # MD_Identifier tag
86
+ end # writeXML
87
+ end # MD_Identifier class
88
+
89
+ end
90
+ end
91
+ end
92
+ 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 <<Class>> LI_ProcessStep
1
+ # ISO <<Abstract>> ProcessStep
2
2
  # 19115-1 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2019-04-10 original script.
5
+ # Stan Smith 2019-09-27 original script.
6
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'
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 LI_ProcessStep
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(hStep, inContext = nil)
22
+ def writeXML(hProcess, inContext = nil)
28
23
 
29
24
  # classes used
30
- responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj)
31
- sourceClass = LI_Source.new(@xml, @hResponseObj)
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 = 'process step'
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
- # 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
30
+ # use LE_ProcessStep if hProcess has any ...
31
+ # processingInformation, reports
32
+ # stepProducts (output)
68
33
 
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
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
- # 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 [] {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 # LI_ProcessStep class
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
@@ -0,0 +1,45 @@
1
+ # ISO <<Class>> MI_RangeElementDescription attributes
2
+ # 19115-1 writer output in XML
3
+
4
+ require_relative '../iso19115_1_writer'
5
+
6
+ module ADIWG
7
+ module Mdtranslator
8
+ module Writers
9
+ module Iso19115_1
10
+
11
+ class MI_RangeElementDescription
12
+
13
+ def initialize(xml, hResponseObj)
14
+ @xml = xml
15
+ @hResponseObj = hResponseObj
16
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
17
+ end
18
+
19
+ def writeXML(hAttribute, inContext = nil)
20
+
21
+ unless hAttribute[:name].nil?
22
+ @xml.tag!('mrc:name') do
23
+ @xml.tag!('gco:CharacterString', hAttribute[:name])
24
+ end
25
+ end
26
+
27
+ unless hAttribute[:definition].nil?
28
+ @xml.tag!('mrc:definition') do
29
+ @xml.tag!('gco:CharacterString', hAttribute[:definition])
30
+ end
31
+ end
32
+
33
+ hAttribute[:rangeElements].each do |hRangeElement|
34
+ @xml.tag!('mrc:rangeElement') do
35
+ @xml.tag!('gco:Record') do
36
+ @xml.tag!('gco:CharacterString', hRangeElement)
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -6,6 +6,7 @@
6
6
 
7
7
  require_relative '../iso19115_1_writer'
8
8
  require_relative 'class_unitsOfMeasure'
9
+ require_relative 'class_rangeElementDescription'
9
10
 
10
11
  module ADIWG
11
12
  module Mdtranslator
@@ -24,6 +25,7 @@ module ADIWG
24
25
 
25
26
  # classes used
26
27
  uomClass = UnitsOfMeasure.new(@xml, @hResponseObj)
28
+ rangeElementDescription = MI_RangeElementDescription.new(@xml, @hResponseObj)
27
29
 
28
30
  # sample dimension - max value {real}
29
31
  unless hAttribute[:maxValue].nil?
@@ -65,6 +67,12 @@ module ADIWG
65
67
  @xml.tag!('mrc:scaleFactor')
66
68
  end
67
69
 
70
+ hAttribute[:rangeElementDescription].each do |red|
71
+ @xml.tag!('mrc:rangeElementDescription') do
72
+ rangeElementDescription.writeXML(red, inContext)
73
+ end
74
+ end
75
+
68
76
  # sample dimension - offset {real}
69
77
  unless hAttribute[:offset].nil?
70
78
  @xml.tag!('mrc:offset') do
@@ -1,21 +1,18 @@
1
- # ISO <<Class>> LI_Source
1
+ # ISO <<Abstract>> Source
2
2
  # 19115-1 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2019-04-10 original script.
5
+ # Stan Smith 2019-09-27 original script.
6
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'
7
+ require_relative 'class_liSource'
8
+ require_relative 'class_leSource'
12
9
 
13
10
  module ADIWG
14
11
  module Mdtranslator
15
12
  module Writers
16
13
  module Iso19115_1
17
14
 
18
- class LI_Source
15
+ class Source
19
16
 
20
17
  def initialize(xml, hResponseObj)
21
18
  @xml = xml
@@ -25,99 +22,26 @@ module ADIWG
25
22
  def writeXML(hSource, inContext = nil)
26
23
 
27
24
  # 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 = LI_ProcessStep.new(@xml, @hResponseObj)
25
+ liSourceClass = LI_Source.new(@xml, @hResponseObj)
26
+ leSourceClass = LE_Source.new(@xml, @hResponseObj)
33
27
 
34
- outContext = 'source'
35
- outContext = inContext + ' source' unless inContext.nil?
28
+ outContext = inContext
36
29
 
37
- # source - id (tag attribute id="")
38
- attributes = {}
39
- s = hSource[:sourceId]
40
- unless s.nil?
41
- attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
42
- end
43
-
44
- @xml.tag!('mrl:LI_Source', attributes) do
45
-
46
- # source - description
47
- unless hSource[:description].nil?
48
- @xml.tag!('mrl:description') do
49
- @xml.tag!('gco:CharacterString', hSource[:description])
50
- end
51
- end
52
- if hSource[:description].nil? && @hResponseObj[:writerShowTags]
53
- @xml.tag!('mrl:description')
54
- end
55
-
56
- # source - spatial resolution {MD_Resolution}
57
- unless hSource[:spatialResolution].empty?
58
- @xml.tag!('mrl:sourceSpatialResolution') do
59
- resolutionClass.writeXML(hSource[:spatialResolution], outContext)
60
- end
61
- end
62
- if hSource[:spatialResolution].empty? && @hResponseObj[:writerShowTags]
63
- @xml.tag!('mrl:sourceSpatialResolution')
64
- end
30
+ # use LE_Source if hSource has any ...
31
+ # processedLevel, resolution
65
32
 
66
- # source - reference system {MD_ReferenceSystem}
67
- unless hSource[:referenceSystem].empty?
68
- @xml.tag!('mrl:sourceReferenceSystem') do
69
- referenceClass.writeXML(hSource[:referenceSystem])
70
- end
71
- end
72
- if hSource[:referenceSystem].empty? && @hResponseObj[:writerShowTags]
73
- @xml.tag!('mrl:sourceReferenceSystem')
74
- end
33
+ useLE = false
34
+ useLE = true unless hSource[:processedLevel].empty?
35
+ useLE = true unless hSource[:resolution].empty?
75
36
 
76
- # source - citation {CI_Citation}
77
- unless hSource[:sourceCitation].empty?
78
- @xml.tag!('mrl:sourceCitation') do
79
- citationClass.writeXML(hSource[:sourceCitation], outContext)
80
- end
81
- end
82
- if hSource[:sourceCitation].empty? && @hResponseObj[:writerShowTags]
83
- @xml.tag!('mrl:sourceCitation')
84
- end
85
-
86
- # source - metadata [] {CI_Citation}
87
- aCitations = hSource[:metadataCitations]
88
- aCitations.each do |hCitation|
89
- @xml.tag!('mrl:sourceMetadata') do
90
- citationClass.writeXML(hCitation, outContext)
91
- end
92
- end
93
- if aCitations.empty? && @hResponseObj[:writerShowTags]
94
- @xml.tag!('mrl:sourceMetadata')
95
- end
96
-
97
- # source - scope {MD_Scope}
98
- unless hSource[:scope].empty?
99
- @xml.tag!('mrl:scope') do
100
- scopeClass.writeXML(hSource[:scope], outContext)
101
- end
102
- end
103
- if hSource[:scope].empty? && @hResponseObj[:writerShowTags]
104
- @xml.tag!('mrl:scope')
105
- end
106
-
107
- # source - process step [] {LI_ProcessStep}
108
- aSteps = hSource[:sourceSteps]
109
- aSteps.each do |hStep|
110
- @xml.tag!('mrl:sourceStep') do
111
- stepClass.writeXML(hStep)
112
- end
113
- end
114
- if aSteps.empty? && @hResponseObj[:writerShowTags]
115
- @xml.tag!('mrl:sourceStep')
116
- end
37
+ if useLE
38
+ leSourceClass.writeXML(hSource, outContext)
39
+ else
40
+ liSourceClass.writeXML(hSource, outContext)
41
+ end
117
42
 
118
- end # mrl:LI_Source tag
119
43
  end # writeXML
120
- end # LI_Source class
44
+ end # Source class
121
45
 
122
46
  end
123
47
  end