21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_geographicExtent.rb', line 21
def self.unpack(hGeoExt, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hGeoExt.empty?
@MessagePath.issueWarning(320, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intGeoExt = intMetadataClass.newGeographicExtent
outContext = 'geographic extent'
outContext = inContext + ' > ' + outContext unless inContext.nil?
haveGExtent = false
if hGeoExt.has_key?('description')
if hGeoExt['description'] != ''
intGeoExt[:description] = hGeoExt['description']
haveGExtent = true
end
end
if hGeoExt.has_key?('containsData')
if hGeoExt['containsData'] === false
intGeoExt[:containsData] = hGeoExt['containsData']
end
end
if hGeoExt.has_key?('identifier')
unless hGeoExt['identifier'].empty?
hReturn = Identifier.unpack(hGeoExt['identifier'], responseObj, outContext)
unless hReturn.nil?
intGeoExt[:identifier] = hReturn
end
haveGExtent = true
end
end
if hGeoExt.has_key?('boundingBox')
unless hGeoExt['boundingBox'].empty?
hReturn = BoundingBox.unpack(hGeoExt['boundingBox'], responseObj, outContext)
unless hReturn.nil?
intGeoExt[:boundingBox] = hReturn
haveGExtent = true
end
end
end
if hGeoExt.has_key?('geographicElement')
hGeoExt['geographicElement'].each do |hElement|
hReturn = GeoJson.unpack(hElement, responseObj, outContext)
unless hReturn.nil?
intGeoExt[:geographicElements] << hReturn
haveGExtent = true
end
end
end
if hGeoExt.has_key?('geographicElement')
unless hGeoExt['geographicElement'].empty?
intGeoExt[:nativeGeoJson] = hGeoExt['geographicElement']
end
end
unless intGeoExt[:geographicElements].empty?
intGeoExt[:computedBbox] = AdiwgCoordinates.computeBbox(intGeoExt[:geographicElements])
end
unless haveGExtent
@MessagePath.issueError(321, responseObj, inContext)
end
return intGeoExt
end
|