/[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 1379 by bh, Tue Jul 8 13:23:20 2003 UTC
# Line 26  def generate_singletons(_list, ramp): Line 26  def generate_singletons(_list, ramp):
26      The resulting classification will consist of one group for each      The resulting classification will consist of one group for each
27      item in _list whose properties ramp between 'prop1' and 'prop2'.      item in _list whose properties ramp between 'prop1' and 'prop2'.
28    
29      _list -- any object that implements the iterator interface      _list -- a list of values for each singleton
30    
31      ramp -- an object which implements the CustomRamp interface      ramp -- an object which implements the CustomRamp interface
32      """      """
# 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        if maxValue < 1: maxValue = 1
39    
40      for value in _list:      for value in _list:
41          prop = ramp.GetProperties(float(i) / len(_list))          prop = ramp.GetProperties(i / maxValue)
42          clazz.AppendGroup(ClassGroupSingleton(value, prop))          clazz.AppendGroup(ClassGroupSingleton(value, prop))
43          i += 1          i += 1
44    
# Line 56  def generate_uniform_distribution(min, m Line 59  def generate_uniform_distribution(min, m
59      cur_min = min      cur_min = min
60    
61      end = "["      end = "["
62        maxValue = float(numGroups - 1)
63        if maxValue < 1: maxValue = 1
64    
65      for i in range(1, numGroups + 1):      for i in range(1, numGroups + 1):
66    
67          prop = ramp.GetProperties(float(i-1) / numGroups)          prop = ramp.GetProperties(float(i-1) / maxValue)
68    
69          if intStep:          if intStep:
70              cur_max = min + int(round((i * (max - min + 1)) / float(numGroups)))              cur_max = min + int(round((i * (max - min + 1)) / float(numGroups)))
# Line 122  def generate_quantiles(_list, percents, Line 128  def generate_quantiles(_list, percents,
128              i = 1              i = 1
129              end = "]"              end = "]"
130    
131                maxValue = float(numGroups - 1)
132                if maxValue < 1: maxValue = 1
133              for (q, p) in quantiles[3]:              for (q, p) in quantiles[3]:
134    
135                  prop = ramp.GetProperties(float(i-1) / numGroups)                  prop = ramp.GetProperties(float(i-1) / maxValue)
136    
137                  if i == numGroups:                  if i == numGroups:
138                      max = endMax                      max = endMax
# Line 185  def GenQuantiles0(_list, percents, ramp, Line 193  def GenQuantiles0(_list, percents, ramp,
193              i = 1              i = 1
194              end = "]"              end = "]"
195    
196                maxValue = float(numGroups - 1)
197                if maxValue < 1: maxValue = 1
198              for (q, p) in quantiles[3][1:]:              for (q, p) in quantiles[3][1:]:
199                  prop = ramp.GetProperties(float(i) / numGroups)                  prop = ramp.GetProperties(float(i-1) / maxValue)
200    
201                  if i == numGroups:                  if i == numGroups:
202                      max = endMax                      max = endMax
# Line 389  class CustomRamp: Line 399  class CustomRamp:
399          color1 = self.prop1.GetLineColor()          color1 = self.prop1.GetLineColor()
400          color2 = self.prop2.GetLineColor()          color2 = self.prop2.GetLineColor()
401    
402          self.__SetProperty(color1, color2, index, newProps.SetLineColor)          self.__SetProperty(self.prop1.GetLineColor(),
403          self.__SetProperty(color1, color2, index, newProps.SetFill)                             self.prop2.GetLineColor(),
404                               index, newProps.SetLineColor)
405            self.__SetProperty(self.prop1.GetFill(), self.prop2.GetFill(),
406                               index, newProps.SetFill)
407    
408          w = (self.prop2.GetLineWidth() - self.prop1.GetLineWidth()) \          w = (self.prop2.GetLineWidth() - self.prop1.GetLineWidth()) \
409              * index \              * index \

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

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26