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
119
120
121
122
123
124
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_geodetic.rb', line 18
def self.unpack(hGeodetic, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hGeodetic.empty?
@MessagePath.issueWarning(310, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intGeodetic = intMetadataClass.newGeodetic
outContext = 'geodetic parameters'
outContext = inContext + ' > ' + outContext unless inContext.nil?
if hGeodetic.has_key?('datumIdentifier')
unless hGeodetic['datumIdentifier'].empty?
hReturn = Identifier.unpack(hGeodetic['datumIdentifier'], responseObj, outContext)
unless hReturn.nil?
intGeodetic[:datumIdentifier] = hReturn
end
end
end
if hGeodetic.has_key?('datumName')
unless hGeodetic['datumName'] == ''
@MessagePath.issueWarning(311, responseObj, inContext)
if intGeodetic[:datumIdentifier].empty?
intGeodetic[:datumIdentifier] = intMetadataClass.newIdentifier
intGeodetic[:datumIdentifier][:identifier] = hGeodetic['datumName']
@MessagePath.issueNotice(313, responseObj, inContext)
@MessagePath.issueNotice(315, responseObj, inContext)
end
end
end
if hGeodetic.has_key?('ellipsoidIdentifier')
unless hGeodetic['ellipsoidIdentifier'].empty?
hReturn = Identifier.unpack(hGeodetic['ellipsoidIdentifier'], responseObj, outContext)
unless hReturn.nil?
intGeodetic[:ellipsoidIdentifier] = hReturn
end
end
end
if hGeodetic.has_key?('ellipsoidName')
unless hGeodetic['ellipsoidName'] == ''
@MessagePath.issueWarning(312, responseObj, inContext)
if intGeodetic[:ellipsoidIdentifier].empty?
intGeodetic[:ellipsoidIdentifier] = intMetadataClass.newIdentifier
intGeodetic[:ellipsoidIdentifier][:identifier] = hGeodetic['ellipsoidName']
@MessagePath.issueNotice(314, responseObj, inContext)
@MessagePath.issueNotice(316, responseObj, inContext)
end
end
end
haveOthers = 0
if hGeodetic.has_key?('semiMajorAxis')
unless hGeodetic['semiMajorAxis'] == ''
intGeodetic[:semiMajorAxis] = hGeodetic['semiMajorAxis']
haveOthers += 1
end
end
if hGeodetic.has_key?('axisUnits')
unless hGeodetic['axisUnits'] == ''
intGeodetic[:axisUnits] = hGeodetic['axisUnits']
haveOthers += 1
end
end
if hGeodetic.has_key?('denominatorOfFlatteningRatio')
unless hGeodetic['denominatorOfFlatteningRatio'] == ''
intGeodetic[:denominatorOfFlatteningRatio] = hGeodetic['denominatorOfFlatteningRatio']
haveOthers += 1
end
end
if intGeodetic[:ellipsoidIdentifier].empty?
unless haveOthers == 0
@MessagePath.issueError(317, responseObj, inContext)
end
else
unless haveOthers == 0 || haveOthers == 3
@MessagePath.issueError(317, responseObj, inContext)
end
end
return intGeodetic
end
|