/[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 874 by jonathan, Fri May 9 16:31:12 2003 UTC revision 930 by jonathan, Tue May 20 15:23:03 2003 UTC
# Line 26  from Thuban.Model.table import FIELDTYPE Line 26  from Thuban.Model.table import FIELDTYPE
26    
27  from Thuban.Model.session import Session  from Thuban.Model.session import Session
28  from Thuban.Model.map import Map  from Thuban.Model.map import Map
29  from Thuban.Model.layer import Layer  from Thuban.Model.layer import Layer, RasterLayer
30  from Thuban.Model.color import Color  from Thuban.Model.color import Color
31  from Thuban.Model.proj import Projection  from Thuban.Model.proj import Projection
32  from Thuban.Model.range import Range  from Thuban.Model.range import Range
# Line 192  class SessionLoader(XMLReader): Line 192  class SessionLoader(XMLReader):
192               'projection'    : ("start_projection",     "end_projection"),               'projection'    : ("start_projection",     "end_projection"),
193               'parameter'     : ("start_parameter",      None),               'parameter'     : ("start_parameter",      None),
194               'layer'         : ("start_layer",          "end_layer"),               'layer'         : ("start_layer",          "end_layer"),
195                 'rasterlayer'   : ("start_rasterlayer",    "end_rasterlayer"),
196               'classification': ("start_classification", "end_classification"),               'classification': ("start_classification", "end_classification"),
197               'clnull'        : ("start_clnull",         "end_clnull"),               'clnull'        : ("start_clnull",         "end_clnull"),
198               'clpoint'       : ("start_clpoint",        "end_clpoint"),               'clpoint'       : ("start_clpoint",        "end_clpoint"),
# Line 246  class SessionLoader(XMLReader): Line 247  class SessionLoader(XMLReader):
247          title = self.encode(attrs.get((None, 'title'), ""))          title = self.encode(attrs.get((None, 'title'), ""))
248          filename = attrs.get((None, 'filename'), "")          filename = attrs.get((None, 'filename'), "")
249          filename = os.path.join(self.GetDirectory(), filename)          filename = os.path.join(self.GetDirectory(), filename)
250          visible  = attrs.get((None, 'visible'), "true")          filename = self.encode(filename)
251            visible  = self.encode(attrs.get((None, 'visible'), "true")) != "false"
252          fill = parse_color(attrs.get((None, 'fill'), "None"))          fill = parse_color(attrs.get((None, 'fill'), "None"))
253          stroke = parse_color(attrs.get((None, 'stroke'), "#000000"))          stroke = parse_color(attrs.get((None, 'stroke'), "#000000"))
254          stroke_width = int(attrs.get((None, 'stroke_width'), "1"))          stroke_width = int(attrs.get((None, 'stroke_width'), "1"))
# Line 254  class SessionLoader(XMLReader): Line 256  class SessionLoader(XMLReader):
256                                    self.theSession.OpenShapefile(filename),                                    self.theSession.OpenShapefile(filename),
257                                    fill = fill, stroke = stroke,                                    fill = fill, stroke = stroke,
258                                    lineWidth = stroke_width,                                    lineWidth = stroke_width,
259                                    visible = visible != "false")                                    visible = visible)
260    
261      def end_layer(self, name, qname):      def end_layer(self, name, qname):
262          self.aMap.AddLayer(self.aLayer)          self.aMap.AddLayer(self.aLayer)
263          self.aLayer = None          self.aLayer = None
264    
265        def start_rasterlayer(self, name, qname, attrs, layer_class = RasterLayer):
266            title = self.encode(attrs.get((None, 'title'), ""))
267            filename = attrs.get((None, 'filename'), "")
268            filename = os.path.join(self.GetDirectory(), filename)
269            filename = self.encode(filename)
270            visible  = self.encode(attrs.get((None, 'visible'), "true")) != "false"
271    
272            self.aLayer = layer_class(title, filename, visible = visible)
273    
274        def end_rasterlayer(self, name, qname):
275            self.aMap.AddLayer(self.aLayer)
276            self.aLayer = None
277    
278      def start_classification(self, name, qname, attrs):      def start_classification(self, name, qname, attrs):
279          field = attrs.get((None, 'field'), None)          field = attrs.get((None, 'field'), None)
280    

Legend:
Removed from v.874  
changed lines
  Added in v.930

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26