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,106 @@
1
+ # ISO <<Class>> CI_Organization
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_contact'
9
+ require_relative 'class_browseGraphic'
10
+ require_relative 'class_individual'
11
+
12
+ module ADIWG
13
+ module Mdtranslator
14
+ module Writers
15
+ module Iso19115_1
16
+
17
+ class CI_Organization
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(hParty, hContact, inContext = nil)
26
+
27
+ # classes used
28
+ contactClass = CI_Contact.new(@xml, @hResponseObj)
29
+ graphicClass = MD_BrowseGraphic.new(@xml, @hResponseObj)
30
+ individualClass = CI_Individual.new(@xml, @hResponseObj)
31
+
32
+ outContext = 'responsible party'
33
+ outContext = inContext + ' responsible party' unless inContext.nil?
34
+
35
+ unless hContact.empty?
36
+ @xml.tag!('cit:CI_Organisation') do
37
+
38
+ # organization - name
39
+ unless hContact[:name].nil?
40
+ @xml.tag!('cit:name') do
41
+ @xml.tag!('gco:CharacterString', hContact[:name])
42
+ end
43
+ end
44
+ if hContact[:name].nil? && @hResponseObj[:writerShowTags]
45
+ @xml.tag!('cit:name')
46
+ end
47
+
48
+ # organization - contact information [] (only one contact information in this implementation)
49
+ haveInfo = false
50
+ unless hContact[:phones].empty? &&
51
+ hContact[:addresses].empty? &&
52
+ hContact[:eMailList].empty? &&
53
+ hContact[:onlineResources].empty? &&
54
+ hContact[:hoursOfService].empty? &&
55
+ hContact[:contactInstructions].nil?
56
+ haveInfo = true
57
+ end
58
+ if haveInfo
59
+ @xml.tag!('cit:contactInfo') do
60
+ contactClass.writeXML(hContact)
61
+ end
62
+ end
63
+ if !haveInfo && @hResponseObj[:writerShowTags]
64
+ @xml.tag!('cit:contactInfo')
65
+ end
66
+
67
+ # organization - logo [] {MD_BrowseGraphic}
68
+ aLogos = hContact[:logos]
69
+ aLogos.each do |hLogo|
70
+ unless hLogo.empty?
71
+ @xml.tag!('cit:logo') do
72
+ graphicClass.writeXML(hLogo)
73
+ end
74
+ end
75
+ end
76
+ if aLogos.empty?
77
+ @xml.tag!('cit:logo')
78
+ end
79
+
80
+ # organization - individual [] {CI_Individual}
81
+ aMembers = hContact[:memberOfOrgs]
82
+ aMembers.each do |memberId|
83
+ hMember = @NameSpace.getContact(memberId)
84
+ unless hMember.empty?
85
+ @xml.tag!('cit:individual') do
86
+ individualClass.writeXML(hMember, outContext)
87
+ end
88
+ end
89
+ end
90
+ if aMembers.empty?
91
+ @xml.tag!('cit:individual')
92
+ end
93
+
94
+ end
95
+ if hContact.empty?
96
+ @NameSpace.issueWarning(271, nil, outContext)
97
+ end
98
+
99
+ end
100
+ end # write XML
101
+ end # CI_Organization class
102
+
103
+ end
104
+ end
105
+ end
106
+ end
@@ -0,0 +1,81 @@
1
+ # ISO <<Class>> CI_Telephone
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-18 original script.
6
+
7
+ require_relative 'class_codelist'
8
+
9
+ module ADIWG
10
+ module Mdtranslator
11
+ module Writers
12
+ module Iso19115_1
13
+
14
+ class CI_Telephone
15
+
16
+ def initialize(xml, hResponseObj)
17
+ @xml = xml
18
+ @hResponseObj = hResponseObj
19
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
20
+ end
21
+
22
+ def writePhone(number, service, inContext)
23
+
24
+ # classes used
25
+ codelistClass = MD_Codelist.new(@xml, @hResponseObj)
26
+
27
+ @xml.tag!('cit:phone') do
28
+ @xml.tag!('cit:CI_Telephone') do
29
+
30
+ # phone - phone number (required)
31
+ unless number.nil?
32
+ @xml.tag!('cit:number') do
33
+ @xml.tag!('gco:CharacterString', number)
34
+ end
35
+ end
36
+ if number.nil?
37
+ @NameSpace.issueWarning(370, 'cit:number', inContext)
38
+ end
39
+
40
+ # phone - phone number type {CI_TelephoneTypeCode}
41
+ unless service.nil?
42
+ @xml.tag!('cit:numberType') do
43
+ codelistClass.writeXML('cit', 'iso_telephone', service)
44
+ end
45
+ end
46
+ if service.nil? && @hResponseObj[:writerShowTags]
47
+ @xml.tag!('cit:numberType')
48
+ end
49
+
50
+ end
51
+ end
52
+ end
53
+
54
+ def writeXML(aPhones, inContext = nil)
55
+
56
+ outContext = 'phone'
57
+ outContext = inContext + ' phone' unless inContext.nil?
58
+
59
+ aPhones.each do |hPhone|
60
+ unless hPhone.empty?
61
+ number = hPhone[:phoneNumber]
62
+ aServices = hPhone[:phoneServiceTypes]
63
+
64
+ if aServices.empty?
65
+ writePhone(number, nil, outContext)
66
+ else
67
+ aServices.each do |service|
68
+ writePhone(number, service, outContext)
69
+ end
70
+ end
71
+
72
+ end
73
+ end
74
+
75
+ end # write XML
76
+ end # CI_Telephone class
77
+
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,77 @@
1
+ # GML Point
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-20 original script
6
+
7
+ require 'adiwg/mdtranslator/internal/module_coordinates'
8
+ require_relative 'class_featureProperties'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class Point
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ end
21
+
22
+ def writeXML(hGeoObject, hProperties, objId)
23
+
24
+ # classes used
25
+ geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
26
+
27
+ # Point attributes
28
+ attributes = {}
29
+
30
+ # Point attributes - gml:id (required)
31
+ if objId.nil?
32
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
33
+ objId = 'point' + @hResponseObj[:writerMissingIdCount]
34
+ else
35
+ objId.gsub!(/[^0-9a-zA-Z]/,'')
36
+ end
37
+ attributes['gml:id'] = objId
38
+
39
+ # Point attributes - srsDimension
40
+ nDimension = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
41
+ unless nDimension.nil?
42
+ attributes[:srsDimension] = nDimension
43
+ end
44
+
45
+ # Point attributes - srsName (GeoJSON is WGS84)
46
+ attributes[:srsName] = 'WGS84'
47
+
48
+ @xml.tag!('gml:Point', attributes) do
49
+
50
+ # point - properties for Feature
51
+ unless hProperties.empty?
52
+ geoPropClass.writeXML(hProperties)
53
+ end
54
+ if hProperties.empty? && @hResponseObj[:writerShowTags]
55
+ @xml.tag!('gml:description')
56
+ @xml.tag!('gml:identifier', {'codeSpace' => ''})
57
+ @xml.tag!('gml:name')
58
+ end
59
+
60
+ # point - pos (required)
61
+ s = ''
62
+ unless hGeoObject[:coordinates].empty?
63
+ hGeoObject[:coordinates].each do |coord|
64
+ s += coord.to_s + ' '
65
+ end
66
+ s = s.strip
67
+ end
68
+ @xml.tag!('gml:pos', s)
69
+
70
+ end # gml:Point tag
71
+ end # writeXML
72
+ end # Point class
73
+
74
+ end
75
+ end
76
+ end
77
+ end
@@ -0,0 +1,95 @@
1
+ # GML Polygon
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-03-20 original script.
6
+
7
+ require 'adiwg/mdtranslator/internal/module_coordinates'
8
+ require_relative 'class_featureProperties'
9
+
10
+ module ADIWG
11
+ module Mdtranslator
12
+ module Writers
13
+ module Iso19115_1
14
+
15
+ class Polygon
16
+
17
+ def initialize(xml, hResponseObj)
18
+ @xml = xml
19
+ @hResponseObj = hResponseObj
20
+ end
21
+
22
+ def writeXML(hGeoObject, hProperties, objId)
23
+
24
+ # classes used
25
+ geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
26
+
27
+ # polygon attributes
28
+ attributes = {}
29
+
30
+ # polygon attributes - gml:id (required)
31
+ if objId.nil?
32
+ @hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
33
+ objId = 'polygon' + @hResponseObj[:writerMissingIdCount]
34
+ else
35
+ objId.gsub!(/[^0-9a-zA-Z]/, '')
36
+ end
37
+ attributes['gml:id'] = objId
38
+
39
+ # polygon attributes - srsDimension
40
+ s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
41
+ if !s.nil?
42
+ attributes[:srsDimension] = s
43
+ end
44
+
45
+ # polygon attributes - srsName (GeoJSON is WGS84)
46
+ attributes[:srsName] = 'WGS84'
47
+
48
+ @xml.tag!('gml:Polygon', attributes) do
49
+
50
+ # polygon - properties for Feature
51
+ unless hProperties.empty?
52
+ geoPropClass.writeXML(hProperties)
53
+ end
54
+ if hProperties.empty? && @hResponseObj[:writerShowTags]
55
+ @xml.tag!('gml:description')
56
+ @xml.tag!('gml:identifier', {'codeSpace' => ''})
57
+ @xml.tag!('gml:name')
58
+ end
59
+
60
+ aPolygons = hGeoObject[:coordinates]
61
+ aExterior = aPolygons[0]
62
+ aInterior = aPolygons.drop(1)
63
+
64
+ # polygon - exterior ring (required)
65
+ unless aExterior.nil?
66
+ @xml.tag!('gml:exterior') do
67
+ @xml.tag!('gml:LinearRing') do
68
+ aExterior.each do |aCoord|
69
+ s = aCoord[0].to_s + ' ' + aCoord[1].to_s
70
+ @xml.tag!('gml:pos', s)
71
+ end
72
+ end
73
+ end
74
+ end
75
+
76
+ # polygon - interior rings
77
+ aInterior.each do |aRing|
78
+ @xml.tag!('gml:interior') do
79
+ @xml.tag!('gml:LinearRing') do
80
+ aRing.each do |aCoord|
81
+ s = aCoord[0].to_s + ' ' + aCoord[1].to_s
82
+ @xml.tag!('gml:pos', s)
83
+ end
84
+ end
85
+ end
86
+ end
87
+
88
+ end # gml:Polygon tag
89
+ end # writeXML
90
+ end # Polygon class
91
+
92
+ end
93
+ end
94
+ end
95
+ end
@@ -0,0 +1,130 @@
1
+ # ISO <<Class>> LI_ProcessStep
2
+ # 19115-1 writer output in XML
3
+
4
+ # History:
5
+ # Stan Smith 2019-04-10 original script.
6
+
7
+ require_relative '../iso19115_1_writer'
8
+ require_relative 'class_responsibility'
9
+ require_relative 'class_source'
10
+ require_relative 'class_timePeriod'
11
+ require_relative 'class_citation'
12
+ require_relative 'class_scope'
13
+
14
+ module ADIWG
15
+ module Mdtranslator
16
+ module Writers
17
+ module Iso19115_1
18
+
19
+ class LI_ProcessStep
20
+
21
+ def initialize(xml, hResponseObj)
22
+ @xml = xml
23
+ @hResponseObj = hResponseObj
24
+ @NameSpace = ADIWG::Mdtranslator::Writers::Iso19115_1
25
+ end
26
+
27
+ def writeXML(hStep, inContext = nil)
28
+
29
+ # classes used
30
+ responsibilityClass = CI_Responsibility.new(@xml, @hResponseObj)
31
+ sourceClass = LI_Source.new(@xml, @hResponseObj)
32
+ periodClass = TimePeriod.new(@xml, @hResponseObj)
33
+ citationClass = CI_Citation.new(@xml, @hResponseObj)
34
+ scopeClass = MD_Scope.new(@xml, @hResponseObj)
35
+
36
+ outContext = 'process step'
37
+ outContext = inContext + ' process step ' unless inContext.nil?
38
+ outContext = outContext + ' ' + hStep[:stepId].to_s unless hStep[:stepId].nil?
39
+
40
+ # process step - id
41
+ attributes = {}
42
+ s = hStep[:stepId]
43
+ unless s.nil?
44
+ attributes = { id: s.gsub(/[^0-9A-Za-z]/,'') }
45
+ end
46
+
47
+ @xml.tag!('mrl:LI_ProcessStep', attributes) do
48
+
49
+ # process step - description (required)
50
+ unless hStep[:description].nil?
51
+ @xml.tag!('mrl:description') do
52
+ @xml.tag!('gco:CharacterString', hStep[:description])
53
+ end
54
+ end
55
+ if hStep[:description].nil?
56
+ @NameSpace.issueWarning(260, 'mrl:description')
57
+ end
58
+
59
+ # process step - rationale
60
+ unless hStep[:rationale].nil?
61
+ @xml.tag!('mrl:rationale') do
62
+ @xml.tag!('gco:CharacterString', hStep[:rationale])
63
+ end
64
+ end
65
+ if hStep[:rationale].nil? && @hResponseObj[:writerShowTags]
66
+ @xml.tag!('mrl:rationale')
67
+ end
68
+
69
+ # process step - step datetime {TimePeriod}
70
+ # {TimeInstant} - not implemented
71
+ unless hStep[:timePeriod].empty?
72
+ @xml.tag!('mrl:stepDateTime') do
73
+ periodClass.writeXML(hStep[:timePeriod])
74
+ end
75
+ end
76
+ if hStep[:timePeriod].empty? && @hResponseObj[:writerShowTags]
77
+ @xml.tag!('mrl:stepDateTime')
78
+ end
79
+
80
+ # process step - processor [] {CI_Responsibility}
81
+ aProcessors = hStep[:processors]
82
+ aProcessors.each do |hProcessor|
83
+ @xml.tag!('mrl:processor') do
84
+ responsibilityClass.writeXML(hProcessor, outContext)
85
+ end
86
+ end
87
+ if aProcessors.empty? && @hResponseObj[:writerShowTags]
88
+ @xml.tag!('mrl:processor')
89
+ end
90
+
91
+ # process step - reference [] {CI_Citation}
92
+ aReferences = hStep[:references]
93
+ aReferences.each do |hCitation|
94
+ @xml.tag!('mrl:reference') do
95
+ citationClass.writeXML(hCitation, outContext)
96
+ end
97
+ end
98
+ if aReferences.empty? && @hResponseObj[:writerShowTags]
99
+ @xml.tag!('mrl:reference')
100
+ end
101
+
102
+ # process step - scope {MD_Scope}
103
+ unless hStep[:scope].empty?
104
+ @xml.tag!('mrl:scope') do
105
+ scopeClass.writeXML(hStep[:scope], outContext)
106
+ end
107
+ end
108
+ if hStep[:scope].empty? && @hResponseObj[:writerShowTags]
109
+ @xml.tag!('mrl:scope')
110
+ end
111
+
112
+ # process step - source [] {LI_Source}
113
+ aSources = hStep[:stepSources]
114
+ aSources.each do |hSource|
115
+ @xml.tag!('mrl:source') do
116
+ sourceClass.writeXML(hSource)
117
+ end
118
+ end
119
+ if aSources.empty? && @hResponseObj[:writerShowTags]
120
+ @xml.tag!('mrl:source')
121
+ end
122
+
123
+ end # mrl:LI_ProcessStep tag
124
+ end # writeXML
125
+ end # LI_ProcessStep class
126
+
127
+ end
128
+ end
129
+ end
130
+ end