70 |
|
|
71 |
#wxGrid.__init__(self, parent, ID_CLASS_TABLE, size = (340, 160)) |
#wxGrid.__init__(self, parent, ID_CLASS_TABLE, size = (340, 160)) |
72 |
wxGrid.__init__(self, parent, ID_CLASS_TABLE) |
wxGrid.__init__(self, parent, ID_CLASS_TABLE) |
73 |
#self.SetTable(ClassTable(fieldData, layer.ShapeType(), self), true) |
#self.SetTable(ClassTable(fieldData, layer.ShapeType(), self), True) |
74 |
|
|
75 |
EVT_GRID_CELL_LEFT_DCLICK(self, self._OnCellDClick) |
EVT_GRID_CELL_LEFT_DCLICK(self, self._OnCellDClick) |
76 |
EVT_GRID_RANGE_SELECT(self, self._OnSelectedRange) |
EVT_GRID_RANGE_SELECT(self, self._OnSelectedRange) |
89 |
h = self.GetDefaultRowSize() * 4 + self.GetDefaultColLabelSize() |
h = self.GetDefaultRowSize() * 4 + self.GetDefaultColLabelSize() |
90 |
self.SetDimensions(-1, -1, w, h) |
self.SetDimensions(-1, -1, w, h) |
91 |
self.SetSizeHints(w, h, -1, -1) |
self.SetSizeHints(w, h, -1, -1) |
92 |
self.SetTable(ClassTable(clazz, self.shapeType, self), true) |
self.SetTable(ClassTable(clazz, self.shapeType, self), True) |
93 |
else: |
else: |
94 |
table.Reset(clazz, self.shapeType) |
table.Reset(clazz, self.shapeType) |
95 |
|
|
296 |
wxGRIDTABLE_NOTIFY_ROWS_APPENDED, |
wxGRIDTABLE_NOTIFY_ROWS_APPENDED, |
297 |
newRows - curRows) # how many |
newRows - curRows) # how many |
298 |
self.GetView().ProcessTableMessage(msg) |
self.GetView().ProcessTableMessage(msg) |
299 |
|
self.GetView().FitInside() |
300 |
elif newRows < curRows: |
elif newRows < curRows: |
301 |
msg = wxGridTableMessage(self, |
msg = wxGridTableMessage(self, |
302 |
wxGRIDTABLE_NOTIFY_ROWS_DELETED, |
wxGRIDTABLE_NOTIFY_ROWS_DELETED, |
303 |
curRows - newRows, # position |
curRows - newRows, # position |
304 |
curRows - newRows) # how many |
curRows - newRows) # how many |
305 |
self.GetView().ProcessTableMessage(msg) |
self.GetView().ProcessTableMessage(msg) |
306 |
|
self.GetView().FitInside() |
307 |
|
|
308 |
def __SetRow(self, row, group): |
def __SetRow(self, row, group): |
309 |
"""Set a row's data to that of the group. |
"""Set a row's data to that of the group. |
585 |
NonModalDialog.__init__(self, parent, interactor, name, |
NonModalDialog.__init__(self, parent, interactor, name, |
586 |
_("Classifier: %s") % layer.Title()) |
_("Classifier: %s") % layer.Title()) |
587 |
|
|
588 |
|
panel = wxPanel(self, -1, size=(100, 100)) |
589 |
|
|
590 |
self.layer = layer |
self.layer = layer |
591 |
|
|
592 |
self.originalClass = self.layer.GetClassification() |
self.originalClass = self.layer.GetClassification() |
594 |
fieldType = self.originalClass.GetFieldType() |
fieldType = self.originalClass.GetFieldType() |
595 |
|
|
596 |
topBox = wxBoxSizer(wxVERTICAL) |
topBox = wxBoxSizer(wxVERTICAL) |
597 |
|
panelBox = wxBoxSizer(wxVERTICAL) |
598 |
|
|
599 |
#topBox.Add(wxStaticText(self, -1, _("Layer: %s") % layer.Title()), |
#panelBox.Add(wxStaticText(panel, -1, _("Layer: %s") % layer.Title()), |
600 |
#0, wxALIGN_LEFT | wxALL, 4) |
#0, wxALIGN_LEFT | wxALL, 4) |
601 |
topBox.Add(wxStaticText(self, -1, |
panelBox.Add(wxStaticText(panel, -1, |
602 |
_("Layer Type: %s") % layer.ShapeType()), |
_("Layer Type: %s") % layer.ShapeType()), |
603 |
0, wxALIGN_LEFT | wxALL, 4) |
0, wxALIGN_LEFT | wxALL, 4) |
604 |
|
|
606 |
# |
# |
607 |
# make field combo box |
# make field combo box |
608 |
# |
# |
609 |
self.fields = wxComboBox(self, ID_PROPERTY_SELECT, "", |
self.fields = wxComboBox(panel, ID_PROPERTY_SELECT, "", |
610 |
style = wxCB_READONLY) |
style = wxCB_READONLY) |
611 |
|
|
612 |
self.num_cols = layer.table.field_count() |
self.num_cols = layer.table.field_count() |
628 |
self.fields.SetClientData(i + 1, None) |
self.fields.SetClientData(i + 1, None) |
629 |
|
|
630 |
|
|
631 |
# |
########### |
|
# |
|
|
# |
|
632 |
|
|
633 |
self.fieldTypeText = wxStaticText(self, -1, "") |
self.fieldTypeText = wxStaticText(panel, -1, "") |
634 |
topBox.Add(self.fieldTypeText, 0, wxGROW | wxALIGN_LEFT | wxALL, 4) |
panelBox.Add(self.fieldTypeText, 0, wxGROW | wxALIGN_LEFT | wxALL, 4) |
635 |
|
|
636 |
propertyBox = wxBoxSizer(wxHORIZONTAL) |
propertyBox = wxBoxSizer(wxHORIZONTAL) |
637 |
propertyBox.Add(wxStaticText(self, -1, _("Field: ")), |
propertyBox.Add(wxStaticText(panel, -1, _("Field: ")), |
638 |
0, wxALIGN_LEFT | wxALL, 4) |
0, wxALIGN_LEFT | wxALL, 4) |
639 |
propertyBox.Add(self.fields, 1, wxGROW|wxALL, 4) |
propertyBox.Add(self.fields, 1, wxGROW|wxALL, 4) |
640 |
EVT_COMBOBOX(self, ID_PROPERTY_SELECT, self._OnFieldSelect) |
EVT_COMBOBOX(self, ID_PROPERTY_SELECT, self._OnFieldSelect) |
641 |
|
|
642 |
topBox.Add(propertyBox, 0, wxGROW, 4) |
panelBox.Add(propertyBox, 0, wxGROW, 4) |
643 |
|
|
644 |
|
########### |
645 |
# |
# |
646 |
# Classification data table |
# Classification data table |
647 |
# |
# |
648 |
|
|
649 |
controlBox = wxBoxSizer(wxHORIZONTAL) |
controlBox = wxBoxSizer(wxHORIZONTAL) |
650 |
|
|
651 |
self.classGrid = ClassGrid(self) |
self.classGrid = ClassGrid(panel) |
652 |
self.__SetGridTable(self.__cur_field) |
self.__SetGridTable(self.__cur_field) |
653 |
|
|
654 |
controlBox.Add(self.classGrid, 1, wxGROW, 0) |
controlBox.Add(self.classGrid, 1, wxGROW, 0) |
655 |
|
|
656 |
controlButtonBox = wxBoxSizer(wxVERTICAL) |
########### |
|
|
|
657 |
# |
# |
658 |
# Control buttons: |
# Control buttons: |
659 |
# |
# |
660 |
self.controlButtons = [] |
self.controlButtons = [] |
661 |
|
|
662 |
button = wxButton(self, ID_CLASSIFY_ADD, _("Add")) |
controlButtonBox = wxBoxSizer(wxVERTICAL) |
663 |
|
|
664 |
|
button = wxButton(panel, ID_CLASSIFY_ADD, _("Add")) |
665 |
controlButtonBox.Add(button, 0, wxGROW | wxALL, 4) |
controlButtonBox.Add(button, 0, wxGROW | wxALL, 4) |
666 |
self.controlButtons.append(button) |
self.controlButtons.append(button) |
667 |
|
|
668 |
#button = wxButton(self, ID_CLASSIFY_GENRANGE, _("Generate Ranges")) |
#button = wxButton(panel, ID_CLASSIFY_GENRANGE, _("Generate Ranges")) |
669 |
#controlButtonBox.Add(button, 0, wxGROW | wxALL, 4) |
#controlButtonBox.Add(button, 0, wxGROW | wxALL, 4) |
670 |
#self.controlButtons.append(button) |
#self.controlButtons.append(button) |
671 |
|
|
672 |
button = wxButton(self, ID_CLASSIFY_MOVEUP, _("Move Up")) |
button = wxButton(panel, ID_CLASSIFY_MOVEUP, _("Move Up")) |
673 |
controlButtonBox.Add(button, 0, wxGROW | wxALL, 4) |
controlButtonBox.Add(button, 0, wxGROW | wxALL, 4) |
674 |
self.controlButtons.append(button) |
self.controlButtons.append(button) |
675 |
|
|
676 |
button = wxButton(self, ID_CLASSIFY_MOVEDOWN, _("Move Down")) |
button = wxButton(panel, ID_CLASSIFY_MOVEDOWN, _("Move Down")) |
677 |
controlButtonBox.Add(button, 0, wxGROW | wxALL, 4) |
controlButtonBox.Add(button, 0, wxGROW | wxALL, 4) |
678 |
self.controlButtons.append(button) |
self.controlButtons.append(button) |
679 |
|
|
680 |
controlButtonBox.Add(60, 20, 0, wxGROW | wxALL | wxALIGN_BOTTOM, 4) |
controlButtonBox.Add(60, 20, 0, wxGROW | wxALL | wxALIGN_BOTTOM, 4) |
681 |
|
|
682 |
button = wxButton(self, ID_CLASSIFY_REMOVE, _("Remove")) |
button = wxButton(panel, ID_CLASSIFY_REMOVE, _("Remove")) |
683 |
controlButtonBox.Add(button, 0, wxGROW | wxALL | wxALIGN_BOTTOM, 4) |
controlButtonBox.Add(button, 0, wxGROW | wxALL | wxALIGN_BOTTOM, 4) |
684 |
self.controlButtons.append(button) |
self.controlButtons.append(button) |
685 |
|
|
686 |
controlBox.Add(controlButtonBox, 0, wxGROW, 10) |
controlBox.Add(controlButtonBox, 0, wxGROW, 10) |
687 |
topBox.Add(controlBox, 1, wxGROW, 10) |
panelBox.Add(controlBox, 1, wxGROW, 10) |
688 |
|
|
689 |
EVT_BUTTON(self, ID_CLASSIFY_ADD, self._OnAdd) |
EVT_BUTTON(self, ID_CLASSIFY_ADD, self._OnAdd) |
690 |
EVT_BUTTON(self, ID_CLASSIFY_REMOVE, self._OnRemove) |
EVT_BUTTON(self, ID_CLASSIFY_REMOVE, self._OnRemove) |
692 |
EVT_BUTTON(self, ID_CLASSIFY_MOVEUP, self._OnMoveUp) |
EVT_BUTTON(self, ID_CLASSIFY_MOVEUP, self._OnMoveUp) |
693 |
EVT_BUTTON(self, ID_CLASSIFY_MOVEDOWN, self._OnMoveDown) |
EVT_BUTTON(self, ID_CLASSIFY_MOVEDOWN, self._OnMoveDown) |
694 |
|
|
695 |
|
########### |
696 |
|
|
697 |
buttonBox = wxBoxSizer(wxHORIZONTAL) |
buttonBox = wxBoxSizer(wxHORIZONTAL) |
698 |
buttonBox.Add(wxButton(self, ID_CLASSIFY_OK, _("OK")), |
buttonBox.Add(wxButton(panel, ID_CLASSIFY_OK, _("OK")), |
699 |
0, wxALL, 4) |
0, wxALL, 4) |
700 |
buttonBox.Add(60, 20, 0, wxALL, 4) |
buttonBox.Add(60, 20, 0, wxALL, 4) |
701 |
buttonBox.Add(wxButton(self, ID_CLASSIFY_APPLY, _("Apply")), |
buttonBox.Add(wxButton(panel, ID_CLASSIFY_APPLY, _("Apply")), |
702 |
0, wxALL, 4) |
0, wxALL, 4) |
703 |
buttonBox.Add(60, 20, 0, wxALL, 4) |
buttonBox.Add(60, 20, 0, wxALL, 4) |
704 |
buttonBox.Add(wxButton(self, ID_CLASSIFY_CANCEL, _("Cancel")), |
buttonBox.Add(wxButton(panel, ID_CLASSIFY_CANCEL, _("Cancel")), |
705 |
0, wxALL, 4) |
0, wxALL, 4) |
706 |
topBox.Add(buttonBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 10) |
panelBox.Add(buttonBox, 0, wxALIGN_CENTER_HORIZONTAL|wxALIGN_BOTTOM, 0) |
707 |
|
|
708 |
EVT_BUTTON(self, ID_CLASSIFY_OK, self._OnOK) |
EVT_BUTTON(self, ID_CLASSIFY_OK, self._OnOK) |
709 |
EVT_BUTTON(self, ID_CLASSIFY_APPLY, self._OnApply) |
EVT_BUTTON(self, ID_CLASSIFY_APPLY, self._OnApply) |
710 |
EVT_BUTTON(self, ID_CLASSIFY_CANCEL, self._OnCancel) |
EVT_BUTTON(self, ID_CLASSIFY_CANCEL, self._OnCancel) |
711 |
|
|
712 |
|
########### |
713 |
|
|
714 |
self.fields.SetSelection(self.__cur_field) |
self.fields.SetSelection(self.__cur_field) |
715 |
self.__SelectField(self.__cur_field) |
self.__SelectField(self.__cur_field) |
716 |
|
|
717 |
self.SetAutoLayout(true) |
panel.SetAutoLayout(True) |
718 |
|
panel.SetSizer(panelBox) |
719 |
|
panelBox.SetSizeHints(panel) |
720 |
|
|
721 |
|
topBox.Add(panel, 1, wxGROW, 0) |
722 |
|
panelBox.SetSizeHints(self) |
723 |
|
self.SetAutoLayout(True) |
724 |
self.SetSizer(topBox) |
self.SetSizer(topBox) |
|
topBox.Fit(self) |
|
|
topBox.SetSizeHints(self) |
|
|
|
|
725 |
|
|
726 |
def __BuildClassification(self, fieldIndex): |
def __BuildClassification(self, fieldIndex): |
727 |
|
|
881 |
|
|
882 |
def __init__(self, parent, prop, shapeType): |
def __init__(self, parent, prop, shapeType): |
883 |
wxDialog.__init__(self, parent, -1, _("Select Properties"), |
wxDialog.__init__(self, parent, -1, _("Select Properties"), |
884 |
style = wxRESIZE_BORDER) |
style = wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) |
885 |
|
|
886 |
self.prop = ClassGroupProperties(prop) |
self.prop = ClassGroupProperties(prop) |
887 |
|
|
960 |
EVT_BUTTON(self, ID_SELPROP_OK, self._OnOK) |
EVT_BUTTON(self, ID_SELPROP_OK, self._OnOK) |
961 |
EVT_BUTTON(self, ID_SELPROP_CANCEL, self._OnCancel) |
EVT_BUTTON(self, ID_SELPROP_CANCEL, self._OnCancel) |
962 |
|
|
963 |
self.SetAutoLayout(true) |
self.SetAutoLayout(True) |
964 |
self.SetSizer(topBox) |
self.SetSizer(topBox) |
965 |
topBox.Fit(self) |
topBox.Fit(self) |
966 |
topBox.SetSizeHints(self) |
topBox.SetSizeHints(self) |