1 |
# Copyright (c) 2001 by Intevation GmbH |
# Copyright (c) 2001, 2003 by Intevation GmbH |
2 |
# Authors: |
# Authors: |
3 |
# Bernhard Herzog <[email protected]> |
# Bernhard Herzog <[email protected]> |
4 |
# |
# |
62 |
def GetParameter(self, param): |
def GetParameter(self, param): |
63 |
"""Return the projection value for the given parameter. |
"""Return the projection value for the given parameter. |
64 |
|
|
65 |
If 'param' exists as a valid parameter then the returned |
If 'param' exists as a valid parameter return the associated |
66 |
value is a string with that value. If the parameter doesn't |
value as a string. If the parameter does not have a value (like |
67 |
exist an empty string is returned. |
e.g. the 'south' parameter for utm) then the value is the |
68 |
|
parameter name itself. |
69 |
|
|
70 |
|
If the parameter doesn't exist return an empty string. |
71 |
""" |
""" |
72 |
|
|
73 |
for pair in self.params: |
for pair in self.params: |
74 |
p, v = pair.split("=") |
if "=" in pair: |
75 |
|
p, v = pair.split("=") |
76 |
|
else: |
77 |
|
p = v = pair |
78 |
if p == param: |
if p == param: |
79 |
return v |
return v |
80 |
|
|
106 |
self.SetFilename(filename) |
self.SetFilename(filename) |
107 |
|
|
108 |
def Add(self, proj): |
def Add(self, proj): |
109 |
"""Add the given projection to the end of the file. If 'proj' |
"""Add the projection to the end of the file.""" |
110 |
already exists, it is replaced in the same location as the |
self.__projs.append(proj) |
|
original projection. |
|
|
""" |
|
|
|
|
|
try: |
|
|
# |
|
|
# see if the projection already exists. |
|
|
# this only works if Projection doesn't override __eq__ |
|
|
# |
|
|
self.__projs[self.__projs.index(proj)] = proj |
|
|
except ValueError: |
|
|
self.__projs.append(proj) |
|
111 |
|
|
112 |
def Remove(self, proj): |
def Remove(self, proj): |
113 |
"""Remove the object proj from the projection file. |
"""Remove the object proj from the projection file. |