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
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
108
109
110
111
112
113
114
115
116
117
118
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_georectifiedRepresentation.rb', line 18
def self.unpack(hGeoRec, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hGeoRec.empty?
@MessagePath.issueWarning(400, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intGeoRec = intMetadataClass.newGeorectifiedInfo
outContext = 'georectified representation'
outContext = inContext + ' > ' + outContext unless inContext.nil?
if hGeoRec.has_key?('gridRepresentation')
hObject = hGeoRec['gridRepresentation']
unless hObject.empty?
hReturn = GridRepresentation.unpack(hObject, responseObj, outContext)
unless hReturn.nil?
intGeoRec[:gridRepresentation] = hReturn
end
end
end
if intGeoRec[:gridRepresentation].empty?
@MessagePath.issueError(401, responseObj, inContext)
end
if hGeoRec.has_key?('checkPointAvailable')
if hGeoRec['checkPointAvailable'] === true
intGeoRec[:checkPointAvailable] = hGeoRec['checkPointAvailable']
end
end
if hGeoRec.has_key?('checkPointDescription')
if hGeoRec['checkPointDescription'] != ''
intGeoRec[:checkPointDescription] = hGeoRec['checkPointDescription']
end
end
if hGeoRec.has_key?('cornerPoints')
unless hGeoRec['cornerPoints'].empty?
intGeoRec[:cornerPoints] = hGeoRec['cornerPoints']
end
end
unless intGeoRec[:cornerPoints].length == 2 || intGeoRec[:cornerPoints].length == 4
@MessagePath.issueError(402, responseObj, inContext)
end
if hGeoRec.has_key?('centerPoint')
unless hGeoRec['centerPoint'].empty?
intGeoRec[:centerPoint] = hGeoRec['centerPoint']
end
unless intGeoRec[:centerPoint].length == 2
@MessagePath.issueError(403, responseObj, inContext)
end
end
if hGeoRec.has_key?('pointInPixel')
if hGeoRec['pointInPixel'] != ''
intGeoRec[:pointInPixel] = hGeoRec['pointInPixel']
end
end
if intGeoRec[:pointInPixel].nil?
@MessagePath.issueError(404, responseObj, inContext)
end
if hGeoRec.has_key?('transformationDimensionDescription')
if hGeoRec['transformationDimensionDescription'] != ''
intGeoRec[:transformationDimensionDescription] = hGeoRec['transformationDimensionDescription']
end
end
if hGeoRec.has_key?('transformationDimensionMapping')
if hGeoRec['transformationDimensionMapping'] != ''
intGeoRec[:transformationDimensionMapping] = hGeoRec['transformationDimensionMapping']
end
end
if hGeoRec.has_key?('scope')
hGeoRec['scope'].each do |item|
scope = Scope.unpack(item, responseObj, inContext)
unless scope.nil?
intGeoRec[:scope] << scope
end
end
end
return intGeoRec
end
|