/[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 2642 by bh, Fri Jul 1 20:49:04 2005 UTC revision 2688 by frank, Fri Jun 30 12:27:20 2006 UTC
# Line 33  from Thuban.Model.layer import Layer, Ra Line 33  from Thuban.Model.layer import Layer, Ra
33  from Thuban.Model.proj import Projection  from Thuban.Model.proj import Projection
34  from Thuban.Model.range import Range  from Thuban.Model.range import Range
35  from Thuban.Model.classification import Classification, \  from Thuban.Model.classification import Classification, \
36      ClassGroupDefault, ClassGroupSingleton, ClassGroupRange, ClassGroupMap, \      ClassGroupDefault, ClassGroupSingleton, ClassGroupRange, \
37        ClassGroupPattern, ClassGroupMap, \
38      ClassGroupProperties      ClassGroupProperties
39  from Thuban.Model.data import DerivedShapeStore, ShapefileStore  from Thuban.Model.data import DerivedShapeStore, ShapefileStore
40  from Thuban.Model.table import DBFTable  from Thuban.Model.table import DBFTable
# Line 136  class SessionLoader(XMLReader): Line 137  class SessionLoader(XMLReader):
137              'clnull'        : ("start_clnull",         "end_clnull"),              'clnull'        : ("start_clnull",         "end_clnull"),
138              'clpoint'       : ("start_clpoint",        "end_clpoint"),              'clpoint'       : ("start_clpoint",        "end_clpoint"),
139              'clrange'       : ("start_clrange",        "end_clrange"),              'clrange'       : ("start_clrange",        "end_clrange"),
140                'clpattern'     : ("start_clpattern",      "end_clpattern"),
141              'cldata'        : ("start_cldata",         "end_cldata"),              'cldata'        : ("start_cldata",         "end_cldata"),
142              'table'         : ("start_table",          "end_table"),              'table'         : ("start_table",          "end_table"),
143              'labellayer'    : ("start_labellayer",     None),              'labellayer'    : ("start_labellayer",     None),
# Line 525  class SessionLoader(XMLReader): Line 527  class SessionLoader(XMLReader):
527          self.aLayer = None          self.aLayer = None
528    
529      def start_classification(self, name, qname, attrs):      def start_classification(self, name, qname, attrs):
530            # field and field_type are optional because the classification
531            # can also be empty, ie. have only a default.
532          attrs = self.check_attrs(name, attrs,          attrs = self.check_attrs(name, attrs,
533                                   [AttrDesc("field", True),                                   [AttrDesc("field", False),
534                                    AttrDesc("field_type", True)])                                    AttrDesc("field_type", False)])
535    
536          field = attrs["field"]          field = attrs["field"]
537          fieldType = attrs["field_type"]          fieldType = attrs["field_type"]
538    
539            if field == "": return # no need to set classification column.
540    
541          dbFieldType = self.aLayer.GetFieldType(field)          dbFieldType = self.aLayer.GetFieldType(field)
542    
543          if fieldType != dbFieldType:          if fieldType != dbFieldType:
# Line 610  class SessionLoader(XMLReader): Line 617  class SessionLoader(XMLReader):
617          self.aLayer.GetClassification().AppendGroup(self.cl_group)          self.aLayer.GetClassification().AppendGroup(self.cl_group)
618          del self.cl_group, self.cl_prop          del self.cl_group, self.cl_prop
619    
620    
621        def start_clpattern(self, name, qname, attrs):
622            pattern = attrs.get((None, 'pattern'), "")
623    
624            self.cl_group = ClassGroupPattern(self.encode(pattern))
625            self.cl_group.SetLabel(self.encode(attrs.get((None, 'label'), "")))
626            self.cl_prop = ClassGroupProperties()
627    
628        def end_clpattern(self, name, qname):
629            self.cl_group.SetProperties(self.cl_prop)
630            self.aLayer.GetClassification().AppendGroup(self.cl_group)
631            del self.cl_group, self.cl_prop
632    
633    
634      def start_cldata(self, name, qname, attrs):      def start_cldata(self, name, qname, attrs):
635          self.cl_prop.SetLineColor(          self.cl_prop.SetLineColor(
636              parse_color(attrs.get((None, 'stroke'), "None")))              parse_color(attrs.get((None, 'stroke'), "None")))

Legend:
Removed from v.2642  
changed lines
  Added in v.2688

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26