183 |
self.layers[index]['bbox'][srs][corner] \ |
self.layers[index]['bbox'][srs][corner] \ |
184 |
= foo.attributes.get(corner).nodeValue |
= foo.attributes.get(corner).nodeValue |
185 |
|
|
|
# Check for integrity |
|
|
self.checkLayerSRS(index) |
|
|
|
|
186 |
# Traverse subsidiary layers |
# Traverse subsidiary layers |
187 |
sublayer = getElementsByName(top, 'Layer') |
sublayer = getElementsByName(top, 'Layer') |
188 |
for l in sublayer: |
for l in sublayer: |
189 |
self.peekLayers(l, index) |
self.peekLayers(l, index) |
190 |
|
|
191 |
|
|
|
def checkLayerSRS(self, index): |
|
|
""" |
|
|
Checks the integrity of the underlying XML data. |
|
|
|
|
|
This is done by comparing the <SRS> elements with the |
|
|
calculated list from the BoundingBox elements. |
|
|
|
|
|
index -- position in the layers array to check |
|
|
""" |
|
|
|
|
|
pivot = index |
|
|
calculated = [] |
|
|
while pivot != -1: |
|
|
if 'bbox' in self.layers[pivot]: |
|
|
for srs in self.layers[pivot]['bbox'].keys(): |
|
|
if srs not in calculated: |
|
|
calculated.append(srs) |
|
|
pivot = self.layers[pivot]['parent'] |
|
|
|
|
|
pivot = index |
|
|
specified = [] |
|
|
while pivot != -1: |
|
|
if 'srs' in self.layers[pivot]: |
|
|
for srs in self.layers[pivot]['srs']: |
|
|
if srs not in specified: |
|
|
specified.append(srs) |
|
|
pivot = self.layers[pivot]['parent'] |
|
|
|
|
|
equal = True |
|
|
# Check for same number of elements |
|
|
if len(calculated) != len(specified): |
|
|
equal = False |
|
|
|
|
|
# Loop through all elements for existance |
|
|
for elm in calculated: |
|
|
if elm not in specified: |
|
|
equal = False |
|
|
|
|
|
if not equal: |
|
|
if self.srs_discrepancies is None: |
|
|
self.srs_discrepancies = [] |
|
|
if 'name' in self.layers[index]: |
|
|
id = "name:%s" % self.layers[index]['name'] |
|
|
else: |
|
|
id = "title:%s" % self.layers[index]['title'] |
|
|
self.srs_discrepancies.append(id) |
|
|
|
|
|
|
|
192 |
def getTitle(self): |
def getTitle(self): |
193 |
""" |
""" |
194 |
Returns the main title of the WMS object. |
Returns the main title of the WMS object. |
334 |
- Layers may optionally add to the global SRS list, or to the |
- Layers may optionally add to the global SRS list, or to the |
335 |
list inherited from a parent layer. |
list inherited from a parent layer. |
336 |
|
|
337 |
|
- A server which has the ability to transform data to |
338 |
|
different SRSes may choose not to provide an explicit |
339 |
|
BoundingBox for every possible SRS available for each Layer. |
340 |
|
Thus the list of <SRS> elements are authoritative. |
341 |
|
|
342 |
This implementation returns the list of SRS for the given |
This implementation returns the list of SRS for the given |
343 |
layer, calculated by looking at BoundingBoxes defined in the |
layer, calculated by looking at BoundingBoxes defined in the |
344 |
named layer and all layers higher in the hierarchy up to the |
named layer and all layers higher in the hierarchy up to the |
354 |
|
|
355 |
result = [] |
result = [] |
356 |
while pivot != -1: |
while pivot != -1: |
357 |
if 'bbox' in self.layers[pivot]: |
if 'srs' in self.layers[pivot]: |
358 |
for srs in self.layers[pivot]['bbox'].keys(): |
for srs in self.layers[pivot]['srs']: |
359 |
if srs not in result: |
if srs not in result: |
360 |
result.append(srs) |
result.append(srs) |
361 |
pivot = self.layers[pivot]['parent'] |
pivot = self.layers[pivot]['parent'] |