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
|
# File 'lib/adiwg/mdtranslator/readers/mdJson/modules/module_verticalDatum.rb', line 18
def self.unpack(hDatum, responseObj, inContext = nil)
@MessagePath = ADIWG::Mdtranslator::Readers::MdJson::MdJson
if hDatum.empty?
@MessagePath.issueWarning(920, responseObj, inContext)
return nil
end
intMetadataClass = InternalMetadata.new
intDatum = intMetadataClass.newVerticalDatum
outContext = 'vertical datum'
outContext = inContext + ' > ' + outContext unless inContext.nil?
if hDatum.has_key?('datumIdentifier')
unless hDatum['datumIdentifier'].empty?
hReturn = Identifier.unpack(hDatum['datumIdentifier'], responseObj, outContext)
unless hReturn.nil?
intDatum[:datumIdentifier] = hReturn
end
end
end
if intDatum[:datumIdentifier].empty?
@MessagePath.issueError(921, responseObj, inContext)
end
if hDatum.has_key?('datumName')
unless hDatum['datumName'] == ''
@MessagePath.issueWarning(922, responseObj, inContext)
if intDatum[:datumIdentifier].empty?
intDatum[:datumIdentifier] = intMetadataClass.newIdentifier
intDatum[:datumIdentifier][:identifier] = hDatum['datumName']
@MessagePath.issueNotice(925, responseObj, inContext)
@MessagePath.issueNotice(923, responseObj, inContext)
end
end
end
haveOthers = 0
if hDatum.has_key?('encodingMethod')
unless hDatum['encodingMethod'] == ''
intDatum[:encodingMethod] = hDatum['encodingMethod']
haveOthers += 1
end
end
if hDatum.has_key?('isDepthSystem')
if hDatum['isDepthSystem'] === true
intDatum[:isDepthSystem] = true
end
end
if hDatum.has_key?('verticalResolution')
unless hDatum['verticalResolution'] == ''
intDatum[:verticalResolution] = hDatum['verticalResolution']
haveOthers += 1
end
end
if hDatum.has_key?('unitOfMeasure')
unless hDatum['unitOfMeasure'] == ''
intDatum[:unitOfMeasure] = hDatum['unitOfMeasure']
haveOthers += 1
end
end
unless haveOthers == 0 || haveOthers == 3
@MessagePath.issueError(924, responseObj, inContext)
end
return intDatum
end
|