12 |
# $Id$ |
# $Id$ |
13 |
|
|
14 |
import os |
import os |
|
import warnings |
|
15 |
import weakref |
import weakref |
16 |
|
|
17 |
import shapelib |
import shapelib |
18 |
import table |
import table |
19 |
import transientdb |
import transientdb |
20 |
|
|
21 |
|
from Thuban import _ |
22 |
|
|
23 |
|
|
24 |
class ShapeTable(transientdb.AutoTransientTable): |
class ShapeTable(transientdb.AutoTransientTable): |
25 |
|
|
100 |
|
|
101 |
The arguments are a shapestore for the shapedata and a table for |
The arguments are a shapestore for the shapedata and a table for |
102 |
the tabular data. |
the tabular data. |
103 |
|
|
104 |
|
Raises ValueError if the number of shapes in the shapestore |
105 |
|
is different from the number of rows in the table. |
106 |
""" |
""" |
107 |
|
|
108 |
|
numShapes = shapestore.Shapefile().info()[0] |
109 |
|
if numShapes != table.NumRows(): |
110 |
|
raise ValueError(_("Table not compatible with shapestore.")) |
111 |
|
|
112 |
self.shapestore = shapestore |
self.shapestore = shapestore |
113 |
self.table = table |
self.table = table |
114 |
|
|
129 |
Return the original shapestore the derived store was instantiated with |
Return the original shapestore the derived store was instantiated with |
130 |
""" |
""" |
131 |
return self.shapestore |
return self.shapestore |
|
|
|
|
|
|
|
class SimpleStore: |
|
|
|
|
|
"""Combine a shapefile and a table object""" |
|
|
|
|
|
def __init__(self, shapefile, table): |
|
|
warnings.warn("The SimpleStore is deprecated." |
|
|
" Use DerivedShapeStore instead", |
|
|
DeprecationWarning, stacklevel = 2) |
|
|
self.shapefile = shapefile |
|
|
self.table = table |
|
|
self.filename = None |
|
|
|
|
|
def Table(self): |
|
|
return self.table |
|
|
|
|
|
def Shapefile(self): |
|
|
return self.shapefile |
|