7 |
|
|
8 |
__version__ = "$Revision$" |
__version__ = "$Revision$" |
9 |
|
|
10 |
|
import os |
11 |
from math import log, ceil |
from math import log, ceil |
12 |
|
|
13 |
import shapelib, shptree |
import shapelib, shptree |
84 |
"""Set the layer's visibility.""" |
"""Set the layer's visibility.""" |
85 |
self.visible = visible |
self.visible = visible |
86 |
self.issue(LAYER_VISIBILITY_CHANGED, self) |
self.issue(LAYER_VISIBILITY_CHANGED, self) |
87 |
|
|
88 |
|
|
89 |
class Layer(BaseLayer): |
class Layer(BaseLayer): |
90 |
|
|
91 |
"""Represent the information of one geodata file (currently a shapefile) |
"""Represent the information of one geodata file (currently a shapefile) |
120 |
colors are expected to be instances of Color class |
colors are expected to be instances of Color class |
121 |
""" |
""" |
122 |
BaseLayer.__init__(self, title, visible = visible) |
BaseLayer.__init__(self, title, visible = visible) |
123 |
self.filename = filename |
|
124 |
|
# Make the filename absolute. The filename will be |
125 |
|
# interpreted relative to that anyway, but when saving a |
126 |
|
# session we need to compare absolute paths and it's usually |
127 |
|
# safer to always work with absolute paths. |
128 |
|
self.filename = os.path.abspath(filename) |
129 |
|
|
130 |
self.projection = projection |
self.projection = projection |
131 |
self.fill = fill |
self.fill = fill |
132 |
self.stroke = stroke |
self.stroke = stroke |
167 |
maxdepth) |
maxdepth) |
168 |
|
|
169 |
def Destroy(self): |
def Destroy(self): |
170 |
BaseLayer.Destroy() |
BaseLayer.Destroy(self) |
171 |
if self.shapefile is not None: |
if self.shapefile is not None: |
172 |
self.shapefile.close() |
self.shapefile.close() |
173 |
self.shapefile = None |
self.shapefile = None |