109 |
def __init__(self, title, filename, projection = None, |
def __init__(self, title, filename, projection = None, |
110 |
fill = Color.None, |
fill = Color.None, |
111 |
stroke = Color.Black, |
stroke = Color.Black, |
112 |
stroke_width = 1, |
lineWidth = 1, |
113 |
visible = 1): |
visible = 1): |
114 |
"""Initialize the layer. |
"""Initialize the layer. |
115 |
|
|
118 |
projection -- the projection object. Its Inverse method is |
projection -- the projection object. Its Inverse method is |
119 |
assumed to map the layer's coordinates to lat/long |
assumed to map the layer's coordinates to lat/long |
120 |
coordinates |
coordinates |
121 |
fill -- the fill color or None if the shapes are not filled |
fill -- the fill color or Color.None if the shapes are not filled |
122 |
stroke -- the stroke color or None if the shapes are not stroked |
stroke -- the stroke color or Color.None if the shapes are not stroked |
123 |
visible -- boolean. If true the layer is visible. |
visible -- boolean. If true the layer is visible. |
124 |
|
|
125 |
colors are expected to be instances of Color class |
colors are expected to be instances of Color class |
143 |
self.table = self.shapetable |
self.table = self.shapetable |
144 |
|
|
145 |
self.__classification = classification.Classification(self) |
self.__classification = classification.Classification(self) |
146 |
self.__classification.SetDefaultStroke(stroke) |
self.__classification.SetDefaultLineColor(stroke) |
147 |
self.__classification.SetDefaultStrokeWidth(stroke_width) |
self.__classification.SetDefaultLineWidth(lineWidth) |
148 |
self.__classification.SetDefaultFill(fill) |
self.__classification.SetDefaultFill(fill) |
149 |
|
|
150 |
self.UnsetModified() |
self.UnsetModified() |
208 |
else: |
else: |
209 |
return None |
return None |
210 |
|
|
211 |
|
def GetFieldType(self, fieldName): |
212 |
|
self.open_shapefile() |
213 |
|
info = self.table.field_info_by_name(fieldName) |
214 |
|
if info is not None: |
215 |
|
return info[0] |
216 |
|
else: |
217 |
|
return None |
218 |
|
|
219 |
def NumShapes(self): |
def NumShapes(self): |
220 |
"""Return the number of shapes in the layer""" |
"""Return the number of shapes in the layer""" |
221 |
self.open_shapefile() |
self.open_shapefile() |