/[thuban]/branches/WIP-pyshapelib-bramz/Thuban/UI/classgen.py
ViewVC logotype

Diff of /branches/WIP-pyshapelib-bramz/Thuban/UI/classgen.py

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1341 by jonathan, Tue Jul 1 16:10:42 2003 UTC revision 1542 by bh, Fri Aug 1 16:13:49 2003 UTC
# Line 5  Line 5 
5  # This program is free software under the GPL (>=v2)  # This program is free software under the GPL (>=v2)
6  # Read the file COPYING coming with Thuban for details.  # Read the file COPYING coming with Thuban for details.
7    
8  import sys  """The Classification Generator Dialog"""
9    
10    __version__ = "$Revision$"
11    # $Source$
12    # $Id$
13    
14  from Thuban import _  
15    import sys
16    
17  from wxPython.wx import *  from wxPython.wx import *
18    
19    from Thuban import _
20    
21  from Thuban.Model.classification import ClassGroupProperties  from Thuban.Model.classification import ClassGroupProperties
22    
23  from Thuban.Model.table import FIELDTYPE_INT, FIELDTYPE_DOUBLE, \  from Thuban.Model.table import FIELDTYPE_INT, FIELDTYPE_DOUBLE, \
24       FIELDTYPE_STRING       FIELDTYPE_STRING
25    
26    from Thuban.Model.layer import SHAPETYPE_ARC
27  from Thuban.Model.range import Range  from Thuban.Model.range import Range
28  from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor  from Thuban.UI.common import ThubanBeginBusyCursor, ThubanEndBusyCursor
29    
# Line 23  import classifier, resource Line 31  import classifier, resource
31    
32  from Thuban.Model.classgen import \  from Thuban.Model.classgen import \
33      generate_uniform_distribution, generate_singletons, generate_quantiles, \      generate_uniform_distribution, generate_singletons, generate_quantiles, \
34      CustomRamp, GreyRamp, RedRamp, GreenRamp, BlueRamp, GreenToRedRamp, \      CustomRamp, grey_ramp, red_ramp, green_ramp, blue_ramp, green_to_red_ramp, \
35      HotToColdRamp      HotToColdRamp, FixedRamp
36    
37    
38  USEALL_BMP  = "group_use_all"  USEALL_BMP  = "group_use_all"
39  USE_BMP     = "group_use"  USE_BMP     = "group_use"
# Line 46  PROPCOMBOSTR_HOT2COLD   = _("Hot-to-Cold Line 55  PROPCOMBOSTR_HOT2COLD   = _("Hot-to-Cold
55  ID_CLASSGEN_GENCOMBO = 4007  ID_CLASSGEN_GENCOMBO = 4007
56  ID_CLASSGEN_PROPCOMBO = 4008  ID_CLASSGEN_PROPCOMBO = 4008
57    
58    ID_BORDER_COLOR = 4009
59    ID_BORDER_COLOR_CHANGE = 4010
60    
61  class ClassGenDialog(wxDialog):  class ClassGenDialog(wxDialog):
62    
63      def __init__(self, parent, layer, fieldName):      def __init__(self, parent, layer, fieldName):
# Line 131  class ClassGenDialog(wxDialog): Line 143  class ClassGenDialog(wxDialog):
143          self.propPanel = None          self.propPanel = None
144          custom_ramp_panel = CustomRampPanel(self, layer.ShapeType())          custom_ramp_panel = CustomRampPanel(self, layer.ShapeType())
145    
146          self.propCombo.Append(PROPCOMBOSTR_GREY,  GreyRamp)          self.propCombo.Append(PROPCOMBOSTR_GREY,  grey_ramp)
147          self.propCombo.Append(PROPCOMBOSTR_RED,   RedRamp)          self.propCombo.Append(PROPCOMBOSTR_RED,   red_ramp)
148          self.propCombo.Append(PROPCOMBOSTR_GREEN, GreenRamp)          self.propCombo.Append(PROPCOMBOSTR_GREEN, green_ramp)
149          self.propCombo.Append(PROPCOMBOSTR_BLUE,  BlueRamp)          self.propCombo.Append(PROPCOMBOSTR_BLUE,  blue_ramp)
150          self.propCombo.Append(PROPCOMBOSTR_GREEN2RED, GreenToRedRamp)          self.propCombo.Append(PROPCOMBOSTR_GREEN2RED, green_to_red_ramp)
151          self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())          self.propCombo.Append(PROPCOMBOSTR_HOT2COLD,  HotToColdRamp())
152          self.propCombo.Append(PROPCOMBOSTR_CUSTOM, custom_ramp_panel)          self.propCombo.Append(PROPCOMBOSTR_CUSTOM, custom_ramp_panel)
153    
# Line 144  class ClassGenDialog(wxDialog): Line 156  class ClassGenDialog(wxDialog):
156          psizer.Add(self.propCombo, 1, wxALL | wxGROW, 4)          psizer.Add(self.propCombo, 1, wxALL | wxGROW, 4)
157          sizer.Add(psizer, 0, wxALL | wxGROW, 4)          sizer.Add(psizer, 0, wxALL | wxGROW, 4)
158    
159            if layer.ShapeType() != SHAPETYPE_ARC:
160                psizer = wxBoxSizer(wxHORIZONTAL)
161                self.fix_border_check = wxCheckBox(self, -1, _("Fix Border Color"))
162                psizer.Add(self.fix_border_check, 0, wxALL | wxGROW, 4)
163                self.border_color = classifier.ClassGroupPropertiesCtrl(
164                    self, ID_BORDER_COLOR,
165                    ClassGroupProperties(), SHAPETYPE_ARC,
166                    style=wxSIMPLE_BORDER, size=(40, 20))
167                psizer.Add(self.border_color, 0, wxALL | wxGROW, 4)
168                psizer.Add(wxButton(self, ID_BORDER_COLOR_CHANGE, _("Change")),
169                        0, wxALL, 4)
170                sizer.Add(psizer, 0, wxALL | wxGROW, 4)
171                EVT_BUTTON(self, ID_BORDER_COLOR_CHANGE, self.OnBorderColorChange)
172            else:
173                self.border_color = None
174    
175          sizer.Add(custom_ramp_panel, 1, wxGROW | wxALL, 4)          sizer.Add(custom_ramp_panel, 1, wxGROW | wxALL, 4)
176          sizer.Show(custom_ramp_panel, False)          sizer.Show(custom_ramp_panel, False)
177    
# Line 202  class ClassGenDialog(wxDialog): Line 230  class ClassGenDialog(wxDialog):
230              propPanel = self.propCombo.GetClientData(index)              propPanel = self.propCombo.GetClientData(index)
231    
232              ramp = propPanel.GetRamp()              ramp = propPanel.GetRamp()
233                if self.border_color and self.fix_border_check.IsChecked():
234                    props = self.border_color.GetProperties()
235                    ramp = FixedRamp(ramp,
236                        (props.GetLineColor(), props.GetLineWidth(), None))
237    
238              if genSel == GENCOMBOSTR_UNIFORM:              if genSel == GENCOMBOSTR_UNIFORM:
239    
# Line 253  class ClassGenDialog(wxDialog): Line 285  class ClassGenDialog(wxDialog):
285      def OnCancel(self, event):      def OnCancel(self, event):
286          self.Close()          self.Close()
287    
288        def OnBorderColorChange(self, event):
289            self.border_color.DoEdit()
290    
291      def _OnGenTypeSelect(self, event):      def _OnGenTypeSelect(self, event):
292          self.__DoOnGenTypeSelect()          self.__DoOnGenTypeSelect()
293          return          return

Legend:
Removed from v.1341  
changed lines
  Added in v.1542

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26