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
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
|
# File 'lib/adiwg/mdtranslator/readers/fgdc/modules/module_pointVector.rb', line 17
def self.unpack(xPtVec, hResourceInfo, hResponseObj)
intMetadataClass = InternalMetadata.new
axSDTSterm = xPtVec.xpath('./sdtsterm')
unless axSDTSterm.empty?
hVectorInfo = intMetadataClass.newVectorInfo
axSDTSterm.each do |xTerm|
hVectorObj = intMetadataClass.newVectorObject
sdtsType = xTerm.xpath('./sdtstype').text
unless sdtsType.empty?
hVectorObj[:objectType] = sdtsType
end
if sdtsType.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: spatial data SDTS object type is missing'
end
ptvCount = xTerm.xpath('./ptvctcnt').text
unless ptvCount.empty?
hVectorObj[:objectCount] = ptvCount.to_i
end
hVectorInfo[:vectorObject] << hVectorObj
end
hSpatialRepresentation = intMetadataClass.newSpatialRepresentation
hSpatialRepresentation[:vectorRepresentation] = hVectorInfo
hResourceInfo[:spatialRepresentations] << hSpatialRepresentation
end
xVPFterm = xPtVec.xpath('./vpfterm')
unless xVPFterm.empty?
hVectorInfo = intMetadataClass.newVectorInfo
level = xVPFterm.xpath('vpflevel').text
unless level.empty?
hVectorInfo[:topologyLevel] = level.to_i
end
if level.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: spatial data VPF topology level is missing'
end
axVPFInfo = xVPFterm.xpath('./vpfinfo')
unless axVPFInfo.empty?
axVPFInfo.each do |xInfo|
hVectorObj = intMetadataClass.newVectorObject
vpfType = xInfo.xpath('./vpftype').text
unless vpfType.empty?
hVectorObj[:objectType] = vpfType
end
if vpfType.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: spatial data VPF object type is missing'
end
vpfCount = xInfo.xpath('./ptvctcnt').text
unless vpfCount.empty?
hVectorObj[:objectCount] = vpfCount.to_i
end
hVectorInfo[:vectorObject] << hVectorObj
end
hSpatialRepresentation = intMetadataClass.newSpatialRepresentation
hSpatialRepresentation[:vectorRepresentation] = hVectorInfo
hResourceInfo[:spatialRepresentations] << hSpatialRepresentation
end
if axVPFInfo.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: spatial data VPF object information is missing'
end
end
if axSDTSterm.empty? && xVPFterm.empty?
hResponseObj[:readerExecutionMessages] << 'WARNING: FGDC reader: spatial data point-vector terms are missing'
end
return hResourceInfo
end
|