/[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 1513 by bh, Tue Jul 29 14:56:48 2003 UTC
# Line 19  import shapelib Line 19  import shapelib
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    
# Line 82  class ShapefileStore: Line 84  class ShapefileStore:
84          """          """
85          return ()          return ()
86    
87        def OrigShapeStore(self):
88            """Return None.
89    
90            The ShapefileStore was not derived from another shapestore.
91            """
92            return None
93    
94    
95  class DerivedShapeStore:  class DerivedShapeStore:
96    
# Line 92  class DerivedShapeStore: Line 101  class DerivedShapeStore:
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    
# Line 101  class DerivedShapeStore: Line 118  class DerivedShapeStore:
118          return self.table          return self.table
119    
120      def Shapefile(self):      def Shapefile(self):
121          """Return the shapefile of he underlying shapestore"""          """Return the shapefile of the underlying shapestore"""
122          return self.shapestore.Shapefile()          return self.shapestore.Shapefile()
123    
124      def Dependencies(self):      def Dependencies(self):
125          """Return a tuple containing the shapestore and the table"""          """Return a tuple containing the shapestore and the table"""
126          return (self.shapestore, self.table)          return (self.shapestore, self.table)
127    
128        def OrigShapeStore(self):
129  class SimpleStore:          """
130            Return the original shapestore the derived store was instantiated with
131      """Combine a shapefile and a table object"""          """
132            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.1513

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26