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. |