20
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
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_geoJson.rb', line 20
def self.unpack(hGeoJson, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hGeoJson.empty?
@MessagePath.issueWarning(340, responseObj, inContext)
return nil
end
intGeoEle = {}
if hGeoJson.has_key?('type')
if hGeoJson['type'] != ''
type = hGeoJson['type']
if %w{ Point LineString Polygon MultiPoint MultiLineString MultiPolygon }.one? {|word| word == type}
hReturn = GeometryObject.unpack(hGeoJson, responseObj)
unless hReturn.nil?
intGeoEle = hReturn
end
end
if type == 'GeometryCollection'
hReturn = GeometryCollection.unpack(hGeoJson, responseObj)
unless hReturn.nil?
intGeoEle = hReturn
end
end
if type == 'Feature'
hReturn = GeometryFeature.unpack(hGeoJson, responseObj)
unless hReturn.nil?
intGeoEle = hReturn
end
end
if type == 'FeatureCollection'
hReturn = FeatureCollection.unpack(hGeoJson, responseObj)
unless hReturn.nil?
intGeoEle = hReturn
end
end
if intGeoEle.empty?
@MessagePath.issueError(341, responseObj, inContext)
end
end
end
return intGeoEle
end
|