15 |
|
|
16 |
"""A proj4 projection object that remembers the parameters""" |
"""A proj4 projection object that remembers the parameters""" |
17 |
|
|
18 |
def __init__(self, params): |
def __init__(self, params, name = "Unknown"): |
19 |
BaseProjection.__init__(self, params) |
BaseProjection.__init__(self, params) |
20 |
self.params = params |
self.params = params |
21 |
|
self.name = name |
22 |
|
|
23 |
def ForwardBBox(self, bbox): |
def ForwardBBox(self, bbox): |
24 |
"""Return the bounding box of the corners of the bounding box bbox |
"""Return the bounding box of the corners of the bounding box bbox |
36 |
x, y = self.Forward(urx, lly) |
x, y = self.Forward(urx, lly) |
37 |
xs.append(x); ys.append(y) |
xs.append(x); ys.append(y) |
38 |
return min(xs), min(ys), max(xs), max(ys) |
return min(xs), min(ys), max(xs), max(ys) |
39 |
|
|
40 |
|
def GetName(self): |
41 |
|
return self.name |
42 |
|
|
43 |
|
def GetParameters(self): |
44 |
|
return self.params |
45 |
|
|
46 |
|
def __repr__(self): |
47 |
|
return repr(self.params) |
48 |
|
|
49 |
|
class ProjFile: |
50 |
|
|
51 |
|
def __init__(self, filename): |
52 |
|
self.projs = [] |
53 |
|
|
54 |
|
self.SetFileName(filename) |
55 |
|
|
56 |
|
def Add(self, proj): |
57 |
|
self.projs.append(proj) |
58 |
|
|
59 |
|
def GetFileName(self): |
60 |
|
return self.filename |
61 |
|
|
62 |
|
def SetFileName(self, filename): |
63 |
|
self.filename = filename |
64 |
|
|
65 |
|
def GetProjections(self): |
66 |
|
return self.projs |