/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/classgen.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/classgen.py

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

revision 978 by frank, Thu May 22 11:40:32 2003 UTC revision 1100 by jonathan, Fri May 30 06:28:21 2003 UTC
# Line 20  from Thuban.Model.range import Range Line 20  from Thuban.Model.range import Range
20    
21  import classifier, resource  import classifier, resource
22    
23  from Thuban.Model.classgen import ClassGenerator, \  from Thuban.Model.classgen import \
24        GenUniformDistribution, GenSingletonsFromList, GenQuantiles, \
25      CustomRamp, GreyRamp, RedRamp, GreenRamp, BlueRamp, GreenToRedRamp, \      CustomRamp, GreyRamp, RedRamp, GreenRamp, BlueRamp, GreenToRedRamp, \
26      HotToColdRamp      HotToColdRamp
27    
# Line 210  class ClassGenDialog(wxDialog): Line 211  class ClassGenDialog(wxDialog):
211                      and max is not None \                      and max is not None \
212                      and numGroups is not None:                      and numGroups is not None:
213    
214                      self.clazz = ClassGenerator().GenUniformDistribution(                      self.clazz = GenUniformDistribution(
215                                  min, max, numGroups, ramp,                                  min, max, numGroups, ramp,
216                                  self.type == FIELDTYPE_INT)                                  self.type == FIELDTYPE_INT)
217    
# Line 223  class ClassGenDialog(wxDialog): Line 224  class ClassGenDialog(wxDialog):
224                  if len(list) > 0 \                  if len(list) > 0 \
225                      and numGroups is not None:                      and numGroups is not None:
226    
227                      self.clazz = ClassGenerator().GenSingletonsFromList(                      self.clazz = GenSingletonsFromList(
228                                      list, numGroups, ramp)                                      list, numGroups, ramp)
229    
230                      self.parent._SetClassification(self.clazz)                      self.parent._SetClassification(self.clazz)
# Line 237  class ClassGenDialog(wxDialog): Line 238  class ClassGenDialog(wxDialog):
238                  delta = 1 / float(numGroups)                  delta = 1 / float(numGroups)
239                  percents = [delta * i for i in range(1, numGroups + 1)]                  percents = [delta * i for i in range(1, numGroups + 1)]
240                  adjusted, self.clazz = \                  adjusted, self.clazz = \
241                      ClassGenerator().GenQuantiles(_list, percents, ramp, _range)                      GenQuantiles(_list, percents, ramp, _range)
242    
243                  if adjusted:                  if adjusted:
244                      dlg = wxMessageDialog(self,                      dlg = wxMessageDialog(self,
# Line 506  class GenUniformPanel(wxPanel): Line 507  class GenUniformPanel(wxPanel):
507    
508          if self.layer.table is not None:          if self.layer.table is not None:
509              wxBeginBusyCursor()              wxBeginBusyCursor()
510              min, max = self.layer.table.ValueRange(self.fieldName)              try:
511              self.minCtrl.SetValue(str(min))                  min, max = self.layer.table.ValueRange(self.fieldName)
512              self.maxCtrl.SetValue(str(max))                  self.minCtrl.SetValue(str(min))
513              wxEndBusyCursor()                  self.maxCtrl.SetValue(str(max))
514                finally:
515                    wxEndBusyCursor()
516    
517      def __GetValidatedTypeEntry(self, win, value, type, badValue = None):      def __GetValidatedTypeEntry(self, win, value, type, badValue = None):
518    
# Line 832  class GenQuantilesPanel(wxPanel): Line 835  class GenQuantilesPanel(wxPanel):
835          _list = []          _list = []
836    
837          if self.layer.table is not None:          if self.layer.table is not None:
838              wxBeginBusyCursor()              try:
839                    wxBeginBusyCursor()
             #  
             # FIXME: Replace with a call to table when the method  
             # has been written to get all the values  
             #  
             table = self.layer.table  
             for i in range(table.NumRows()):  
                 _list.append(table.ReadValue(i, self.fieldName))  
840    
841              wxEndBusyCursor()                  #
842                    # FIXME: Replace with a call to table when the method
843                    # has been written to get all the values
844                    #
845                    table = self.layer.table
846                    for i in range(table.NumRows()):
847                        _list.append(table.ReadValue(i, self.fieldName))
848                finally:
849                    wxEndBusyCursor()
850    
851          return _list          return _list
852    
# Line 862  class GenQuantilesPanel(wxPanel): Line 866  class GenQuantilesPanel(wxPanel):
866    
867          if self.layer.table is not None:          if self.layer.table is not None:
868              wxBeginBusyCursor()              wxBeginBusyCursor()
869              min, max = self.layer.table.ValueRange(self.fieldName)              try:
870              self.text_range.SetValue("[" + str(min) + ";" + str(max) + "]")                  min, max = self.layer.table.ValueRange(self.fieldName)
871              wxEndBusyCursor()                  self.text_range.SetValue("[" + str(min) + ";" + str(max) + "]")
872                finally:
873                    wxEndBusyCursor()
874    
875  ID_CUSTOMRAMP_COPYSTART = 4001  ID_CUSTOMRAMP_COPYSTART = 4001
876  ID_CUSTOMRAMP_COPYEND = 4002  ID_CUSTOMRAMP_COPYEND = 4002

Legend:
Removed from v.978  
changed lines
  Added in v.1100

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26