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

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

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

revision 1664 by bh, Wed Aug 27 15:20:54 2003 UTC revision 1844 by bh, Tue Oct 21 10:49:44 2003 UTC
# Line 142  class SessionLoader(XMLReader): Line 142  class SessionLoader(XMLReader):
142          # all dispatchers should be used for the 0.8 and 0.9 namespaces too          # all dispatchers should be used for the 0.8 and 0.9 namespaces too
143          for xmlns in ("http://thuban.intevation.org/dtds/thuban-0.8.dtd",          for xmlns in ("http://thuban.intevation.org/dtds/thuban-0.8.dtd",
144                        "http://thuban.intevation.org/dtds/thuban-0.9-dev.dtd",                        "http://thuban.intevation.org/dtds/thuban-0.9-dev.dtd",
145                        "http://thuban.intevation.org/dtds/thuban-0.9.dtd"):                        "http://thuban.intevation.org/dtds/thuban-0.9.dtd",
146                          "http://thuban.intevation.org/dtds/thuban-1.0-dev.dtd"):
147              for key, value in dispatchers.items():              for key, value in dispatchers.items():
148                  dispatchers[(xmlns, key)] = value                  dispatchers[(xmlns, key)] = value
149    
# Line 199  class SessionLoader(XMLReader): Line 200  class SessionLoader(XMLReader):
200    
201             'ascii' -- The attribute is converted to a bytestring with             'ascii' -- The attribute is converted to a bytestring with
202                        ascii encoding.                        ascii encoding.
203    
204               a callable -- The attribute value is passed to the callable
205                             and the return value is used a as the converted
206                             value
207          """          """
208          normalized = {}          normalized = {}
209    
# Line 229  class SessionLoader(XMLReader): Line 234  class SessionLoader(XMLReader):
234                                                       value))                                                       value))
235              elif d.conversion == "ascii":              elif d.conversion == "ascii":
236                  value = value.encode("ascii")                  value = value.encode("ascii")
237              else:              elif d.conversion:
238                  if d.conversion:                  # Assume it's a callable
239                      raise ValueError("Unknown attribute conversion %r"                  value = d.conversion(value)
                                      % d.conversion)  
240    
241              normalized[d.name] = value              normalized[d.name] = value
242          return normalized          return normalized
# Line 364  class SessionLoader(XMLReader): Line 368  class SessionLoader(XMLReader):
368          self.aMap = None          self.aMap = None
369    
370      def start_projection(self, name, qname, attrs):      def start_projection(self, name, qname, attrs):
371          self.ProjectionName = self.encode(attrs.get((None, 'name'), None))          attrs = self.check_attrs(name, attrs,
372          self.ProjectionParams = [ ]                                   [AttrDesc("name", conversion=self.encode),
373                                      AttrDesc("epsg", default=None,
374                                               conversion=self.encode)])
375            self.projection_name = attrs["name"]
376            self.projection_epsg = attrs["epsg"]
377            self.projection_params = [ ]
378    
379      def end_projection(self, name, qname):      def end_projection(self, name, qname):
380          if self.aLayer is not None:          if self.aLayer is not None:
# Line 376  class SessionLoader(XMLReader): Line 385  class SessionLoader(XMLReader):
385              assert False, "projection tag out of context"              assert False, "projection tag out of context"
386              pass              pass
387    
388          obj.SetProjection(          obj.SetProjection(Projection(self.projection_params,
389              Projection(self.ProjectionParams, self.ProjectionName))                                       self.projection_name,
390                                         epsg = self.projection_epsg))
391    
392      def start_parameter(self, name, qname, attrs):      def start_parameter(self, name, qname, attrs):
393          s = attrs.get((None, 'value'))          s = attrs.get((None, 'value'))
394          s = str(s) # we can't handle unicode in proj          s = str(s) # we can't handle unicode in proj
395          self.ProjectionParams.append(s)          self.projection_params.append(s)
396    
397      def start_layer(self, name, qname, attrs, layer_class = Layer):      def start_layer(self, name, qname, attrs, layer_class = Layer):
398          """Start a layer          """Start a layer

Legend:
Removed from v.1664  
changed lines
  Added in v.1844

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26