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

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

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

revision 1352 by jonathan, Wed Jul 2 09:36:39 2003 UTC revision 1359 by jonathan, Wed Jul 2 10:51:49 2003 UTC
# Line 34  def generate_singletons(_list, ramp): Line 34  def generate_singletons(_list, ramp):
34      clazz = Classification()      clazz = Classification()
35    
36      i = 0      i = 0
37        maxValue = float(len(_list) - 1)
38      for value in _list:      for value in _list:
39          prop = ramp.GetProperties(float(i) / len(_list))          prop = ramp.GetProperties(i / maxValue)
40          clazz.AppendGroup(ClassGroupSingleton(value, prop))          clazz.AppendGroup(ClassGroupSingleton(value, prop))
41          i += 1          i += 1
42    
# Line 56  def generate_uniform_distribution(min, m Line 57  def generate_uniform_distribution(min, m
57      cur_min = min      cur_min = min
58    
59      end = "["      end = "["
60        maxValue = float(numGroups - 1)
61      for i in range(1, numGroups + 1):      for i in range(1, numGroups + 1):
62    
63          prop = ramp.GetProperties(float(i-1) / numGroups)          prop = ramp.GetProperties(float(i-1) / maxValue)
64    
65          if intStep:          if intStep:
66              cur_max = min + int(round((i * (max - min + 1)) / float(numGroups)))              cur_max = min + int(round((i * (max - min + 1)) / maxValue))
67          else:          else:
68              cur_max = min + (i * (max - min)) / float(numGroups)              cur_max = min + (i * (max - min)) / maxValue
69    
70          if i == numGroups:          if i == numGroups:
71              cur_max = max              cur_max = max
# Line 122  def generate_quantiles(_list, percents, Line 124  def generate_quantiles(_list, percents,
124              i = 1              i = 1
125              end = "]"              end = "]"
126    
127                maxValue = float(numGroups - 1)
128              for (q, p) in quantiles[3]:              for (q, p) in quantiles[3]:
129    
130                  prop = ramp.GetProperties(float(i-1) / numGroups)                  prop = ramp.GetProperties(float(i-1) / maxValue)
131    
132                  if i == numGroups:                  if i == numGroups:
133                      max = endMax                      max = endMax
# Line 185  def GenQuantiles0(_list, percents, ramp, Line 188  def GenQuantiles0(_list, percents, ramp,
188              i = 1              i = 1
189              end = "]"              end = "]"
190    
191                maxValue = float(numGroups - 1)
192              for (q, p) in quantiles[3][1:]:              for (q, p) in quantiles[3][1:]:
193                  prop = ramp.GetProperties(float(i) / numGroups)                  prop = ramp.GetProperties(float(i-1) / maxValue)
194    
195                  if i == numGroups:                  if i == numGroups:
196                      max = endMax                      max = endMax

Legend:
Removed from v.1352  
changed lines
  Added in v.1359

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26