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() |
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. |
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), |
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 |
|
|