17
18
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_geometryObject.rb', line 17
def self.unpack(hGeoObject, responseObj)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hGeoObject.empty?
@MessagePath.issueWarning(380, responseObj)
return nil
end
intMetadataClass = InternalMetadata.new
intGeoObject = intMetadataClass.newGeometryObject
if hGeoObject.has_key?('type')
unless hGeoObject['type'] == ''
type = hGeoObject['type']
if %w{ Point LineString Polygon MultiPoint MultiLineString MultiPolygon }.one? {|word| word == type}
intGeoObject[:type] = hGeoObject['type']
else
@MessagePath.issueError(381, responseObj)
end
end
end
if intGeoObject[:type].nil? || intGeoObject[:type] == ''
@MessagePath.issueError(382, responseObj)
end
if hGeoObject.has_key?('coordinates')
intGeoObject[:coordinates] = hGeoObject['coordinates']
end
if intGeoObject[:coordinates].empty?
@MessagePath.issueError(383, responseObj)
end
intGeoObject[:nativeGeoJson] = hGeoObject
return intGeoObject
end
|