19 |
import table |
import table |
20 |
import transientdb |
import transientdb |
21 |
|
|
22 |
|
from Thuban import _ |
23 |
|
|
24 |
|
|
25 |
class ShapeTable(transientdb.AutoTransientTable): |
class ShapeTable(transientdb.AutoTransientTable): |
26 |
|
|
101 |
|
|
102 |
The arguments are a shapestore for the shapedata and a table for |
The arguments are a shapestore for the shapedata and a table for |
103 |
the tabular data. |
the tabular data. |
104 |
|
|
105 |
|
Raises ValueError if the number of shapes in the shapestore |
106 |
|
is different from the number of rows in the table. |
107 |
""" |
""" |
108 |
|
|
109 |
|
numShapes = shapestore.Shapefile().info()[0] |
110 |
|
if numShapes != table.NumRows(): |
111 |
|
raise ValueError(_("Table not compatible with shapestore.")) |
112 |
|
|
113 |
self.shapestore = shapestore |
self.shapestore = shapestore |
114 |
self.table = table |
self.table = table |
115 |
|
|
130 |
Return the original shapestore the derived store was instantiated with |
Return the original shapestore the derived store was instantiated with |
131 |
""" |
""" |
132 |
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 |
|