/[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 895 by jonathan, Mon May 12 11:21:02 2003 UTC revision 959 by jonathan, Wed May 21 17:22:58 2003 UTC
# Line 28  class ClassGenerator: Line 28  class ClassGenerator:
28                       generated because the stepping values must                       generated because the stepping values must
29                       be precalculated to ramp between prop1 and prop2.                       be precalculated to ramp between prop1 and prop2.
30    
31          prop1 -- initial group property values          ramp -- an object which implements the CustomRamp interface
   
         prop2 -- final group property values  
32          """          """
33    
34          clazz = Classification()          clazz = Classification()
# Line 62  class ClassGenerator: Line 60  class ClassGenerator:
60    
61          return clazz          return clazz
62    
63      def GenUnifromDistribution(self, min, max, numGroups,      def GenUniformDistribution(self, min, max, numGroups,
64                                 ramp, intStep = False):                                 ramp, intStep = False):
65          """Generate a classification with numGroups range groups          """Generate a classification with numGroups range groups
66          each with the same interval.          each with the same interval.
# Line 141  class ClassGenerator: Line 139  class ClassGenerator:
139    
140                  ramp.SetNumGroups(numGroups)                  ramp.SetNumGroups(numGroups)
141    
142                  min = _list[quantiles[1]]                  start, min, endMax, right = _range.GetRange()
143                  start = "["  
144                  oldp = 0                  oldp = 0
145                    i = 1
146                    end = "]"
147    
148                  for (q, p), prop in zip(quantiles[3], ramp):                  for (q, p), prop in zip(quantiles[3], ramp):
149                      max = _list[q]                      if i == numGroups:
150                      group = ClassGroupRange(Range(start + str(min) + ";" +                          max = endMax
151                                                            str(max) + "]"),                          end = right
152                        else:
153                            max = _list[q]
154    
155                        group = ClassGroupRange(Range((start, min, max, end)),
156                                              None, prop)                                              None, prop)
157                    
158                      group.SetLabel("%s%% - %s%%" % (round(oldp*100, 2),                      group.SetLabel("%s%% - %s%%" % (round(oldp*100, 2),
# Line 156  class ClassGenerator: Line 161  class ClassGenerator:
161                      start = "]"                      start = "]"
162                      min = max                      min = max
163                      clazz.AppendGroup(group)                      clazz.AppendGroup(group)
164                        i += 1
165    
166          return (adjusted, clazz)          return (adjusted, clazz)
167    

Legend:
Removed from v.895  
changed lines
  Added in v.959

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26