1 |
bh |
6 |
# Copyright (c) 2001 by Intevation GmbH |
2 |
|
|
# Authors: |
3 |
|
|
# Bernhard Herzog <[email protected]> |
4 |
|
|
# |
5 |
|
|
# This program is free software under the GPL (>=v2) |
6 |
|
|
# Read the file COPYING coming with Thuban for details. |
7 |
|
|
|
8 |
|
|
__version__ = "$Revision$" |
9 |
|
|
|
10 |
|
|
import Projection |
11 |
|
|
BaseProjection = Projection.Projection |
12 |
|
|
del Projection |
13 |
|
|
|
14 |
|
|
class Projection(BaseProjection): |
15 |
|
|
|
16 |
|
|
"""A proj4 projection object that remembers the parameters""" |
17 |
|
|
|
18 |
|
|
def __init__(self, params): |
19 |
|
|
BaseProjection.__init__(self, params) |
20 |
|
|
self.params = params |
21 |
|
|
|
22 |
|
|
def ForwardBBox(self, bbox): |
23 |
|
|
"""Return the bounding box of the corners of the bounding box bbox |
24 |
|
|
""" |
25 |
|
|
# This is not really the correct way to determine the bbox of a |
26 |
|
|
# projected shape, but for now it works well enough |
27 |
|
|
llx, lly, urx, ury = bbox |
28 |
|
|
xs = []; ys = [] |
29 |
|
|
x, y = self.Forward(llx, lly) |
30 |
|
|
xs.append(x); ys.append(y) |
31 |
|
|
x, y = self.Forward(llx, ury) |
32 |
|
|
xs.append(x); ys.append(y) |
33 |
|
|
x, y = self.Forward(urx, ury) |
34 |
|
|
xs.append(x); ys.append(y) |
35 |
|
|
x, y = self.Forward(urx, lly) |
36 |
|
|
xs.append(x); ys.append(y) |
37 |
|
|
return min(xs), min(ys), max(xs), max(ys) |