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
|
# File 'lib/adiwg/mdtranslator/writers/fgdc/classes/class_source.rb', line 25
def writeXML(hSource, aSourceCollection)
unless hSource[:sourceId].nil?
return if aSourceCollection.include?(hSource[:sourceId])
aSourceCollection << hSource[:sourceId]
end
if hSource[:sourceId].nil?
@NameSpace.issueError(230)
end
@xml.tag!('srcinfo') do
citationClass = Citation.new(@xml, @hResponseObj)
timePeriodClass = TimePeriod.new(@xml, @hResponseObj)
unless hSource[:sourceCitation].empty?
@xml.tag!('srccite') do
citationClass.writeXML(hSource[:sourceCitation], [], 'lineage source')
end
end
if hSource[:sourceCitation].empty?
@NameSpace.issueWarning(231, nil, "source ID #{hSource[:sourceId]}")
end
haveResolution = false
unless hSource[:spatialResolution].empty?
unless hSource[:spatialResolution].nil?
haveResolution = true
@xml.tag!('srcscale', hSource[:spatialResolution][:scaleFactor].to_s)
end
end
if !haveResolution && @hResponseObj[:writerShowTags]
@xml.tag!('srcscale')
end
unless hSource[:description].nil?
@xml.tag!('typesrc', hSource[:description])
end
if hSource[:description].nil?
@NameSpace.issueWarning(232, 'typesrc', "source ID #{hSource[:sourceId]}")
end
haveTime = false
unless hSource[:scope].empty?
unless hSource[:scope][:extents].empty?
unless hSource[:scope][:extents][0][:temporalExtents].empty?
unless hSource[:scope][:extents][0][:temporalExtents][0][:timePeriod].empty?
haveTime = true
hTimePeriod = hSource[:scope][:extents][0][:temporalExtents][0][:timePeriod]
@xml.tag!('srctime') do
timePeriodClass.writeXML(hTimePeriod, 'srccurr')
end
end
end
end
end
unless haveTime
@NameSpace.issueWarning(233, nil, "source ID #{hSource[:sourceId]}")
end
unless hSource[:sourceId].nil?
@xml.tag!('srccitea', hSource[:sourceId])
end
if hSource[:sourceId].nil?
@NameSpace.issueWarning(234, 'srccitea', "source ID #{hSource[:sourceId]}")
end
unless hSource[:description].nil?
@xml.tag!('srccontr', hSource[:description])
end
if hSource[:description].nil?
@NameSpace.issueWarning(235, 'srccontr', "source ID #{hSource[:sourceId]}")
end
end
end
|