adiwg-mdtranslator 2.14.2 → 2.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (134) hide show
  1. checksums.yaml +4 -4
  2. data/.travis.yml +1 -1
  3. data/CHANGELOG.md +20 -5
  4. data/Rakefile +2 -0
  5. data/adiwg-mdtranslator.gemspec +2 -1
  6. data/lib/adiwg/mdtranslator.rb +1 -0
  7. data/lib/adiwg/mdtranslator/internal/module_codelistFun.rb +26 -0
  8. data/lib/adiwg/mdtranslator/internal/module_coordinates.rb +3 -0
  9. data/lib/adiwg/mdtranslator/internal/module_dateTimeFun.rb +1 -1
  10. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_date.rb +0 -1
  11. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_dateTime.rb +0 -1
  12. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_keyword.rb +1 -1
  13. data/lib/adiwg/mdtranslator/readers/fgdc/modules/module_taxonSystem.rb +2 -4
  14. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_contact.rb +0 -1
  15. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_date.rb +0 -2
  16. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_dateTime.rb +0 -2
  17. data/lib/adiwg/mdtranslator/readers/sbJson/modules/module_provenance.rb +0 -1
  18. data/lib/adiwg/mdtranslator/version.rb +3 -2
  19. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_attribute.rb +0 -1
  20. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +0 -1
  21. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateRange.rb +0 -1
  22. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_dateSingle.rb +0 -1
  23. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
  24. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_methodKeywords.rb +1 -1
  25. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_process.rb +0 -1
  26. data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_transferInfo.rb +0 -1
  27. data/lib/adiwg/mdtranslator/writers/html/sections/html_taxonomy.rb +1 -3
  28. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_additionalDocument.rb +48 -0
  29. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_address.rb +90 -0
  30. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_associatedResource.rb +84 -0
  31. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attribute.rb +107 -0
  32. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_attributeGroup.rb +69 -0
  33. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_baseUnit.rb +38 -0
  34. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_boundingBox.rb +70 -0
  35. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_browseGraphic.rb +95 -0
  36. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_citation.rb +205 -0
  37. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_codelist.rb +50 -0
  38. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraint.rb +51 -0
  39. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_constraintCommon.rb +104 -0
  40. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_contact.rb +119 -0
  41. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_conventionalUnit.rb +64 -0
  42. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_coverageDescription.rb +84 -0
  43. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dataIdentification.rb +347 -0
  44. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_date.rb +62 -0
  45. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_definitionUnit.rb +35 -0
  46. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_derivedUnit.rb +42 -0
  47. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_dimension.rb +72 -0
  48. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distribution.rb +62 -0
  49. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_distributor.rb +77 -0
  50. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_email.rb +44 -0
  51. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_extent.rb +85 -0
  52. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_feature.rb +71 -0
  53. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureCollection.rb +56 -0
  54. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_featureProperties.rb +64 -0
  55. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_format.rb +74 -0
  56. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_fraction.rb +46 -0
  57. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gcoDateTime.rb +45 -0
  58. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicElement.rb +77 -0
  59. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geographicExtent.rb +96 -0
  60. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometricObjects.rb +60 -0
  61. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_geometryCollection.rb +97 -0
  62. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georectified.rb +121 -0
  63. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_georeferenceable.rb +87 -0
  64. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gmlIdentifier.rb +32 -0
  65. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_grid.rb +71 -0
  66. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_gridRepresentation.rb +36 -0
  67. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_identifier.rb +95 -0
  68. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_imageDescription.rb +175 -0
  69. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_individual.rb +85 -0
  70. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_keyword.rb +78 -0
  71. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_legalConstraints.rb +87 -0
  72. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineString.rb +76 -0
  73. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_lineage.rb +97 -0
  74. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_locale.rb +67 -0
  75. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_maintenance.rb +101 -0
  76. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdBand.rb +82 -0
  77. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_mdMetadata.rb +372 -0
  78. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_measure.rb +71 -0
  79. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_medium.rb +113 -0
  80. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_miBand.rb +90 -0
  81. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiLine.rb +84 -0
  82. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPoint.rb +84 -0
  83. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_multiPolygon.rb +84 -0
  84. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_onlineResource.rb +91 -0
  85. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_orderProcess.rb +79 -0
  86. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_organization.rb +106 -0
  87. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_phone.rb +81 -0
  88. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_point.rb +77 -0
  89. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_polygon.rb +95 -0
  90. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_processStep.rb +130 -0
  91. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_rangeDimension.rb +94 -0
  92. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_referenceSystem.rb +92 -0
  93. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_releasability.rb +71 -0
  94. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_resolution.rb +97 -0
  95. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_responsibility.rb +91 -0
  96. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_sampleDimension.rb +127 -0
  97. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scope.rb +75 -0
  98. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_scopeDescription.rb +75 -0
  99. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_securityConstraints.rb +97 -0
  100. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_series.rb +63 -0
  101. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_source.rb +125 -0
  102. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_spatialRepresentation.rb +61 -0
  103. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_temporalExtent.rb +53 -0
  104. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timeInstant.rb +80 -0
  105. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_timePeriod.rb +113 -0
  106. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_transferOptions.rb +107 -0
  107. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_unitsOfMeasure.rb +258 -0
  108. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_usage.rb +134 -0
  109. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_useConstraints.rb +41 -0
  110. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_vectorRepresentation.rb +61 -0
  111. data/lib/adiwg/mdtranslator/writers/iso19115_1/classes/class_verticalExtent.rb +70 -0
  112. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer.rb +105 -0
  113. data/lib/adiwg/mdtranslator/writers/iso19115_1/iso19115_1_writer_messages_eng.yml +132 -0
  114. data/lib/adiwg/mdtranslator/writers/iso19115_1/readme.md +12 -0
  115. data/lib/adiwg/mdtranslator/writers/iso19115_1/version.rb +15 -0
  116. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +3 -2
  117. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +42 -39
  118. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +2 -2
  119. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +3 -1
  120. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +12 -7
  121. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +2 -3
  122. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
  123. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +1 -1
  124. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +42 -35
  125. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +4 -10
  126. data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +1 -1
  127. data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +5 -0
  128. data/lib/adiwg/mdtranslator/writers/iso19115_2/readme.md +2 -2
  129. data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +1 -1
  130. data/lib/adiwg/mdtranslator/writers/mdWriters.rb +7 -7
  131. data/lib/adiwg/mdtranslator/writers/sbJson/sections/sbJson_citation.rb +0 -1
  132. data/lib/adiwg/mdtranslator_cli.rb +2 -1
  133. metadata +93 -5
  134. data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_gmlIdentifier.rb +0 -55
@@ -0,0 +1,84 @@
1
+ # ISO <<Class>> MD_AssociatedResource
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-25 original script
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_codelist'
9
+ require_relative 'class_citation'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_1
15
+
16
+ class MD_AssociatedResource
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
22
+ end
23
+
24
+ def writeXML(hAssocRes, inContext = nil)
25
+
26
+ # classes used
27
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
28
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
29
+
30
+ outContext = 'associated resource'
31
+ outContext = inContext + ' associated resource' unless inContext.nil?
32
+
33
+ @xml.tag!('mri:MD_AssociatedResource') do
34
+
35
+ # associated resource - name {CI_Citation}
36
+ hResourceCitation = hAssocRes[:resourceCitation]
37
+ unless hResourceCitation.empty?
38
+ @xml.tag!('mri:name') do
39
+ citationClass.writeXML(hResourceCitation, outContext)
40
+ end
41
+ end
42
+ if hResourceCitation.empty? && @hResponseObj[:writerShowTags]
43
+ @xml.tag!('mri:name')
44
+ end
45
+
46
+ # associated resource - association type {DS_AssociationTypeCode} (required)
47
+ unless hAssocRes[:associationType].nil?
48
+ @xml.tag!('mri:associationType') do
49
+ codelistClass.writeXML('mri', 'iso_associationType', hAssocRes[:associationType])
50
+ end
51
+ end
52
+ if hAssocRes[:associationType].nil?
53
+ @NameSpace.issueWarning(1, 'mri:associationType')
54
+ end
55
+
56
+ # associated resource - initiative type {DS_InitiativeTypeCode}
57
+ unless hAssocRes[:initiativeType].nil?
58
+ @xml.tag!('mri:initiativeType') do
59
+ codelistClass.writeXML('mri', 'iso_initiativeType', hAssocRes[:initiativeType])
60
+ end
61
+ end
62
+ if hAssocRes[:initiativeType].nil? && @hResponseObj[:writerShowTags]
63
+ @xml.tag!('mri:initiativeType')
64
+ end
65
+
66
+ # associated resource - metadata reference {CI_Citation}
67
+ hMetadataCitation = hAssocRes[:metadataCitation]
68
+ unless hMetadataCitation.empty?
69
+ @xml.tag!('mri:metadataReference') do
70
+ citationClass.writeXML(hMetadataCitation, outContext)
71
+ end
72
+ end
73
+ if hMetadataCitation.empty? && @hResponseObj[:writerShowTags]
74
+ @xml.tag!('mri:metadataReference')
75
+ end
76
+
77
+ end # MD_AssociatedResource tag
78
+ end # writeXML
79
+ end # MD_AssociatedResource class
80
+
81
+ end
82
+ end
83
+ end
84
+ end
@@ -0,0 +1,107 @@
1
+ # ISO <<Class>> attribute group
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-08 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_rangeDimension'
9
+ require_relative 'class_sampleDimension'
10
+ require_relative 'class_mdBand'
11
+ require_relative 'class_miBand'
12
+
13
+ module ADIWG
14
+ module Mdtranslator
15
+ module Writers
16
+ module Iso19115_1
17
+
18
+ class Attribute
19
+
20
+ def initialize(xml, hResponseObj)
21
+ @xml = xml
22
+ @hResponseObj = hResponseObj
23
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
24
+ end
25
+
26
+ def writeXML(hAttribute, inContext = nil)
27
+
28
+ # classes used
29
+ rangeClass = MD_RangeDimension.new(@xml, @hResponseObj)
30
+ sampleClass = MD_SampleDimension.new(@xml, @hResponseObj)
31
+ mdBandClass = MD_Band.new(@xml, @hResponseObj)
32
+ miBandClass = MI_Band.new(@xml, @hResponseObj)
33
+
34
+ outContext = 'attribute'
35
+ outContext = inContext + ' attribute' unless inContext.nil?
36
+
37
+ unless hAttribute.empty?
38
+
39
+ # determine attribute classes to output
40
+ attributeTag = nil
41
+ unless hAttribute[:sequenceIdentifier].nil? &&
42
+ hAttribute[:sequenceIdentifierType].nil? &&
43
+ hAttribute[:attributeDescription].nil? &&
44
+ hAttribute[:attributeIdentifiers].nil?
45
+ attributeTag = 'mrc:MD_RangeDimension'
46
+ end
47
+ unless hAttribute[:maxValue].nil? &&
48
+ hAttribute[:minValue].nil? &&
49
+ hAttribute[:units].nil? &&
50
+ hAttribute[:scaleFactor].nil? &&
51
+ hAttribute[:offset].nil? &&
52
+ hAttribute[:meanValue].nil? &&
53
+ hAttribute[:numberOfValues].nil? &&
54
+ hAttribute[:standardDeviation].nil? &&
55
+ hAttribute[:bitsPerValue].nil?
56
+ attributeTag = 'mrc:MD_SampleDimension'
57
+ end
58
+ unless hAttribute[:boundMin].nil? &&
59
+ hAttribute[:boundMax].nil? &&
60
+ hAttribute[:boundUnits].nil? &&
61
+ hAttribute[:peakResponse].nil? &&
62
+ hAttribute[:toneGradations].nil?
63
+ attributeTag = 'mrc:MD_Band'
64
+ end
65
+ unless hAttribute[:bandBoundaryDefinition].nil? &&
66
+ hAttribute[:nominalSpatialResolution].nil? &&
67
+ hAttribute[:transferFunctionType].nil? &&
68
+ hAttribute[:transmittedPolarization].nil? &&
69
+ hAttribute[:detectedPolarization].nil?
70
+ attributeTag = 'mrc:MI_Band'
71
+ end
72
+
73
+ unless attributeTag.nil?
74
+ @xml.tag!(attributeTag) do
75
+ if attributeTag == 'mrc:MD_RangeDimension'
76
+ rangeClass.writeXML(hAttribute, outContext)
77
+ end
78
+ if attributeTag == 'mrc:MD_SampleDimension'
79
+ rangeClass.writeXML(hAttribute, outContext)
80
+ sampleClass.writeXML(hAttribute, outContext)
81
+ end
82
+ if attributeTag == 'mrc:MD_Band'
83
+ rangeClass.writeXML(hAttribute, outContext)
84
+ sampleClass.writeXML(hAttribute, outContext)
85
+ mdBandClass.writeXML(hAttribute)
86
+ end
87
+ if attributeTag == 'mrc:MI_Band'
88
+ rangeClass.writeXML(hAttribute, outContext)
89
+ sampleClass.writeXML(hAttribute, outContext)
90
+ mdBandClass.writeXML(hAttribute)
91
+ miBandClass.writeXML(hAttribute)
92
+ end
93
+ end
94
+ end
95
+ if attributeTag.nil?
96
+ @NameSpace.issueWarning(42, 'mrc:attribute', outContext)
97
+ end
98
+
99
+ end
100
+
101
+ end # writeXML
102
+ end # Attribute
103
+
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,69 @@
1
+ # ISO <<Class>> attribute group
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-05 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_codelist'
9
+ require_relative 'class_attribute'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_1
15
+
16
+ class MD_AttributeGroup
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
22
+ end
23
+
24
+ def writeXML(hGroup, inContext = nil)
25
+
26
+ # classes used
27
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
28
+ attributeClass = Attribute.new(@xml, @hResponseObj)
29
+
30
+ outContext = 'attribute group'
31
+ outContext = inContext + ' attribute group' unless inContext.nil?
32
+
33
+ unless hGroup.empty?
34
+ @xml.tag!('mrc:MD_AttributeGroup') do
35
+
36
+ # attribute group - content type [] {MD_CoverageContentTypeCode} (required)
37
+ aContentTypes = hGroup[:attributeContentTypes]
38
+ aContentTypes.each do |item|
39
+ @xml.tag!('mrc:contentType') do
40
+ codelistClass.writeXML('mrc', 'iso_coverageContentType', item)
41
+ end
42
+ end
43
+ if aContentTypes.empty?
44
+ @NameSpace.issueWarning(41, 'mrc:contentType', outContext)
45
+ end
46
+
47
+ # attribute group - attribute [] (abstract)
48
+ aAttributes = hGroup[:attributes]
49
+ aAttributes.each do |hAttribute|
50
+ unless hAttribute.empty?
51
+ @xml.tag!('mrc:attribute') do
52
+ attributeClass.writeXML(hAttribute, outContext)
53
+ end
54
+ end
55
+ end
56
+ if aAttributes.empty? && @hResponseObj[:writerShowTags]
57
+ @xml.tag!('mrc:attribute')
58
+ end
59
+
60
+ end
61
+ end
62
+
63
+ end # writeXML
64
+ end # AttributeGroup class
65
+
66
+ end
67
+ end
68
+ end
69
+ end
@@ -0,0 +1,38 @@
1
+ # ISO <<Class>> BaseUnit
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-08 copied from 19115_2 writer
6
+
7
+ module ADIWG
8
+ module Mdtranslator
9
+ module Writers
10
+ module Iso19115_1
11
+
12
+ class BaseUnit
13
+
14
+ def initialize(xml, hResponseObj)
15
+ @xml = xml
16
+ @hResponseObj = hResponseObj
17
+ end
18
+
19
+ def writeXML(hBase)
20
+
21
+ # create and identity for the unit
22
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
23
+ unitID = 'unit' + @hResponseObj[:writerMissingIdCount]
24
+ @xml.tag!('gml:BaseUnit', {'gml:id' => unitID}) do
25
+ @xml.tag!('gml:identifier', {'codeSpace' => hBase[:codeSpace]}, hBase[:identifier])
26
+ @xml.tag!('gml:name', hBase[:name])
27
+ @xml.tag!('gml:catalogSymbol', hBase[:catalogSymbol])
28
+ @xml.tag!('gml:unitsSystem', {'xlink:href' => hBase[:unitsSystem]})
29
+ end
30
+
31
+ end
32
+
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,70 @@
1
+ # ISO <<Class>> EX_GeographicBoundingBox
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-19 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 EX_GeographicBoundingBox
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(hBBox)
23
+
24
+ # bounding box - west longitude (required)
25
+ unless hBBox[:westLongitude].nil?
26
+ @xml.tag!('gex:westBoundLongitude') do
27
+ @xml.tag!('gco:Decimal', hBBox[:westLongitude])
28
+ end
29
+ end
30
+ if hBBox[:westLongitude].nil?
31
+ @NameSpace.issueError(10)
32
+ end
33
+
34
+ # bounding box - east longitude (required)
35
+ unless hBBox[:eastLongitude].nil?
36
+ @xml.tag!('gex:eastBoundLongitude') do
37
+ @xml.tag!('gco:Decimal', hBBox[:eastLongitude])
38
+ end
39
+ end
40
+ if hBBox[:eastLongitude].nil?
41
+ @NameSpace.issueError(11)
42
+ end
43
+
44
+ # bounding box - south latitude (required)
45
+ unless hBBox[:southLatitude].nil?
46
+ @xml.tag!('gex:southBoundLatitude') do
47
+ @xml.tag!('gco:Decimal', hBBox[:southLatitude])
48
+ end
49
+ end
50
+ if hBBox[:southLatitude].nil?
51
+ @NameSpace.issueError(12)
52
+ end
53
+
54
+ # bounding box - north latitude (required)
55
+ unless hBBox[:northLatitude].nil?
56
+ @xml.tag!('gex:northBoundLatitude') do
57
+ @xml.tag!('gco:Decimal', hBBox[:northLatitude])
58
+ end
59
+ end
60
+ if hBBox[:northLatitude].nil?
61
+ @NameSpace.issueError(13)
62
+ end
63
+
64
+ end # writeXML
65
+ end # EX_GeographicBoundingBox class
66
+
67
+ end
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,95 @@
1
+ # ISO <<Class>> MD_BrowseGraphic
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-15 original script
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_constraint'
9
+ require_relative 'class_onlineResource'
10
+
11
+ module ADIWG
12
+ module Mdtranslator
13
+ module Writers
14
+ module Iso19115_1
15
+
16
+ class MD_BrowseGraphic
17
+
18
+ def initialize(xml, hResponseObj)
19
+ @xml = xml
20
+ @hResponseObj = hResponseObj
21
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
22
+ end
23
+
24
+ def writeXML(hGraphic, inContext = nil)
25
+
26
+ # classes used
27
+ onlineClass = CI_OnlineResource.new(@xml, @hResponseObj)
28
+ constraintClass = Constraint.new(@xml, @hResponseObj)
29
+
30
+ outContext = 'browse graphic'
31
+ outContext = inContext + ' browse graphic' unless inContext.nil?
32
+
33
+ @xml.tag!('mcc:MD_BrowseGraphic') do
34
+
35
+ # browse graphic - file name (required)
36
+ unless hGraphic[:graphicName].nil?
37
+ @xml.tag!('mcc:fileName') do
38
+ @xml.tag!('gco:CharacterString', hGraphic[:graphicName])
39
+ end
40
+ end
41
+ if hGraphic[:graphicName].nil?
42
+ @NameSpace.issueWarning(20, 'mcc:fileName', outContext)
43
+ end
44
+
45
+ # browse graphic - file description
46
+ unless hGraphic[:graphicDescription].nil?
47
+ @xml.tag!('mcc:fileDescription') do
48
+ @xml.tag!('gco:CharacterString', hGraphic[:graphicDescription])
49
+ end
50
+ end
51
+ if hGraphic[:graphicDescription].nil? && @hResponseObj[:writerShowTags]
52
+ @xml.tag!('mcc:fileDescription')
53
+ end
54
+
55
+ # browse graphic - file type
56
+ unless hGraphic[:graphicType].nil?
57
+ @xml.tag!('mcc:fileType') do
58
+ @xml.tag!('gco:CharacterString', hGraphic[:graphicType])
59
+ end
60
+ end
61
+ if hGraphic[:graphicType].nil? && @hResponseObj[:writerShowTags]
62
+ @xml.tag!('mcc:fileType')
63
+ end
64
+
65
+ # browse graphic - image constraint []
66
+ # {MD_Constraints | MD_SecurityConstraints | MD_LegalConstraints}
67
+ aConstraint = hGraphic[:graphicConstraints]
68
+ aConstraint.each do |hCon|
69
+ @xml.tag!('mcc:imageConstraints') do
70
+ constraintClass.writeXML(hCon, outContext)
71
+ end
72
+ end
73
+ if aConstraint.empty? && @hResponseObj[:writerShowTags]
74
+ @xml.tag!('mcc:imageConstraints')
75
+ end
76
+
77
+ # browse graphic - linkage [] {CI_OnlineResource}
78
+ aOnline = hGraphic[:graphicURI]
79
+ aOnline.each do |hOnline|
80
+ @xml.tag!('mcc:linkage') do
81
+ onlineClass.writeXML(hOnline, outContext)
82
+ end
83
+ end
84
+ if aOnline.empty? && @hResponseObj[:writerShowTags]
85
+ @xml.tag!('mcc:linkage')
86
+ end
87
+
88
+ end # MD_BrowseGraphic tag
89
+ end # writeXML
90
+ end # MD_BrowseGraphic class
91
+
92
+ end
93
+ end
94
+ end
95
+ end