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

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

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

revision 1830 by bh, Thu Oct 16 16:36:00 2003 UTC revision 1933 by bh, Tue Nov 11 16:37:53 2003 UTC
# Line 92  def write_proj_file(pf): Line 92  def write_proj_file(pf):
92      saver.write(pf.GetFilename())      saver.write(pf.GetFilename())
93    
94    
95  def get_system_proj_file():  # Constants for the get_system_proj_file function
96      """Return the standard projections and a list with warnings  DEFAULT_PROJ_FILE = "defaults.proj"
97    EPSG_PROJ_FILE = "epsg.proj"
98    
99      The projections read from the default thuban projection file  def get_system_proj_file(filename):
100      (usually in Resources/Projections/defaults.proj). The return value      """Return the projections from the indicated file and a list with warnings
101      is a tuple with the projections in a ProjFile object and a list of  
102      strings with warning messages. The warnings list is usually empty      The filename argument should be the name of a file in the directory
103      but may contain messages about ignored errors.      with Thuban's default projection files (Resources/Projections/). If
104        possible callers should not use hardwired string literal for the
105        name to avoid unnecessary duplication. Instead they should use one
106        of the predefined constants, currently DEFAULT_PROJ_FILE or
107        EPSG_PROJ_FILE.
108    
109        The return value is a tuple with the projections in a ProjFile
110        object and a list of strings with warning messages. The warnings
111        list is usually empty but may contain messages about ignored errors.
112    
113      If the file could could not be opened return an empty projection      If the file could could not be opened return an empty projection
114      file object set to store data in the default file.      file object set to store data in the indicated default file.
115      """      """
116      filename = os.path.join(projdir, "defaults.proj")      fullname = os.path.join(projdir, filename)
117      try:      try:
118          return read_proj_file(filename)          return read_proj_file(fullname)
119      except (OSError, IOError, SAXParseException), val:      except (OSError, IOError, SAXParseException), val:
120          msg = _('Could not read "%s": %s') % (filename, str(val))          msg = _('Could not read "%s": %s') % (fullname, str(val))
121          return ProjFile(filename), [msg]          return ProjFile(fullname), [msg]
122    
123  def get_user_proj_file():  def get_user_proj_file():
124      """Return the user's projections and a list with warnings      """Return the user's projections and a list with warnings

Legend:
Removed from v.1830  
changed lines
  Added in v.1933

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26