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,83 +2,83 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-05 original script
5
+ # Stan Smith 2016-12-05 original script
6
6
 
7
7
  require 'adiwg/mdtranslator/internal/module_coordinates'
8
8
  require_relative 'class_point'
9
9
  require_relative 'class_featureProperties'
10
10
 
11
11
  module ADIWG
12
- module Mdtranslator
13
- module Writers
14
- module Iso19115_2
15
-
16
- class MultiPoint
17
-
18
- def initialize(xml, hResponseObj)
19
- @xml = xml
20
- @hResponseObj = hResponseObj
21
- end
22
-
23
- def writeXML(hGeoObject, hProperties, objId)
24
-
25
- # classes used
26
- geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
27
-
28
- # classes used
29
- pointClass = Point.new(@xml, @hResponseObj)
30
-
31
- # multiPoint attributes
32
- attributes = {}
33
-
34
- # multiPoint attributes - gml:id (required)
35
- if objId.nil?
36
- @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
37
- objId = 'multiPoint' + @hResponseObj[:writerMissingIdCount]
38
- else
39
- objId.gsub!(/[^0-9a-zA-Z]/,'')
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_2
15
+
16
+ class MultiPoint
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ end
22
+
23
+ def writeXML(hGeoObject, hProperties, objId)
24
+
25
+ # classes used
26
+ geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
27
+
28
+ # classes used
29
+ pointClass = Point.new(@xml, @hResponseObj)
30
+
31
+ # multiPoint attributes
32
+ attributes = {}
33
+
34
+ # multiPoint attributes - gml:id (required)
35
+ if objId.nil?
36
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
37
+ objId = 'multiPoint' + @hResponseObj[:writerMissingIdCount]
38
+ else
39
+ objId.gsub!(/[^0-9a-zA-Z]/, '')
40
+ end
41
+ attributes['gml:id'] = objId
42
+
43
+ # multiPoint attributes - srsDimension
44
+ s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
45
+ if !s.nil?
46
+ attributes[:srsDimension] = s
47
+ end
48
+
49
+ # multiPoint attributes - srsName (GeoJSON is WGS84)
50
+ attributes[:srsName] = 'WGS84'
51
+
52
+ @xml.tag!('gml:MultiPoint', attributes) do
53
+
54
+ # multipoint - properties for Feature
55
+ unless hProperties.empty?
56
+ geoPropClass.writeXML(hProperties)
57
+ end
58
+ if hProperties.empty? && @hResponseObj[:writerShowTags]
59
+ @xml.tag!('gml:description')
60
+ @xml.tag!('gml:identifier', {'codeSpace' => ''})
61
+ @xml.tag!('gml:name')
62
+ end
63
+
64
+ # multipoint - point members (required)
65
+ @xml.tag!('gml:pointMembers') do
66
+ unless hGeoObject[:coordinates].empty?
67
+ aPoints = hGeoObject[:coordinates]
68
+ aPoints.each do |aPoint|
69
+ newPoint = {}
70
+ newPoint[:type] = 'Point'
71
+ newPoint[:coordinates] = aPoint
72
+ pointClass.writeXML(newPoint, {}, nil)
73
+ end
40
74
  end
41
- attributes['gml:id'] = objId
75
+ end
42
76
 
43
- # multiPoint attributes - srsDimension
44
- s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
45
- if !s.nil?
46
- attributes[:srsDimension] = s
47
- end
77
+ end # gml:Point tag
78
+ end # writeXML
79
+ end # multiPoint class
48
80
 
49
- # multiPoint attributes - srsName (GeoJSON is WGS84)
50
- attributes[:srsName] = 'WGS84'
51
-
52
- @xml.tag!('gml:MultiPoint', attributes) do
53
-
54
- # multipoint - properties for Feature
55
- unless hProperties.empty?
56
- geoPropClass.writeXML(hProperties)
57
- end
58
- if hProperties.empty? && @hResponseObj[:writerShowTags]
59
- @xml.tag!('gml:description')
60
- @xml.tag!('gml:identifier', {'codeSpace'=>''})
61
- @xml.tag!('gml:name')
62
- end
63
-
64
- # multipoint - point members (required)
65
- @xml.tag!('gml:pointMembers') do
66
- unless hGeoObject[:coordinates].empty?
67
- aPoints = hGeoObject[:coordinates]
68
- aPoints.each do |aPoint|
69
- newPoint = {}
70
- newPoint[:type] = 'Point'
71
- newPoint[:coordinates] = aPoint
72
- pointClass.writeXML(newPoint, {}, nil)
73
- end
74
- end
75
- end
76
-
77
- end # gml:Point tag
78
- end # writeXML
79
- end # multiPoint class
80
-
81
- end
82
- end
83
- end
81
+ end
82
+ end
83
+ end
84
84
  end
@@ -2,83 +2,83 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-12-06 original script
5
+ # Stan Smith 2016-12-06 original script
6
6
 
7
7
  require 'adiwg/mdtranslator/internal/module_coordinates'
8
8
  require_relative 'class_polygon'
9
9
  require_relative 'class_featureProperties'
10
10
 
11
11
  module ADIWG
12
- module Mdtranslator
13
- module Writers
14
- module Iso19115_2
15
-
16
- class MultiPolygon
17
-
18
- def initialize(xml, hResponseObj)
19
- @xml = xml
20
- @hResponseObj = hResponseObj
21
- end
22
-
23
- def writeXML(hGeoObject, hProperties, objId)
24
-
25
- # classes used
26
- geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
27
-
28
- # classes used
29
- polyClass = Polygon.new(@xml, @hResponseObj)
30
-
31
- # multiPolygon attributes
32
- attributes = {}
33
-
34
- # multiPolygon attributes - gml:id (required)
35
- if objId.nil?
36
- @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
37
- objId = 'multiPolygon' + @hResponseObj[:writerMissingIdCount]
38
- else
39
- objId.gsub!(/[^0-9a-zA-Z]/,'')
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_2
15
+
16
+ class MultiPolygon
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ end
22
+
23
+ def writeXML(hGeoObject, hProperties, objId)
24
+
25
+ # classes used
26
+ geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
27
+
28
+ # classes used
29
+ polyClass = Polygon.new(@xml, @hResponseObj)
30
+
31
+ # multiPolygon attributes
32
+ attributes = {}
33
+
34
+ # multiPolygon attributes - gml:id (required)
35
+ if objId.nil?
36
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
37
+ objId = 'multiPolygon' + @hResponseObj[:writerMissingIdCount]
38
+ else
39
+ objId.gsub!(/[^0-9a-zA-Z]/, '')
40
+ end
41
+ attributes['gml:id'] = objId
42
+
43
+ # multiPolygon attributes - srsDimension
44
+ s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
45
+ if !s.nil?
46
+ attributes[:srsDimension] = s
47
+ end
48
+
49
+ # multiPolygon attributes - srsName (GeoJSON is WGS84)
50
+ attributes[:srsName] = 'WGS84'
51
+
52
+ @xml.tag!('gml:MultiGeometry', attributes) do
53
+
54
+ # multiPolygon - properties for Feature
55
+ unless hProperties.empty?
56
+ geoPropClass.writeXML(hProperties)
57
+ end
58
+ if hProperties.empty? && @hResponseObj[:writerShowTags]
59
+ @xml.tag!('gml:description')
60
+ @xml.tag!('gml:identifier', {'codeSpace' => ''})
61
+ @xml.tag!('gml:name')
62
+ end
63
+
64
+ # multiPolygon - polygon members (required)
65
+ @xml.tag!('gml:geometryMembers') do
66
+ unless hGeoObject[:coordinates].empty?
67
+ aPolys = hGeoObject[:coordinates]
68
+ aPolys.each do |aPoly|
69
+ newPoly = {}
70
+ newPoly[:type] = 'Polygon'
71
+ newPoly[:coordinates] = aPoly
72
+ polyClass.writeXML(newPoly, {}, nil)
73
+ end
40
74
  end
41
- attributes['gml:id'] = objId
75
+ end
42
76
 
43
- # multiPolygon attributes - srsDimension
44
- s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
45
- if !s.nil?
46
- attributes[:srsDimension] = s
47
- end
77
+ end # gml:MultiGeometry tag
78
+ end # writeXML
79
+ end # MultiPolygon class
48
80
 
49
- # multiPolygon attributes - srsName (GeoJSON is WGS84)
50
- attributes[:srsName] = 'WGS84'
51
-
52
- @xml.tag!('gml:MultiGeometry', attributes) do
53
-
54
- # multiPolygon - properties for Feature
55
- unless hProperties.empty?
56
- geoPropClass.writeXML(hProperties)
57
- end
58
- if hProperties.empty? && @hResponseObj[:writerShowTags]
59
- @xml.tag!('gml:description')
60
- @xml.tag!('gml:identifier', {'codeSpace'=>''})
61
- @xml.tag!('gml:name')
62
- end
63
-
64
- # multiPolygon - polygon members (required)
65
- @xml.tag!('gml:geometryMembers') do
66
- unless hGeoObject[:coordinates].empty?
67
- aPolys = hGeoObject[:coordinates]
68
- aPolys.each do |aPoly|
69
- newPoly = {}
70
- newPoly[:type] = 'Polygon'
71
- newPoly[:coordinates] = aPoly
72
- polyClass.writeXML(newPoly, {}, nil)
73
- end
74
- end
75
- end
76
-
77
- end # gml:MultiGeometry tag
78
- end # writeXML
79
- end # MultiPolygon class
80
-
81
- end
82
- end
83
- end
81
+ end
82
+ end
83
+ end
84
84
  end
@@ -2,97 +2,100 @@
2
2
  # 19115-2 writer output in XML
3
3
 
4
4
  # History:
5
- # Stan Smith 2016-11-18 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 2015-06-11 change all codelists to use 'class_codelist' method
10
- # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
11
- # Stan Smith 2014-08-14 added protocol to onlineResource
12
- # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
5
+ # Stan Smith 2018-04-10 add error and warning messaging
6
+ # Stan Smith 2016-11-18 refactored for mdTranslator/mdJson 2.0
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 2015-06-11 change all codelists to use 'class_codelist' method
11
+ # Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
12
+ # Stan Smith 2014-08-14 added protocol to onlineResource
13
+ # Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
13
14
  # Stan Smith 2013-08-14 original script.
14
15
 
16
+ require_relative '../iso19115_2_writer'
15
17
  require_relative 'class_codelist'
16
18
 
17
19
  module ADIWG
18
- module Mdtranslator
19
- module Writers
20
- module Iso19115_2
20
+ module Mdtranslator
21
+ module Writers
22
+ module Iso19115_2
21
23
 
22
- class CI_OnlineResource
24
+ class CI_OnlineResource
23
25
 
24
- def initialize(xml, hResponseObj)
25
- @xml = xml
26
- @hResponseObj = hResponseObj
27
- end
26
+ def initialize(xml, hResponseObj)
27
+ @xml = xml
28
+ @hResponseObj = hResponseObj
29
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_2
30
+ end
28
31
 
29
- def writeXML(hOlResource)
32
+ def writeXML(hOlResource, inContext = nil)
30
33
 
31
- # classes used
32
- codelistClass = MD_Codelist.new(@xml, @hResponseObj)
34
+ # classes used
35
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
33
36
 
34
- @xml.tag! 'gmd:CI_OnlineResource' do
37
+ @xml.tag! 'gmd:CI_OnlineResource' do
35
38
 
36
- # online resource - link - required
37
- s = hOlResource[:olResURI]
38
- unless s.nil?
39
- @xml.tag!('gmd:linkage') do
40
- @xml.tag!('gmd:URL', s)
41
- end
42
- end
43
- if s.nil?
44
- @xml.tag!('gmd:linkage', {'gco:nilReason' => 'missing'})
45
- end
39
+ # online resource - link - required
40
+ s = hOlResource[:olResURI]
41
+ unless s.nil?
42
+ @xml.tag!('gmd:linkage') do
43
+ @xml.tag!('gmd:URL', s)
44
+ end
45
+ end
46
+ if s.nil?
47
+ @NameSpace.issueWarning(250, 'gmd:linkage', inContext)
48
+ end
46
49
 
47
- # online resource - protocol
48
- s = hOlResource[:olResProtocol]
49
- unless s.nil?
50
- @xml.tag!('gmd:protocol') do
51
- @xml.tag!('gco:CharacterString', s)
52
- end
53
- end
54
- if s.nil? && @hResponseObj[:writerShowTags]
55
- @xml.tag!('gmd:protocol')
56
- end
50
+ # online resource - protocol
51
+ s = hOlResource[:olResProtocol]
52
+ unless s.nil?
53
+ @xml.tag!('gmd:protocol') do
54
+ @xml.tag!('gco:CharacterString', s)
55
+ end
56
+ end
57
+ if s.nil? && @hResponseObj[:writerShowTags]
58
+ @xml.tag!('gmd:protocol')
59
+ end
57
60
 
58
- # online resource - link name
59
- s = hOlResource[:olResName]
60
- unless s.nil?
61
- @xml.tag!('gmd:name') do
62
- @xml.tag!('gco:CharacterString', s)
63
- end
64
- end
65
- if s.nil? && @hResponseObj[:writerShowTags]
66
- @xml.tag!('gmd:name')
67
- end
61
+ # online resource - link name
62
+ s = hOlResource[:olResName]
63
+ unless s.nil?
64
+ @xml.tag!('gmd:name') do
65
+ @xml.tag!('gco:CharacterString', s)
66
+ end
67
+ end
68
+ if s.nil? && @hResponseObj[:writerShowTags]
69
+ @xml.tag!('gmd:name')
70
+ end
68
71
 
69
- # online resource - link description
70
- s = hOlResource[:olResDesc]
71
- unless s.nil?
72
- @xml.tag!('gmd:description') do
73
- @xml.tag!('gco:CharacterString', s)
74
- end
75
- end
76
- if s.nil? && @hResponseObj[:writerShowTags]
77
- @xml.tag!('gmd:description')
78
- end
72
+ # online resource - link description
73
+ s = hOlResource[:olResDesc]
74
+ unless s.nil?
75
+ @xml.tag!('gmd:description') do
76
+ @xml.tag!('gco:CharacterString', s)
77
+ end
78
+ end
79
+ if s.nil? && @hResponseObj[:writerShowTags]
80
+ @xml.tag!('gmd:description')
81
+ end
79
82
 
80
- # online resource - link function {CI_OnLineFunctionCode}
81
- s = hOlResource[:olResFunction]
82
- unless s.nil?
83
- @xml.tag!('gmd:function') do
84
- codelistClass.writeXML('gmd', 'iso_onlineFunction',s)
85
- end
86
- end
87
- if s.nil? && @hResponseObj[:writerShowTags]
88
- @xml.tag!('gmd:function')
89
- end
83
+ # online resource - link function {CI_OnLineFunctionCode}
84
+ s = hOlResource[:olResFunction]
85
+ unless s.nil?
86
+ @xml.tag!('gmd:function') do
87
+ codelistClass.writeXML('gmd', 'iso_onlineFunction', s)
88
+ end
89
+ end
90
+ if s.nil? && @hResponseObj[:writerShowTags]
91
+ @xml.tag!('gmd:function')
92
+ end
90
93
 
91
- end # CI_OnlineResource tag
92
- end # write XML
93
- end # CI_OnlineResource class
94
+ end # CI_OnlineResource tag
95
+ end # write XML
96
+ end # CI_OnlineResource class
94
97
 
95
- end
96
- end
97
- end
98
+ end
99
+ end
100
+ end
98
101
  end