/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/Model/data.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/Model/data.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 984 by bh, Thu May 22 16:37:48 2003 UTC revision 1515 by bh, Tue Jul 29 14:59:11 2003 UTC
# Line 12  __version__ = "$Revision$" Line 12  __version__ = "$Revision$"
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    
# Line 82  class ShapefileStore: Line 83  class ShapefileStore:
83          """          """
84          return ()          return ()
85    
86        def OrigShapeStore(self):
87            """Return None.
88    
89            The ShapefileStore was not derived from another shapestore.
90            """
91            return None
92    
93    
94  class DerivedShapeStore:  class DerivedShapeStore:
95    
# Line 92  class DerivedShapeStore: Line 100  class DerivedShapeStore:
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    
# Line 101  class DerivedShapeStore: Line 117  class DerivedShapeStore:
117          return self.table          return self.table
118    
119      def Shapefile(self):      def Shapefile(self):
120          """Return the shapefile of he underlying shapestore"""          """Return the shapefile of the underlying shapestore"""
121          return self.shapestore.Shapefile()          return self.shapestore.Shapefile()
122    
123      def Dependencies(self):      def Dependencies(self):
124          """Return a tuple containing the shapestore and the table"""          """Return a tuple containing the shapestore and the table"""
125          return (self.shapestore, self.table)          return (self.shapestore, self.table)
126    
127        def OrigShapeStore(self):
128  class SimpleStore:          """
129            Return the original shapestore the derived store was instantiated with
130      """Combine a shapefile and a table object"""          """
131            return self.shapestore
     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  

Legend:
Removed from v.984  
changed lines
  Added in v.1515

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26