adiwg-mdtranslator 2.12.0 → 2.13.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (110) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +15 -1
  3. data/adiwg-mdtranslator.gemspec +1 -1
  4. data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +2 -0
  5. data/lib/adiwg/mdtranslator/readers/fgdc/fgdc_reader.rb +4 -0
  6. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +1 -1
  7. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +7 -12
  8. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +12 -11
  9. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -7
  10. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +1 -6
  11. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +15 -1
  12. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +1 -3
  13. data/lib/adiwg/mdtranslator/version.rb +5 -1
  14. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -1
  15. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +4 -2
  16. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +1 -1
  17. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +1 -1
  18. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +1 -1
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +4 -4
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +1 -1
  22. data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +7 -7
  23. data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +6 -5
  24. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb +104 -104
  25. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb +63 -60
  26. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/{class_attributeGroup.rb → class_attribute.rb} +1 -1
  27. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_baseUnit.rb +23 -23
  28. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_boundingBox.rb +64 -60
  29. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_browseGraphic.rb +55 -51
  30. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +24 -14
  31. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb +96 -91
  32. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_conventionalUnit.rb +45 -45
  33. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_coverageDescription.rb +104 -77
  34. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +4 -4
  35. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +23 -8
  36. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +57 -52
  37. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_date.rb +49 -46
  38. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_definitionUnit.rb +20 -20
  39. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_derivedUnit.rb +32 -32
  40. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dimension.rb +56 -50
  41. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distribution.rb +1 -1
  42. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +77 -74
  43. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_enumerationList.rb +34 -34
  44. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +190 -186
  45. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extent.rb +66 -66
  46. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_feature.rb +50 -45
  47. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb +35 -35
  48. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureProperties.rb +43 -43
  49. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_format.rb +73 -69
  50. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_fraction.rb +37 -33
  51. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicElement.rb +59 -54
  52. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicExtent.rb +58 -58
  53. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometricObjects.rb +49 -46
  54. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometryCollection.rb +68 -63
  55. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georectified.rb +113 -110
  56. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb +78 -75
  57. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gmlIdentifier.rb +17 -17
  58. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_grid.rb +55 -52
  59. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gridRepresentation.rb +19 -19
  60. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_hierarchy.rb +47 -47
  61. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_image.rb +132 -132
  62. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +5 -2
  63. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineString.rb +70 -70
  64. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +55 -55
  65. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_locale.rb +51 -48
  66. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenance.rb +114 -105
  67. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdBand.rb +111 -111
  68. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdIdentifier.rb +9 -3
  69. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb +58 -41
  70. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_medium.rb +104 -104
  71. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miBand.rb +70 -70
  72. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +51 -16
  73. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiLine.rb +70 -70
  74. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPoint.rb +70 -70
  75. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPolygon.rb +70 -70
  76. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +79 -76
  77. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_orderProcess.rb +67 -67
  78. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_phone.rb +67 -67
  79. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb +8 -8
  80. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_polygon.rb +89 -89
  81. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +9 -3
  82. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rangeDimension.rb +59 -54
  83. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
  84. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +47 -47
  85. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +111 -105
  86. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rsIdentifier.rb +71 -65
  87. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb +54 -50
  88. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scopeDescription.rb +45 -42
  89. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_securityConstraints.rb +92 -89
  90. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_series.rb +55 -55
  91. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +98 -91
  92. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +42 -42
  93. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicClassification.rb +63 -59
  94. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicSystem.rb +40 -40
  95. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +133 -130
  96. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_temporalExtent.rb +49 -49
  97. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timeInstant.rb +60 -60
  98. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timePeriod.rb +110 -108
  99. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_transferOptions.rb +71 -69
  100. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_unitsOfMeasure.rb +243 -243
  101. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_usage.rb +98 -95
  102. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +38 -38
  103. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vectorRepresentation.rb +48 -48
  104. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_verticalExtent.rb +74 -70
  105. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb +56 -53
  106. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +61 -11
  107. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +109 -0
  108. data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +3 -2
  109. data/lib/adiwg/mdtranslator_cli.rb +21 -4
  110. metadata +6 -5
@@ -2,81 +2,81 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-01 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 2014-12-12 refactored to handle namespacing readers and writers
9
- # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
5
+ # Stan Smith 2016-12-01 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 2014-12-12 refactored to handle namespacing readers and writers
9
+ # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
10
10
  # Stan Smith 2013-11-04 original script.
11
11
 
12
12
  require_relative 'class_gmlIdentifier'
13
13
 
14
14
  module ADIWG
15
- module Mdtranslator
16
- module Writers
17
- module Iso19115_2
15
+ module Mdtranslator
16
+ module Writers
17
+ module Iso19115_2
18
18
 
19
- class TimeInstant
19
+ class TimeInstant
20
20
 
21
- def initialize(xml, hResponseObj)
22
- @xml = xml
23
- @hResponseObj = hResponseObj
24
- end
21
+ def initialize(xml, hResponseObj)
22
+ @xml = xml
23
+ @hResponseObj = hResponseObj
24
+ end
25
25
 
26
- def writeXML(hInstant)
26
+ def writeXML(hInstant)
27
27
 
28
- # classes used
29
- gmlClass = GMLIdentifier.new(@xml, @hResponseObj)
28
+ # classes used
29
+ gmlClass = GMLIdentifier.new(@xml, @hResponseObj)
30
30
 
31
- # TimeInstant requires a unique ID
32
- timeID = hInstant[:timeId]
33
- if timeID.nil?
34
- @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
35
- timeID = 'timeInstant' + @hResponseObj[:writerMissingIdCount]
36
- else
37
- timeID.gsub!(/[^0-9a-zA-Z]/,'')
38
- end
31
+ # TimeInstant requires a unique ID
32
+ timeID = hInstant[:timeId]
33
+ if timeID.nil?
34
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
35
+ timeID = 'timeInstant' + @hResponseObj[:writerMissingIdCount]
36
+ else
37
+ timeID.gsub!(/[^0-9a-zA-Z]/, '')
38
+ end
39
39
 
40
- @xml.tag!('gml:TimeInstant', {'gml:id' => timeID}) do
40
+ @xml.tag!('gml:TimeInstant', {'gml:id' => timeID}) do
41
41
 
42
- # time instant - description
43
- s = hInstant[:description]
44
- if !s.nil?
45
- @xml.tag!('gml:description', s)
46
- elsif @hResponseObj[:writerShowTags]
47
- @xml.tag!('gml:description')
48
- end
42
+ # time instant - description
43
+ s = hInstant[:description]
44
+ if !s.nil?
45
+ @xml.tag!('gml:description', s)
46
+ elsif @hResponseObj[:writerShowTags]
47
+ @xml.tag!('gml:description')
48
+ end
49
49
 
50
- # time instant - identifier {gmlIdentifier}
51
- hGMLid = hInstant[:identifier]
52
- unless hGMLid.empty?
53
- gmlClass.writeXML(hGMLid)
54
- end
55
- if hGMLid.empty? && @hResponseObj[:writerShowTags]
56
- @xml.tag!('gml:identifier', {'codeSpace'=>''})
57
- end
50
+ # time instant - identifier {gmlIdentifier}
51
+ hGMLid = hInstant[:identifier]
52
+ unless hGMLid.empty?
53
+ gmlClass.writeXML(hGMLid)
54
+ end
55
+ if hGMLid.empty? && @hResponseObj[:writerShowTags]
56
+ @xml.tag!('gml:identifier', {'codeSpace' => ''})
57
+ end
58
58
 
59
- # time instant - names []
60
- aNames = hInstant[:instantNames]
61
- aNames.each do |name|
62
- @xml.tag!('gml:name', name)
63
- end
64
- if aNames.empty? && @hResponseObj[:writerShowTags]
65
- @xml.tag!('gml:name')
66
- end
59
+ # time instant - names []
60
+ aNames = hInstant[:instantNames]
61
+ aNames.each do |name|
62
+ @xml.tag!('gml:name', name)
63
+ end
64
+ if aNames.empty? && @hResponseObj[:writerShowTags]
65
+ @xml.tag!('gml:name')
66
+ end
67
67
 
68
- # time instant - time position
69
- hDateTime = hInstant[:timeInstant]
70
- timeInstant = hDateTime[:dateTime]
71
- timeResolution = hDateTime[:dateResolution]
72
- dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(timeInstant, timeResolution)
73
- @xml.tag!('gml:timePosition', dateStr)
68
+ # time instant - time position
69
+ hDateTime = hInstant[:timeInstant]
70
+ timeInstant = hDateTime[:dateTime]
71
+ timeResolution = hDateTime[:dateResolution]
72
+ dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(timeInstant, timeResolution)
73
+ @xml.tag!('gml:timePosition', dateStr)
74
74
 
75
- end # TimeInstant tag
76
- end # writeXML
77
- end # TimeInstant class
75
+ end # TimeInstant tag
76
+ end # writeXML
77
+ end # TimeInstant class
78
78
 
79
- end
80
- end
81
- end
79
+ end
80
+ end
81
+ end
82
82
  end
@@ -2,117 +2,119 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-11-30 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-08 modify require statements to function in RubyGem structure
5
+ # Stan Smith 2016-11-30 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-08 modify require statements to function in RubyGem structure
11
11
  # Stan Smith 2013-11-04 original script.
12
12
 
13
13
  require_relative 'class_gmlIdentifier'
14
14
 
15
15
  module ADIWG
16
- module Mdtranslator
17
- module Writers
18
- module Iso19115_2
19
-
20
- class TimePeriod
21
-
22
- def initialize(xml, hResponseObj)
23
- @xml = xml
24
- @hResponseObj = hResponseObj
25
- end
26
-
27
- def writeXML(hPeriod)
28
-
29
- # classes used
30
- gmlClass = GMLIdentifier.new(@xml, @hResponseObj)
31
-
32
- # TimePeriod must have a uniqueID
33
- timeID = hPeriod[:timeId]
34
- if timeID.nil?
35
- @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
36
- timeID = 'timePeriod' + @hResponseObj[:writerMissingIdCount]
37
- else
38
- timeID.gsub!(/[^0-9a-zA-Z]/,'')
39
- end
40
-
41
- @xml.tag!('gml:TimePeriod', {'gml:id' => timeID}) do
42
-
43
- # time period - description
44
- s = hPeriod[:description]
45
- unless s.nil?
46
- @xml.tag!('gml:description', s)
47
- end
48
- if s.nil? && @hResponseObj[:writerShowTags]
49
- @xml.tag!('gml:description')
50
- end
51
-
52
- # time period - identifier {gmlIdentifier}
53
- hGMLid = hPeriod[:identifier]
54
- unless hGMLid.empty?
55
- gmlClass.writeXML(hGMLid)
56
- end
57
- if hGMLid.empty? && @hResponseObj[:writerShowTags]
58
- @xml.tag!('gml:identifier', {'codeSpace'=>''})
59
- end
60
-
61
- # time period - names []
62
- aNames = hPeriod[:periodNames]
63
- aNames.each do |name|
64
- @xml.tag!('gml:name', name)
65
- end
66
- if aNames.empty? && @hResponseObj[:writerShowTags]
67
- @xml.tag!('gml:name')
68
- end
69
-
70
- # time period - begin position
71
- # tag required, however value may be empty
72
- unless hPeriod[:startDateTime].empty?
73
- hDateTime = hPeriod[:startDateTime]
74
- dateTime = hDateTime[:dateTime]
75
- timeResolution = hDateTime[:dateResolution]
76
- dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(dateTime, timeResolution)
77
- @xml.tag!('gml:beginPosition', dateStr)
78
- end
79
- if hPeriod[:startDateTime].empty?
80
- @xml.tag!('gml:beginPosition')
81
- end
82
-
83
- # time period - begin position
84
- # tag required, however value may be empty
85
- unless hPeriod[:endDateTime].empty?
86
- hDateTime = hPeriod[:endDateTime]
87
- dateTime = hDateTime[:dateTime]
88
- timeResolution = hDateTime[:dateResolution]
89
- dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(dateTime, timeResolution)
90
- @xml.tag!('gml:endPosition', dateStr)
91
- end
92
- if hPeriod[:endDateTime].empty?
93
- @xml.tag!('gml:endPosition')
94
- end
95
-
96
- # time period - time interval
97
- hInterval = hPeriod[:timeInterval]
98
- unless hInterval.empty?
99
- units = hInterval[:units]
100
- interval = hInterval[:interval]
101
- @xml.tag!('gml:timeInterval', {'unit'=>units}, interval)
102
- end
103
-
104
- # time period - duration (do not output if have time interval)
105
- hDuration = hPeriod[:duration]
106
- if hInterval.empty? && !hDuration.empty?
107
- duration = AdiwgDateTimeFun.writeDuration(hDuration)
108
- @xml.tag!('gml:duration', duration)
109
- end
110
-
111
- end # TimePeriod tag
112
- end # writeXML
113
- end # TimePeriod class
114
-
115
- end
116
- end
117
- end
16
+ module Mdtranslator
17
+ module Writers
18
+ module Iso19115_2
19
+
20
+ class TimePeriod
21
+
22
+ def initialize(xml, hResponseObj)
23
+ @xml = xml
24
+ @hResponseObj = hResponseObj
25
+ end
26
+
27
+ def writeXML(hPeriod)
28
+
29
+ # classes used
30
+ gmlClass = GMLIdentifier.new(@xml, @hResponseObj)
31
+
32
+ # TimePeriod must have a uniqueID
33
+ timeID = hPeriod[:timeId]
34
+ if timeID.nil?
35
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
36
+ timeID = 'timePeriod' + @hResponseObj[:writerMissingIdCount]
37
+ else
38
+ timeID.gsub!(/[^0-9a-zA-Z]/, '')
39
+ end
40
+
41
+ @xml.tag!('gml:TimePeriod', {'gml:id' => timeID}) do
42
+
43
+ # time period - description
44
+ s = hPeriod[:description]
45
+ unless s.nil?
46
+ @xml.tag!('gml:description', s)
47
+ end
48
+ if s.nil? && @hResponseObj[:writerShowTags]
49
+ @xml.tag!('gml:description')
50
+ end
51
+
52
+ # time period - identifier {gmlIdentifier}
53
+ hGMLid = hPeriod[:identifier]
54
+ unless hGMLid.empty?
55
+ gmlClass.writeXML(hGMLid)
56
+ end
57
+ if hGMLid.empty? && @hResponseObj[:writerShowTags]
58
+ @xml.tag!('gml:identifier', {'codeSpace' => ''})
59
+ end
60
+
61
+ # time period - names []
62
+ aNames = hPeriod[:periodNames]
63
+ aNames.each do |name|
64
+ @xml.tag!('gml:name', name)
65
+ end
66
+ if aNames.empty? && @hResponseObj[:writerShowTags]
67
+ @xml.tag!('gml:name')
68
+ end
69
+
70
+ # time period - begin position
71
+ # tag always required, however value may be empty
72
+ # if empty add indeterminatePosition="unknown"
73
+ unless hPeriod[:startDateTime].empty?
74
+ hDateTime = hPeriod[:startDateTime]
75
+ dateTime = hDateTime[:dateTime]
76
+ timeResolution = hDateTime[:dateResolution]
77
+ dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(dateTime, timeResolution)
78
+ @xml.tag!('gml:beginPosition', dateStr)
79
+ end
80
+ if hPeriod[:startDateTime].empty?
81
+ @xml.tag!('gml:beginPosition', {indeterminatePosition: 'unknown'})
82
+ end
83
+
84
+ # time period - begin position
85
+ # tag always required, however value may be empty
86
+ # if empty add indeterminatePosition="unknown"
87
+ unless hPeriod[:endDateTime].empty?
88
+ hDateTime = hPeriod[:endDateTime]
89
+ dateTime = hDateTime[:dateTime]
90
+ timeResolution = hDateTime[:dateResolution]
91
+ dateStr = AdiwgDateTimeFun.stringDateTimeFromDateTime(dateTime, timeResolution)
92
+ @xml.tag!('gml:endPosition', dateStr)
93
+ end
94
+ if hPeriod[:endDateTime].empty?
95
+ @xml.tag!('gml:endPosition', {indeterminatePosition: 'unknown'})
96
+ end
97
+
98
+ # time period - time interval
99
+ hInterval = hPeriod[:timeInterval]
100
+ unless hInterval.empty?
101
+ units = hInterval[:units]
102
+ interval = hInterval[:interval]
103
+ @xml.tag!('gml:timeInterval', {'unit' => units}, interval)
104
+ end
105
+
106
+ # time period - duration (do not output if have time interval)
107
+ hDuration = hPeriod[:duration]
108
+ if hInterval.empty? && !hDuration.empty?
109
+ duration = AdiwgDateTimeFun.writeDuration(hDuration)
110
+ @xml.tag!('gml:duration', duration)
111
+ end
112
+
113
+ end # TimePeriod tag
114
+ end # writeXML
115
+ end # TimePeriod class
116
+
117
+ end
118
+ end
119
+ end
118
120
  end
@@ -2,90 +2,92 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-07 refactored for mdTranslator/mdJson 2.0
6
- # Stan Smith 2015-09-21 added transfer size
7
- # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
8
- # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
9
- # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
10
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
11
- # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
5
+ # Stan Smith 2016-12-07 refactored for mdTranslator/mdJson 2.0
6
+ # Stan Smith 2015-09-21 added transfer size
7
+ # Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
8
+ # Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
9
+ # Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
10
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
11
+ # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
12
12
  # Stan Smith 2013-09-26 original script
13
13
 
14
14
  require_relative 'class_onlineResource'
15
15
  require_relative 'class_medium'
16
16
 
17
17
  module ADIWG
18
- module Mdtranslator
19
- module Writers
20
- module Iso19115_2
18
+ module Mdtranslator
19
+ module Writers
20
+ module Iso19115_2
21
21
 
22
- class MD_DigitalTransferOptions
22
+ class MD_DigitalTransferOptions
23
23
 
24
- def initialize(xml, hResponseObj)
25
- @xml = xml
26
- @hResponseObj = hResponseObj
27
- end
24
+ def initialize(xml, hResponseObj)
25
+ @xml = xml
26
+ @hResponseObj = hResponseObj
27
+ end
28
28
 
29
- def writeXML(hOption)
29
+ def writeXML(hOption)
30
30
 
31
- # classes used
32
- olResClass = CI_OnlineResource.new(@xml, @hResponseObj)
33
- medClass = MD_Medium.new(@xml, @hResponseObj)
31
+ # classes used
32
+ olResClass = CI_OnlineResource.new(@xml, @hResponseObj)
33
+ medClass = MD_Medium.new(@xml, @hResponseObj)
34
34
 
35
- @xml.tag!('gmd:MD_DigitalTransferOptions') do
35
+ outContext = 'transfer option'
36
36
 
37
- # digital transfer options - units of distribution
38
- s = hOption[:unitsOfDistribution]
39
- unless s.nil?
40
- @xml.tag!('gmd:unitsOfDistribution') do
41
- @xml.tag!('gco:CharacterString', s)
42
- end
43
- end
44
- if s.nil? && @hResponseObj[:writerShowTags]
45
- @xml.tag!('gmd:unitsOfDistribution')
46
- end
37
+ @xml.tag!('gmd:MD_DigitalTransferOptions') do
47
38
 
48
- # digital transfer options - transfer size {MB}
49
- s = hOption[:transferSize]
50
- unless s.nil?
51
- @xml.tag!('gmd:transferSize') do
52
- @xml.tag!('gco:Real', s.to_s)
53
- end
54
- end
55
- if s.nil? && @hResponseObj[:writerShowTags]
56
- @xml.tag!('gmd:transferSize')
57
- end
39
+ # digital transfer options - units of distribution
40
+ s = hOption[:unitsOfDistribution]
41
+ unless s.nil?
42
+ @xml.tag!('gmd:unitsOfDistribution') do
43
+ @xml.tag!('gco:CharacterString', s)
44
+ end
45
+ end
46
+ if s.nil? && @hResponseObj[:writerShowTags]
47
+ @xml.tag!('gmd:unitsOfDistribution')
48
+ end
58
49
 
59
- # digital transfer options - online [] {CI_OnlineResource}
60
- aOnTranOpts = hOption[:onlineOptions]
61
- aOnTranOpts.each do |hOlOption|
62
- @xml.tag!('gmd:onLine') do
63
- olResClass.writeXML(hOlOption)
64
- end
65
- end
66
- if aOnTranOpts.empty? &&@hResponseObj[:writerShowTags]
67
- @xml.tag!('gmd:onLine')
68
- end
50
+ # digital transfer options - transfer size {MB}
51
+ s = hOption[:transferSize]
52
+ unless s.nil?
53
+ @xml.tag!('gmd:transferSize') do
54
+ @xml.tag!('gco:Real', s.to_s)
55
+ end
56
+ end
57
+ if s.nil? && @hResponseObj[:writerShowTags]
58
+ @xml.tag!('gmd:transferSize')
59
+ end
69
60
 
70
- # digital transfer options - offline {MD_Medium}
71
- aOffTranOpt = hOption[:offlineOptions]
72
- unless aOffTranOpt.empty?
73
- hOffTranOpt = aOffTranOpt[0]
74
- unless hOffTranOpt.empty?
75
- @xml.tag!('gmd:offLine') do
76
- medClass.writeXML(hOffTranOpt)
77
- end
78
- end
79
- end
80
- if aOffTranOpt.empty? && @hResponseObj[:writerShowTags]
81
- @xml.tag!('gmd:offLine')
82
- end
61
+ # digital transfer options - online [] {CI_OnlineResource}
62
+ aOnTranOpts = hOption[:onlineOptions]
63
+ aOnTranOpts.each do |hOlOption|
64
+ @xml.tag!('gmd:onLine') do
65
+ olResClass.writeXML(hOlOption, outContext)
66
+ end
67
+ end
68
+ if aOnTranOpts.empty? && @hResponseObj[:writerShowTags]
69
+ @xml.tag!('gmd:onLine')
70
+ end
83
71
 
84
- end # gmd:MD_DigitalTransferOptions tag
85
- end # writeXML
86
- end # MD_DigitalTransferOptions class
72
+ # digital transfer options - offline {MD_Medium}
73
+ aOffTranOpt = hOption[:offlineOptions]
74
+ unless aOffTranOpt.empty?
75
+ hOffTranOpt = aOffTranOpt[0]
76
+ unless hOffTranOpt.empty?
77
+ @xml.tag!('gmd:offLine') do
78
+ medClass.writeXML(hOffTranOpt)
79
+ end
80
+ end
81
+ end
82
+ if aOffTranOpt.empty? && @hResponseObj[:writerShowTags]
83
+ @xml.tag!('gmd:offLine')
84
+ end
87
85
 
88
- end
89
- end
90
- end
86
+ end # gmd:MD_DigitalTransferOptions tag
87
+ end # writeXML
88
+ end # MD_DigitalTransferOptions class
89
+
90
+ end
91
+ end
92
+ end
91
93
  end