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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -1
- data/adiwg-mdtranslator.gemspec +1 -1
- data/lib/adiwg/mdtranslator/internal/internal_metadata_obj.rb +2 -0
- data/lib/adiwg/mdtranslator/readers/fgdc/fgdc_reader.rb +4 -0
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_entityAttribute.rb +1 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb +7 -12
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_resourceInfo.rb +12 -11
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_source.rb +15 -7
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_taxonomy.rb +1 -6
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_timePeriod.rb +15 -1
- data/lib/adiwg/mdtranslator/readers/mdJson/modules/module_transferOption.rb +1 -3
- data/lib/adiwg/mdtranslator/version.rb +5 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_citation.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_contact.rb +4 -2
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_geologicAge.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_identification.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_method.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomyKeywords.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/fgdc/classes/class_taxonomySystem.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19110/classes/class_fcFeatureCatalogue.rb +7 -7
- data/lib/adiwg/mdtranslator/writers/iso19110/iso19110_writer.rb +6 -5
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_address.rb +104 -104
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_aggregateInformation.rb +63 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/{class_attributeGroup.rb → class_attribute.rb} +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_baseUnit.rb +23 -23
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_boundingBox.rb +64 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_browseGraphic.rb +55 -51
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_citation.rb +24 -14
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_contact.rb +96 -91
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_conventionalUnit.rb +45 -45
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_coverageDescription.rb +104 -77
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_crs.rb +4 -4
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataIdentification.rb +23 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dataQuality.rb +57 -52
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_date.rb +49 -46
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_definitionUnit.rb +20 -20
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_derivedUnit.rb +32 -32
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_dimension.rb +56 -50
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distribution.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_distributor.rb +77 -74
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_enumerationList.rb +34 -34
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extension.rb +190 -186
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_extent.rb +66 -66
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_feature.rb +50 -45
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureCollection.rb +35 -35
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_featureProperties.rb +43 -43
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_format.rb +73 -69
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_fraction.rb +37 -33
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicElement.rb +59 -54
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geographicExtent.rb +58 -58
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometricObjects.rb +49 -46
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_geometryCollection.rb +68 -63
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georectified.rb +113 -110
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_georeferenceable.rb +78 -75
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gmlIdentifier.rb +17 -17
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_grid.rb +55 -52
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_gridRepresentation.rb +19 -19
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_hierarchy.rb +47 -47
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_image.rb +132 -132
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_keyword.rb +5 -2
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineString.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_lineage.rb +55 -55
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_locale.rb +51 -48
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_maintenance.rb +114 -105
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdBand.rb +111 -111
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_mdIdentifier.rb +9 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_measure.rb +58 -41
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_medium.rb +104 -104
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miBand.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_miMetadata.rb +51 -16
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiLine.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPoint.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_multiPolygon.rb +70 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_onlineResource.rb +79 -76
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_orderProcess.rb +67 -67
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_phone.rb +67 -67
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_point.rb +8 -8
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_polygon.rb +89 -89
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_processStep.rb +9 -3
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rangeDimension.rb +59 -54
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_referenceSystem.rb +1 -1
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_resolution.rb +47 -47
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_responsibleParty.rb +111 -105
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_rsIdentifier.rb +71 -65
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scope.rb +54 -50
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_scopeDescription.rb +45 -42
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_securityConstraints.rb +92 -89
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_series.rb +55 -55
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_source.rb +98 -91
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_spatialRepresentation.rb +42 -42
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicClassification.rb +63 -59
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomicSystem.rb +40 -40
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_taxonomy.rb +133 -130
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_temporalExtent.rb +49 -49
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timeInstant.rb +60 -60
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_timePeriod.rb +110 -108
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_transferOptions.rb +71 -69
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_unitsOfMeasure.rb +243 -243
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_usage.rb +98 -95
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_useConstraints.rb +38 -38
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vectorRepresentation.rb +48 -48
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_verticalExtent.rb +74 -70
- data/lib/adiwg/mdtranslator/writers/iso19115_2/classes/class_vouchers.rb +56 -53
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer.rb +61 -11
- data/lib/adiwg/mdtranslator/writers/iso19115_2/iso19115_2_writer_messages_eng.yml +109 -0
- data/lib/adiwg/mdtranslator/writers/iso19115_2/version.rb +3 -2
- data/lib/adiwg/mdtranslator_cli.rb +21 -4
- metadata +6 -5
@@ -2,85 +2,85 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
5
|
+
# Stan Smith 2016-12-07 refactored for mdTranslator/mdJson 2.0
|
6
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
7
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
8
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
9
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
10
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
11
11
|
# Stan Smith 2013-09-25 original script.
|
12
12
|
|
13
13
|
module ADIWG
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
module Mdtranslator
|
15
|
+
module Writers
|
16
|
+
module Iso19115_2
|
17
17
|
|
18
|
-
|
18
|
+
class MD_StandardOrderProcess
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
def initialize(xml, hResponseObj)
|
21
|
+
@xml = xml
|
22
|
+
@hResponseObj = hResponseObj
|
23
|
+
end
|
24
24
|
|
25
|
-
|
25
|
+
def writeXML(hOrder)
|
26
26
|
|
27
|
-
|
27
|
+
# classes used
|
28
28
|
|
29
|
-
|
29
|
+
@xml.tag!('gmd:MD_StandardOrderProcess') do
|
30
30
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
31
|
+
# order process - fees
|
32
|
+
s = hOrder[:fees]
|
33
|
+
unless s.nil?
|
34
|
+
@xml.tag!('gmd:fees') do
|
35
|
+
@xml.tag!('gco:CharacterString', s)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
39
|
+
@xml.tag!('gmd:fees')
|
40
|
+
end
|
41
41
|
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
42
|
+
# order process - plannedAvailableDateTime
|
43
|
+
hDateTime = hOrder[:plannedAvailability]
|
44
|
+
unless hDateTime.empty?
|
45
|
+
paDateTime = hDateTime[:dateTime]
|
46
|
+
paDateRes = hDateTime[:dateResolution]
|
47
|
+
@xml.tag!('gmd:plannedAvailableDateTime') do
|
48
|
+
dateTimeStr =
|
49
|
+
AdiwgDateTimeFun.stringDateTimeFromDateTime(paDateTime, paDateRes)
|
50
|
+
@xml.tag!('gco:DateTime', dateTimeStr)
|
51
|
+
end
|
52
|
+
end
|
53
|
+
if hDateTime.empty? && @hResponseObj[:writerShowTags]
|
54
|
+
@xml.tag!('gmd:plannedAvailableDateTime')
|
55
|
+
end
|
56
56
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
57
|
+
# order process - orderingInstructions
|
58
|
+
s = hOrder[:orderingInstructions]
|
59
|
+
unless s.nil?
|
60
|
+
@xml.tag!('gmd:orderingInstructions') do
|
61
|
+
@xml.tag!('gco:CharacterString', s)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
65
|
+
@xml.tag!('gmd:orderingInstructions')
|
66
|
+
end
|
67
67
|
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
68
|
+
# order process - turnaround
|
69
|
+
s = hOrder[:turnaround]
|
70
|
+
unless s.nil?
|
71
|
+
@xml.tag!('gmd:turnaround') do
|
72
|
+
@xml.tag!('gco:CharacterString', s)
|
73
|
+
end
|
74
|
+
end
|
75
|
+
if s.nil? && @hResponseObj[:writerShowTags]
|
76
|
+
@xml.tag!('gmd:turnaround')
|
77
|
+
end
|
78
78
|
|
79
|
-
|
80
|
-
|
81
|
-
|
79
|
+
end # gmd:MD_StandardOrderProcess tag
|
80
|
+
end # writeXML
|
81
|
+
end # MD_StandardOrderProcess class
|
82
82
|
|
83
|
-
|
84
|
-
|
85
|
-
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
86
86
|
end
|
@@ -2,82 +2,82 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
5
|
+
# Stan Smith 2016-11-17 refactored for mdTranslator/mdJson 2.0
|
6
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
7
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
8
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
9
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
10
|
+
# Stan Smith 2014-05-14 reorganized for JSON schema 0.4.0
|
11
11
|
# Stan Smith 2013-08-12 original script.
|
12
12
|
|
13
13
|
module ADIWG
|
14
|
-
|
15
|
-
|
16
|
-
|
14
|
+
module Mdtranslator
|
15
|
+
module Writers
|
16
|
+
module Iso19115_2
|
17
17
|
|
18
|
-
|
18
|
+
class CI_Telephone
|
19
19
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
20
|
+
def initialize(xml, hResponseObj)
|
21
|
+
@xml = xml
|
22
|
+
@hResponseObj = hResponseObj
|
23
|
+
end
|
24
24
|
|
25
|
-
|
25
|
+
def writeXML(aPhones)
|
26
26
|
|
27
|
-
|
28
|
-
|
27
|
+
# ISO requires phones to be grouped in order (voice, fax)
|
28
|
+
@xml.tag!('gmd:CI_Telephone') do
|
29
29
|
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
30
|
+
# voice phones
|
31
|
+
voiceCount = 0
|
32
|
+
aPhones.each do |hPhone|
|
33
|
+
if hPhone[:phoneServiceTypes].empty?
|
34
|
+
hPhone[:phoneServiceTypes] << 'voice'
|
35
|
+
end
|
36
|
+
if hPhone[:phoneServiceTypes].include?('voice')
|
37
|
+
pName = hPhone[:phoneName]
|
38
|
+
pNumber = hPhone[:phoneNumber]
|
39
|
+
if pName.nil?
|
40
|
+
s = pNumber
|
41
|
+
else
|
42
|
+
s = pName + ': ' + pNumber
|
43
|
+
end
|
44
|
+
@xml.tag!('gmd:voice') do
|
45
|
+
@xml.tag!('gco:CharacterString', s)
|
46
|
+
voiceCount += 1
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
if voiceCount == 0 && @hResponseObj[:writerShowTags]
|
51
|
+
@xml.tag!('gmd:voice')
|
52
|
+
end
|
53
53
|
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
54
|
+
# fax phones
|
55
|
+
faxCount = 0
|
56
|
+
aPhones.each do |hPhone|
|
57
|
+
if hPhone[:phoneServiceTypes].include?('fax') ||
|
58
|
+
hPhone[:phoneServiceTypes].include?('facsimile')
|
59
|
+
pName = hPhone[:phoneName]
|
60
|
+
pNumber = hPhone[:phoneNumber]
|
61
|
+
if pName.nil?
|
62
|
+
s = pNumber
|
63
|
+
else
|
64
|
+
s = pName + ': ' + pNumber
|
65
|
+
end
|
66
|
+
@xml.tag!('gmd:facsimile') do
|
67
|
+
@xml.tag!('gco:CharacterString', s)
|
68
|
+
faxCount += 1
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
if faxCount == 0 && @hResponseObj[:writerShowTags]
|
73
|
+
@xml.tag!('gmd:facsimile')
|
74
|
+
end
|
75
75
|
|
76
|
-
|
77
|
-
|
78
|
-
|
76
|
+
end # CI_Telephone tag
|
77
|
+
end # write XML
|
78
|
+
end # CI_Telephone class
|
79
79
|
|
80
|
-
|
81
|
-
|
82
|
-
|
80
|
+
end
|
81
|
+
end
|
82
|
+
end
|
83
83
|
end
|
@@ -2,14 +2,14 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
5
|
+
# Stan Smith 2016-12-05 refactored for mdTranslator/mdJson 2.0
|
6
|
+
# Stan Smith 2015-07-16 moved module_coordinates from mdJson reader to internal
|
7
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
8
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
9
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
10
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
11
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
12
|
+
# Stan Smith 2014-05-30 modified for version 0.5.0
|
13
13
|
# Stan Smith 2013-11-01 original script
|
14
14
|
|
15
15
|
require 'adiwg/mdtranslator/internal/module_coordinates'
|
@@ -2,102 +2,102 @@
|
|
2
2
|
# 19115-2 writer output in XML
|
3
3
|
|
4
4
|
# History:
|
5
|
-
#
|
6
|
-
#
|
7
|
-
#
|
8
|
-
#
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
#
|
5
|
+
# Stan Smith 2016-12-05 refactored for mdTranslator/mdJson 2.0
|
6
|
+
# Stan Smith 2015-07-16 moved module_coordinates from mdJson reader to internal
|
7
|
+
# Stan Smith 2015-07-14 refactored to eliminate namespace globals $WriterNS and $IsoNS
|
8
|
+
# Stan Smith 2015-07-14 refactored to make iso19110 independent of iso19115_2 classes
|
9
|
+
# Stan Smith 2015-06-22 replace global ($response) with passed in object (hResponseObj)
|
10
|
+
# Stan Smith 2014-12-12 refactored to handle namespacing readers and writers
|
11
|
+
# Stan Smith 2014-07-08 modify require statements to function in RubyGem structure
|
12
|
+
# Stan Smith 2014-05-30 modified for version 0.5.0
|
13
13
|
# Stan Smith 2013-11-18 original script.
|
14
14
|
|
15
15
|
require 'adiwg/mdtranslator/internal/module_coordinates'
|
16
16
|
require_relative 'class_featureProperties'
|
17
17
|
|
18
18
|
module ADIWG
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
19
|
+
module Mdtranslator
|
20
|
+
module Writers
|
21
|
+
module Iso19115_2
|
22
|
+
|
23
|
+
class Polygon
|
24
|
+
|
25
|
+
def initialize(xml, hResponseObj)
|
26
|
+
@xml = xml
|
27
|
+
@hResponseObj = hResponseObj
|
28
|
+
end
|
29
|
+
|
30
|
+
def writeXML(hGeoObject, hProperties, objId)
|
31
|
+
|
32
|
+
# classes used
|
33
|
+
geoPropClass = FeatureProperties.new(@xml, @hResponseObj)
|
34
|
+
|
35
|
+
# polygon attributes
|
36
|
+
attributes = {}
|
37
|
+
|
38
|
+
# polygon attributes - gml:id (required)
|
39
|
+
if objId.nil?
|
40
|
+
@hResponseObj[:writerMissingIdCount] = @hResponseObj[:writerMissingIdCount].succ
|
41
|
+
objId = 'polygon' + @hResponseObj[:writerMissingIdCount]
|
42
|
+
else
|
43
|
+
objId.gsub!(/[^0-9a-zA-Z]/, '')
|
44
|
+
end
|
45
|
+
attributes['gml:id'] = objId
|
46
|
+
|
47
|
+
# polygon attributes - srsDimension
|
48
|
+
s = AdiwgCoordinates.getDimension(hGeoObject[:coordinates])
|
49
|
+
if !s.nil?
|
50
|
+
attributes[:srsDimension] = s
|
51
|
+
end
|
52
|
+
|
53
|
+
# polygon attributes - srsName (GeoJSON is WGS84)
|
54
|
+
attributes[:srsName] = 'WGS84'
|
55
|
+
|
56
|
+
@xml.tag!('gml:Polygon', attributes) do
|
57
|
+
|
58
|
+
# polygon - properties for Feature
|
59
|
+
unless hProperties.empty?
|
60
|
+
geoPropClass.writeXML(hProperties)
|
61
|
+
end
|
62
|
+
if hProperties.empty? && @hResponseObj[:writerShowTags]
|
63
|
+
@xml.tag!('gml:description')
|
64
|
+
@xml.tag!('gml:identifier', {'codeSpace' => ''})
|
65
|
+
@xml.tag!('gml:name')
|
66
|
+
end
|
67
|
+
|
68
|
+
aPolygons = hGeoObject[:coordinates]
|
69
|
+
aExterior = aPolygons[0]
|
70
|
+
aInterior = aPolygons.drop(1)
|
71
|
+
|
72
|
+
# polygon - exterior ring (required)
|
73
|
+
unless aExterior.nil?
|
74
|
+
@xml.tag!('gml:exterior') do
|
75
|
+
@xml.tag!('gml:LinearRing') do
|
76
|
+
aExterior.each do |aCoord|
|
77
|
+
s = aCoord[0].to_s + ' ' + aCoord[1].to_s
|
78
|
+
@xml.tag!('gml:pos', s)
|
79
|
+
end
|
80
|
+
end
|
44
81
|
end
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
82
|
+
end
|
83
|
+
|
84
|
+
# polygon - interior rings
|
85
|
+
aInterior.each do |aRing|
|
86
|
+
@xml.tag!('gml:interior') do
|
87
|
+
@xml.tag!('gml:LinearRing') do
|
88
|
+
aRing.each do |aCoord|
|
89
|
+
s = aCoord[0].to_s + ' ' + aCoord[1].to_s
|
90
|
+
@xml.tag!('gml:pos', s)
|
91
|
+
end
|
92
|
+
end
|
51
93
|
end
|
94
|
+
end
|
95
|
+
|
96
|
+
end # gml:Polygon tag
|
97
|
+
end # writeXML
|
98
|
+
end # Polygon class
|
52
99
|
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
@xml.tag!('gml:Polygon', attributes) do
|
57
|
-
|
58
|
-
# polygon - properties for Feature
|
59
|
-
unless hProperties.empty?
|
60
|
-
geoPropClass.writeXML(hProperties)
|
61
|
-
end
|
62
|
-
if hProperties.empty? && @hResponseObj[:writerShowTags]
|
63
|
-
@xml.tag!('gml:description')
|
64
|
-
@xml.tag!('gml:identifier', {'codeSpace'=>''})
|
65
|
-
@xml.tag!('gml:name')
|
66
|
-
end
|
67
|
-
|
68
|
-
aPolygons = hGeoObject[:coordinates]
|
69
|
-
aExterior = aPolygons[0]
|
70
|
-
aInterior = aPolygons.drop(1)
|
71
|
-
|
72
|
-
# polygon - exterior ring (required)
|
73
|
-
unless aExterior.nil?
|
74
|
-
@xml.tag!('gml:exterior') do
|
75
|
-
@xml.tag!('gml:LinearRing') do
|
76
|
-
aExterior.each do |aCoord|
|
77
|
-
s = aCoord[0].to_s + ' ' + aCoord[1].to_s
|
78
|
-
@xml.tag!('gml:pos', s)
|
79
|
-
end
|
80
|
-
end
|
81
|
-
end
|
82
|
-
end
|
83
|
-
|
84
|
-
# polygon - interior rings
|
85
|
-
aInterior.each do |aRing|
|
86
|
-
@xml.tag!('gml:interior') do
|
87
|
-
@xml.tag!('gml:LinearRing') do
|
88
|
-
aRing.each do |aCoord|
|
89
|
-
s = aCoord[0].to_s + ' ' + aCoord[1].to_s
|
90
|
-
@xml.tag!('gml:pos', s)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
|
96
|
-
end # gml:Polygon tag
|
97
|
-
end # writeXML
|
98
|
-
end # Polygon class
|
99
|
-
|
100
|
-
end
|
101
|
-
end
|
102
|
-
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
103
103
|
end
|