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,94 @@
1
+ # ISO <<Class>> MD_RangeDimension attributes
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_identifier'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class MD_RangeDimension
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
21
+ end
22
+
23
+ def writeXML(hAttribute, inContext = nil)
24
+
25
+ # classes used
26
+ identifierClass = MD_Identifier.new(@xml, @hResponseObj)
27
+
28
+ outContext = 'attribute'
29
+ outContext = inContext + ' attribute' unless inContext.nil?
30
+
31
+ # range dimension - sequence identifier {MemberName}
32
+ haveSeqId = false
33
+ haveSeqId = true unless hAttribute[:sequenceIdentifier].nil?
34
+ haveSeqId = true unless hAttribute[:sequenceIdentifierType].nil?
35
+ if haveSeqId
36
+ @xml.tag!('mrc:sequenceIdentifier') do
37
+ @xml.tag!('gco:MemberName') do
38
+
39
+ unless hAttribute[:sequenceIdentifier].nil?
40
+ @xml.tag!('gco:aName') do
41
+ @xml.tag!('gco:CharacterString', hAttribute[:sequenceIdentifier])
42
+ end
43
+ end
44
+ if hAttribute[:sequenceIdentifier].nil?
45
+ @NameSpace.issueWarning(350, 'gco:aName', outContext)
46
+ end
47
+
48
+ unless hAttribute[:sequenceIdentifierType].nil?
49
+ @xml.tag!('gco:attributeType') do
50
+ @xml.tag!('gco:TypeName') do
51
+ @xml.tag!('gco:aName') do
52
+ @xml.tag!('gco:CharacterString', hAttribute[:sequenceIdentifierType])
53
+ end
54
+ end
55
+ end
56
+ end
57
+ if hAttribute[:sequenceIdentifierType].nil?
58
+ @NameSpace.issueWarning(351, 'gco:aName', outContext)
59
+ end
60
+ end
61
+ end
62
+ end
63
+ if !haveSeqId && @hResponseObj[:writerShowTags]
64
+ @xml.tag!('mrc:sequenceIdentifier')
65
+ end
66
+
67
+ # range dimension - description
68
+ unless hAttribute[:attributeDescription].nil?
69
+ @xml.tag!('mrc:description') do
70
+ @xml.tag!('gco:CharacterString', hAttribute[:attributeDescription])
71
+ end
72
+ end
73
+ if hAttribute[:attributeDescription].nil? && @hResponseObj[:writerShowTags]
74
+ @xml.tag!('mrc:description')
75
+ end
76
+
77
+ # range dimension - name [] {MD_Identifier}
78
+ aNames = hAttribute[:attributeIdentifiers]
79
+ aNames.each do |hIdentifier|
80
+ @xml.tag!('mrc:name') do
81
+ identifierClass.writeXML(hIdentifier, outContext)
82
+ end
83
+ end
84
+ if aNames.empty? && @hResponseObj[:writerShowTags]
85
+ @xml.tag!('mrc:name')
86
+ end
87
+
88
+ end # writeXML
89
+ end # MD_RangeDescription
90
+
91
+ end
92
+ end
93
+ end
94
+ end
@@ -0,0 +1,92 @@
1
+ # ISO <<Class>> MD_ReferenceSystem
2
+ # writer
3
+ # 19115-1 output for XML
4
+
5
+ # History:
6
+ # Stan Smith 2019-03-19 original script
7
+
8
+ require 'adiwg/mdtranslator/internal/internal_metadata_obj'
9
+ require_relative 'class_codelist'
10
+ require_relative 'class_identifier'
11
+
12
+ module ADIWG
13
+ module Mdtranslator
14
+ module Writers
15
+ module Iso19115_1
16
+
17
+ class MD_ReferenceSystem
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(hSystem, inContext = nil)
26
+
27
+ # classes used
28
+ intMetadataClass = InternalMetadata.new
29
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
30
+ idClass = MD_Identifier.new(@xml, @hResponseObj)
31
+
32
+ outContext = 'spatial reference system'
33
+ outContext = inContext + ' spatial reference system' unless inContext.nil?
34
+
35
+ unless hSystem.empty?
36
+ @xml.tag!('mrs:MD_ReferenceSystem') do
37
+ haveSystem = false
38
+
39
+ # reference system - reference system identifier {MD_Identifier}
40
+ unless hSystem[:systemIdentifier].empty?
41
+ @xml.tag!('mrs:referenceSystemIdentifier') do
42
+ idClass.writeXML(hSystem[:systemIdentifier], outContext)
43
+ end
44
+ haveSystem = true
45
+ end
46
+
47
+ # reference system - reference system WKT {MD_Identifier}
48
+ if hSystem[:systemIdentifier].empty? && !hSystem[:systemWKT].nil?
49
+ hIdentifier = intMetadataClass.newIdentifier
50
+ hIdentifier[:identifier] = 'WKT'
51
+ hIdentifier[:namespace] = 'www.opengeospatial.org/standards/wkt-crs'
52
+ hIdentifier[:description] = hSystem[:systemWKT]
53
+ @xml.tag!('mrs:referenceSystemIdentifier') do
54
+ idClass.writeXML(hIdentifier, outContext)
55
+ end
56
+ haveSystem = true
57
+ end
58
+
59
+ # test for missing reference system identifier / reference system WKT
60
+ # both use the same ISO tag
61
+ if hSystem[:systemIdentifier].empty? && @hResponseObj[:writerShowTags] && !haveSystem
62
+ @xml.tag!('mrs:referenceSystemIdentifier')
63
+ end
64
+
65
+ # reference system - reference system type {MD_ReferenceSystemTypeCode}
66
+ unless hSystem[:systemType].nil?
67
+ @xml.tag!('mrs:referenceSystemType') do
68
+ codelistClass.writeXML('mrs', 'iso_referenceSystemType', hSystem[:systemType])
69
+ end
70
+ haveSystem = true
71
+ end
72
+ if hSystem[:systemType].nil? && @hResponseObj[:writerShowTags]
73
+ @xml.tag!('mrs:referenceSystemType')
74
+ end
75
+
76
+ if !haveSystem
77
+ @NameSpace.issueWarning(380, nil, inContext)
78
+ @NameSpace.issueWarning(381, nil, inContext)
79
+ end
80
+
81
+ # reference system parameter sets not implemented in ISO 19115-3
82
+
83
+ end
84
+ end
85
+
86
+ end # writeXML
87
+ end # MD_ReferenceSystem class
88
+
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,71 @@
1
+ # ISO <<Class>> MD_Releasability
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-18 original script
6
+
7
+ require_relative 'class_responsibility'
8
+ require_relative 'class_codelist'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class MD_Releasability
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ end
21
+
22
+ def writeXML(hRelease, inContext = nil)
23
+
24
+ @xml.tag!('mco:MD_Releasability') do
25
+
26
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
27
+ responsibleClass = CI_Responsibility.new(@xml, @hResponseObj)
28
+
29
+ outContext = 'releasability'
30
+ outContext = inContext + ' releasability' unless inContext.nil?
31
+
32
+ # releasability - addressee [] {CI_Responsibility}
33
+ aParties = hRelease[:addressee]
34
+ aParties.each do |hRParty|
35
+ @xml.tag!('mco:addressee') do
36
+ responsibleClass.writeXML(hRParty, outContext)
37
+ end
38
+ end
39
+ if aParties.empty? && @hResponseObj[:writerShowTags]
40
+ @xml.tag!('mco:addressee')
41
+ end
42
+
43
+ # releasability - statement
44
+ unless hRelease[:statement].nil?
45
+ @xml.tag!('mco:statement') do
46
+ @xml.tag!('gco:CharacterString', hRelease[:statement])
47
+ end
48
+ end
49
+ if hRelease[:statement].nil? && @hResponseObj[:writerShowTags]
50
+ @xml.tag!('mco:statement')
51
+ end
52
+
53
+ # releasability - dissemination constraint [] {MD_RestrictionCode}
54
+ aConstraint = hRelease[:disseminationConstraint]
55
+ aConstraint.each do |constraint|
56
+ @xml.tag!('mco:disseminationConstraints') do
57
+ codelistClass.writeXML('mco', 'iso_restriction', constraint)
58
+ end
59
+ end
60
+ if aConstraint.empty? && @hResponseObj[:writerShowTags]
61
+ @xml.tag!('mco:disseminationConstraints')
62
+ end
63
+
64
+ end # MD_Releasability tag
65
+ end # writeXML
66
+ end # MD_Releasability class
67
+
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,97 @@
1
+ # ISO <<Class>> MD_Resolution
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-21 original script
6
+
7
+ require_relative 'class_measure'
8
+ require_relative 'class_fraction'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class MD_Resolution
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ end
21
+
22
+ def writeXML(hResolution, inContext = nil)
23
+
24
+ # classes used
25
+ measureClass = Measure.new(@xml, @hResponseObj)
26
+ fractionClass = MD_RepresentativeFraction.new(@xml, @hResponseObj)
27
+
28
+ outContext = 'resolution'
29
+ outContext = inContext + ' resolution' unless inContext.nil?
30
+
31
+ # spatial resolution - equivalent scale
32
+ unless hResolution[:scaleFactor].nil?
33
+ @xml.tag!('mri:MD_Resolution') do
34
+ @xml.tag!('mri:equivalentScale') do
35
+ fractionClass.writeXML(hResolution[:scaleFactor], outContext)
36
+ end
37
+ end
38
+ end
39
+
40
+ # spatial resolution - distance (when type='distance')
41
+ unless hResolution[:measure].empty?
42
+ hMeasure = hResolution[:measure]
43
+ unless hMeasure.empty?
44
+ if hMeasure[:type] == 'distance'
45
+ @xml.tag!('mri:MD_Resolution') do
46
+ @xml.tag!('mri:distance') do
47
+ measureClass.writeXML(hMeasure)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+
54
+ # spatial resolution - angular distance (when type='angle')
55
+ unless hResolution[:measure].empty?
56
+ hMeasure = hResolution[:measure]
57
+ unless hMeasure.empty?
58
+ if hMeasure[:type] == 'angle'
59
+ @xml.tag!('mri:MD_Resolution') do
60
+ @xml.tag!('mri:angularDistance') do
61
+ measureClass.writeXML(hMeasure)
62
+ end
63
+ end
64
+ end
65
+ end
66
+ end
67
+
68
+ # spatial resolution - distance (when type='vertical')
69
+ unless hResolution[:measure].empty?
70
+ hMeasure = hResolution[:measure]
71
+ unless hMeasure.empty?
72
+ if hMeasure[:type] == 'vertical'
73
+ @xml.tag!('mri:MD_Resolution') do
74
+ @xml.tag!('mri:vertical') do
75
+ measureClass.writeXML(hMeasure)
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+
82
+ # spatial resolution - level of detail (when type='levelOfDetail')
83
+ unless hResolution[:levelOfDetail].nil?
84
+ @xml.tag!('mri:MD_Resolution') do
85
+ @xml.tag!('mri:levelOfDetail') do
86
+ @xml.tag!('gco:CharacterString', hResolution[:levelOfDetail])
87
+ end
88
+ end
89
+ end
90
+
91
+ end # writeXML
92
+ end # Measure class
93
+
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,91 @@
1
+ # ISO <<Class>> CI_Responsibility
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-14 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_codelist'
9
+ require_relative 'class_extent'
10
+ require_relative 'class_individual'
11
+ require_relative 'class_organization'
12
+
13
+ module ADIWG
14
+ module Mdtranslator
15
+ module Writers
16
+ module Iso19115_1
17
+
18
+ class CI_Responsibility
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(hResponsibility, inContext = nil)
27
+
28
+ # classes used
29
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
30
+ extentClass = EX_Extent.new(@xml, @hResponseObj)
31
+ individualClass = CI_Individual.new(@xml, @hResponseObj)
32
+ orgClass = CI_Organization.new(@xml, @hResponseObj)
33
+
34
+ outContext = 'responsible party'
35
+ outContext = inContext + ' responsible party' unless inContext.nil?
36
+
37
+ @xml.tag!('cit:CI_Responsibility') do
38
+
39
+ # responsibility - role (required)
40
+ unless hResponsibility[:roleName].nil?
41
+ @xml.tag!('cit:role') do
42
+ codelistClass.writeXML('cit', 'iso_role', hResponsibility[:roleName])
43
+ end
44
+ end
45
+ if hResponsibility[:roleName].nil?
46
+ @NameSpace.issueWarning(270, 'cit:role', outContext)
47
+ end
48
+
49
+ # responsibility - extent [] {EX_Extent}
50
+ aExtents = hResponsibility[:roleExtents]
51
+ aExtents.each do |hExtent|
52
+ @xml.tag!('cit:extent') do
53
+ extentClass.writeXML(hExtent)
54
+ end
55
+ end
56
+ if aExtents.empty? && @hResponseObj[:writerShowTags]
57
+ @xml.tag!('cit:extent')
58
+ end
59
+
60
+ # responsibility - party [] {CI_Individual | CI_Organization} (required)
61
+ aParty = hResponsibility[:parties]
62
+ aParty.each do |hParty|
63
+ unless hParty.empty?
64
+ contactId = hParty[:contactId]
65
+ hContact = @NameSpace.getContact(contactId)
66
+ unless hContact.empty?
67
+ @xml.tag!('cit:party') do
68
+ if hContact[:isOrganization]
69
+ orgClass.writeXML(hParty, hContact, outContext)
70
+ else
71
+ individualClass.writeXML(hContact, outContext)
72
+ end
73
+ end
74
+ end
75
+ if hContact.empty?
76
+ @NameSpace.issueWarning(272, 'cit:party', outContext)
77
+ end
78
+ end
79
+ if hParty.empty?
80
+ @NameSpace.issueWarning(271, 'cit:party', outContext)
81
+ end
82
+ end
83
+
84
+ end # CI_Responsibility tag
85
+ end # write XML
86
+ end # CI_ResponsibleParty class
87
+
88
+ end
89
+ end
90
+ end
91
+ end