/[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 780 by jonathan, Thu Apr 24 16:06:28 2003 UTC revision 781 by jonathan, Tue Apr 29 16:53:38 2003 UTC
# Line 23  import classifier Line 23  import classifier
23    
24  import resource  import resource
25    
 from Thuban.common import Str2Num  
   
26  ID_CLASSGEN_GEN = 4001  ID_CLASSGEN_GEN = 4001
27  ID_CLASSGEN_CLOSE = 4002  ID_CLASSGEN_CLOSE = 4002
28  ID_CLASSGEN_GENCOMBO = 4007  ID_CLASSGEN_GENCOMBO = 4007
# Line 482  class GenUniformPanel(wxPanel): Line 480  class GenUniformPanel(wxPanel):
480          return valid          return valid
481    
482      def __CalcStepping(self, min, max, ngroups):      def __CalcStepping(self, min, max, ngroups):
483          step = Str2Num(str((max - min) / float(ngroups)))          step = (max - min) / float(ngroups)
484          if self.fieldType == FIELDTYPE_INT:          if self.fieldType == FIELDTYPE_INT:
485              step = int(step)              step = int(step)
486    
# Line 823  class ClassGenerator: Line 821  class ClassGenerator:
821          clazz = Classification()          clazz = Classification()
822    
823          #step = int((max - min) / float(numGroups))          #step = int((max - min) / float(numGroups))
         step = int(Str2Num(str((max - min + 1) / float(numGroups))))  
824    
825          if numGroups > 0:          if numGroups > 0:
826    
827                step = int((max - min + 1) / float(numGroups))
828              cur_value = min              cur_value = min
829    
830              ramp.SetNumGroups(numGroups)              ramp.SetNumGroups(numGroups)
831    
832              for prop in ramp:              for prop in ramp:
833                  clazz.AppendGroup(                  clazz.AppendGroup(ClassGroupSingleton(cur_value), prop)
                     ClassGroupSingleton(  
                         Str2Num(str(cur_value)),  
                         prop))  
834                  cur_value += step                  cur_value += step
835    
836          return clazz          return clazz
# Line 855  class ClassGenerator: Line 851  class ClassGenerator:
851    
852          ramp.SetNumGroups(numGroups)          ramp.SetNumGroups(numGroups)
853    
854          step = Str2Num(str((max - min) / float(numGroups)))          step = (max - min) / float(numGroups)
855    
856          if intStep:          if intStep:
857              step = int(step)              step = int(step)
# Line 871  class ClassGenerator: Line 867  class ClassGenerator:
867    
868              # this check guards against rounding issues              # this check guards against rounding issues
869              if cur_min != cur_max:              if cur_min != cur_max:
870                  clazz.AppendGroup(                  clazz.AppendGroup(ClassGroupRange(cur_min, cur_max, prop))
                     ClassGroupRange(  
                         Str2Num(str(cur_min)),  
                         Str2Num(str(cur_max)),  
                         prop))  
871    
872              cur_min = cur_max              cur_min = cur_max
873              cur_max += step              cur_max += step

Legend:
Removed from v.780  
changed lines
  Added in v.781

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26