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
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryFeature.rb', line 21
def self.unpack(hFeature, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hFeature.empty?
@MessagePath.issueWarning(370, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intFeature = intMetadataClass.newGeometryFeature
if hFeature.has_key?('type')
unless hFeature['type'] == ''
if hFeature['type'] == 'Feature'
intFeature[:type] = hFeature['type']
else
@MessagePath.issueError(371, responseObj)
end
end
end
if intFeature[:type].nil? || intFeature[:type] == ''
@MessagePath.issueError(372, responseObj)
end
if hFeature.has_key?('id')
unless hFeature['id'] == ''
intFeature[:id] = hFeature['id']
end
end
if hFeature.has_key?('bbox')
unless hFeature['bbox'].empty?
intFeature[:bbox] = hFeature['bbox']
end
end
if hFeature.has_key?('geometry')
unless hFeature['geometry'].empty?
hGeometry = hFeature['geometry']
if hGeometry['type'] == 'GeometryCollection'
hReturn = GeometryCollection.unpack(hGeometry, responseObj)
else
hReturn = GeometryObject.unpack(hGeometry, responseObj)
end
unless hReturn.nil?
intFeature[:geometryObject] = hReturn
end
end
else
@MessagePath.issueError(373, responseObj)
end
if hFeature.has_key?('properties')
hObject = hFeature['properties']
unless hObject.empty?
hReturn = GeometryProperties.unpack(hObject, responseObj)
unless hReturn.nil?
intFeature[:properties] = hReturn
end
end
end
unless intFeature[:geometryObject].empty?
intFeature[:computedBbox] = AdiwgCoordinates.computeBbox([intFeature[:geometryObject]])
end
intFeature[:nativeGeoJson] = hFeature
return intFeature
end
|