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

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

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

revision 1860 by jan, Fri Oct 24 16:01:39 2003 UTC revision 1982 by bh, Thu Nov 27 15:25:34 2003 UTC
# Line 47  class Projection(BaseProjection): Line 47  class Projection(BaseProjection):
47          self.epsg = epsg          self.epsg = epsg
48          self.params = params          self.params = params
49    
50      def ForwardBBox(self, bbox):      def _transform_bbox(self, trafo, bbox):
         """Return the bounding box of the corners of the bounding box bbox  
         """  
51          # This is not really the correct way to determine the bbox of a          # This is not really the correct way to determine the bbox of a
52          # projected shape, but for now it works well enough          # projected bbox, but for now it works well enough
53          llx, lly, urx, ury = bbox          llx, lly, urx, ury = bbox
54          xs = []; ys = []          xs = []; ys = []
55          x, y = self.Forward(llx, lly)          for x, y in ((llx, lly), (llx, ury), (urx, lly), (urx, ury)):
56          xs.append(x); ys.append(y)              x, y = trafo(x, y)
57          x, y = self.Forward(llx, ury)              xs.append(x); ys.append(y)
         xs.append(x); ys.append(y)  
         x, y = self.Forward(urx, ury)  
         xs.append(x); ys.append(y)  
         x, y = self.Forward(urx, lly)  
         xs.append(x); ys.append(y)  
           
58          return min(xs), min(ys), max(xs), max(ys)          return min(xs), min(ys), max(xs), max(ys)
59    
60        def ForwardBBox(self, bbox):
61            """Return the bounding box of the corners of the bounding box bbox
62            """
63            return self._transform_bbox(self.Forward, bbox)
64    
65        def InverseBBox(self, bbox):
66            return self._transform_bbox(self.Inverse, bbox)
67    
68      def GetName(self):      def GetName(self):
69          """Return the name of the projection."""          """Return the name of the projection."""
70          return self.name          return self.name

Legend:
Removed from v.1860  
changed lines
  Added in v.1982

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26