20 |
|
|
21 |
import classifier, resource |
import classifier, resource |
22 |
|
|
23 |
from Thuban.Model.classgen import ClassGenerator, \ |
from Thuban.Model.classgen import \ |
24 |
|
GenUniformDistribution, GenSingletonsFromList, GenQuantiles, \ |
25 |
CustomRamp, GreyRamp, RedRamp, GreenRamp, BlueRamp, GreenToRedRamp, \ |
CustomRamp, GreyRamp, RedRamp, GreenRamp, BlueRamp, GreenToRedRamp, \ |
26 |
HotToColdRamp |
HotToColdRamp |
27 |
|
|
211 |
and max is not None \ |
and max is not None \ |
212 |
and numGroups is not None: |
and numGroups is not None: |
213 |
|
|
214 |
self.clazz = ClassGenerator().GenUniformDistribution( |
self.clazz = GenUniformDistribution( |
215 |
min, max, numGroups, ramp, |
min, max, numGroups, ramp, |
216 |
self.type == FIELDTYPE_INT) |
self.type == FIELDTYPE_INT) |
217 |
|
|
224 |
if len(list) > 0 \ |
if len(list) > 0 \ |
225 |
and numGroups is not None: |
and numGroups is not None: |
226 |
|
|
227 |
self.clazz = ClassGenerator().GenSingletonsFromList( |
self.clazz = GenSingletonsFromList( |
228 |
list, numGroups, ramp) |
list, numGroups, ramp) |
229 |
|
|
230 |
self.parent._SetClassification(self.clazz) |
self.parent._SetClassification(self.clazz) |
238 |
delta = 1 / float(numGroups) |
delta = 1 / float(numGroups) |
239 |
percents = [delta * i for i in range(1, numGroups + 1)] |
percents = [delta * i for i in range(1, numGroups + 1)] |
240 |
adjusted, self.clazz = \ |
adjusted, self.clazz = \ |
241 |
ClassGenerator().GenQuantiles(_list, percents, ramp, _range) |
GenQuantiles(_list, percents, ramp, _range) |
242 |
|
|
243 |
if adjusted: |
if adjusted: |
244 |
dlg = wxMessageDialog(self, |
dlg = wxMessageDialog(self, |
507 |
|
|
508 |
if self.layer.table is not None: |
if self.layer.table is not None: |
509 |
wxBeginBusyCursor() |
wxBeginBusyCursor() |
510 |
min, max = self.layer.table.ValueRange(self.fieldName) |
try: |
511 |
self.minCtrl.SetValue(str(min)) |
min, max = self.layer.table.ValueRange(self.fieldName) |
512 |
self.maxCtrl.SetValue(str(max)) |
self.minCtrl.SetValue(str(min)) |
513 |
wxEndBusyCursor() |
self.maxCtrl.SetValue(str(max)) |
514 |
|
finally: |
515 |
|
wxEndBusyCursor() |
516 |
|
|
517 |
def __GetValidatedTypeEntry(self, win, value, type, badValue = None): |
def __GetValidatedTypeEntry(self, win, value, type, badValue = None): |
518 |
|
|
835 |
_list = [] |
_list = [] |
836 |
|
|
837 |
if self.layer.table is not None: |
if self.layer.table is not None: |
838 |
wxBeginBusyCursor() |
try: |
839 |
|
wxBeginBusyCursor() |
|
# |
|
|
# FIXME: Replace with a call to table when the method |
|
|
# has been written to get all the values |
|
|
# |
|
|
table = self.layer.table |
|
|
for i in range(table.NumRows()): |
|
|
_list.append(table.ReadValue(i, self.fieldName)) |
|
840 |
|
|
841 |
wxEndBusyCursor() |
# |
842 |
|
# FIXME: Replace with a call to table when the method |
843 |
|
# has been written to get all the values |
844 |
|
# |
845 |
|
table = self.layer.table |
846 |
|
for i in range(table.NumRows()): |
847 |
|
_list.append(table.ReadValue(i, self.fieldName)) |
848 |
|
finally: |
849 |
|
wxEndBusyCursor() |
850 |
|
|
851 |
return _list |
return _list |
852 |
|
|
866 |
|
|
867 |
if self.layer.table is not None: |
if self.layer.table is not None: |
868 |
wxBeginBusyCursor() |
wxBeginBusyCursor() |
869 |
min, max = self.layer.table.ValueRange(self.fieldName) |
try: |
870 |
self.text_range.SetValue("[" + str(min) + ";" + str(max) + "]") |
min, max = self.layer.table.ValueRange(self.fieldName) |
871 |
wxEndBusyCursor() |
self.text_range.SetValue("[" + str(min) + ";" + str(max) + "]") |
872 |
|
finally: |
873 |
|
wxEndBusyCursor() |
874 |
|
|
875 |
ID_CUSTOMRAMP_COPYSTART = 4001 |
ID_CUSTOMRAMP_COPYSTART = 4001 |
876 |
ID_CUSTOMRAMP_COPYEND = 4002 |
ID_CUSTOMRAMP_COPYEND = 4002 |