[GRASS-SVN] r70203 - in grass/branches/releasebranch_7_2/gui/wxpython: core nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Jan 2 08:20:35 PST 2017


Author: annakrat
Date: 2017-01-02 08:20:35 -0800 (Mon, 02 Jan 2017)
New Revision: 70203

Modified:
   grass/branches/releasebranch_7_2/gui/wxpython/core/settings.py
   grass/branches/releasebranch_7_2/gui/wxpython/nviz/mapwindow.py
   grass/branches/releasebranch_7_2/gui/wxpython/nviz/preferences.py
   grass/branches/releasebranch_7_2/gui/wxpython/nviz/workspace.py
Log:
wxGUI/3D view: set point size relatively to region (merge from trunk, r69732)

Modified: grass/branches/releasebranch_7_2/gui/wxpython/core/settings.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/core/settings.py	2017-01-02 16:16:31 UTC (rev 70202)
+++ grass/branches/releasebranch_7_2/gui/wxpython/core/settings.py	2017-01-02 16:20:35 UTC (rev 70203)
@@ -672,6 +672,7 @@
                     'points': {
                         'show': False,
                         'size': 100,
+                        'autosize': True,
                         'width': 2,
                         'marker': 2,
                         'color': (0, 0, 0, 255),

Modified: grass/branches/releasebranch_7_2/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/nviz/mapwindow.py	2017-01-02 16:16:31 UTC (rev 70202)
+++ grass/branches/releasebranch_7_2/gui/wxpython/nviz/mapwindow.py	2017-01-02 16:20:35 UTC (rev 70203)
@@ -1452,7 +1452,7 @@
 
             elif mapType == 'vector':
                 # reset to default properties (lines/points)
-                data['vector'] = self.nvizDefault.SetVectorDefaultProp()
+                data['vector'] = self.nvizDefault.SetVectorDefaultProp(longDim=self._display.GetLongDim())
                 self.SetVectorFromCmd(item, data['vector'])
                 self.SetVectorSurface(data['vector']['points'])
                 self.SetVectorSurface(data['vector']['lines'])
@@ -1477,9 +1477,7 @@
                         ['lines'])
                 if not data['vector']['points']:
                     self.nvizDefault.SetVectorPointsDefaultProp(
-                        data
-                        ['vector']
-                        ['points'])
+                        data['vector']['points'], self._display.GetLongDim())
             # set updates
             for sec in data.keys():
                 for sec1 in data[sec].keys():
@@ -2310,9 +2308,7 @@
                 vInfo = grass.vector_info_topo(layer.GetName())
                 if (vInfo['points'] + vInfo['centroids']) > 0:
                     self.nvizDefault.SetVectorPointsDefaultProp(
-                        data
-                        ['vector']
-                        ['points'])
+                        data['vector']['points'], self._display.GetLongDim())
                 if (vInfo['lines'] + vInfo['boundaries']) > 0:
                     self.nvizDefault.SetVectorLinesDefaultProp(
                         data

Modified: grass/branches/releasebranch_7_2/gui/wxpython/nviz/preferences.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/nviz/preferences.py	2017-01-02 16:16:31 UTC (rev 70202)
+++ grass/branches/releasebranch_7_2/gui/wxpython/nviz/preferences.py	2017-01-02 16:20:35 UTC (rev 70203)
@@ -595,6 +595,14 @@
 
         row = 0
         # icon size
+        autosize = wx.CheckBox(parent=panel, label=_("Automatic size"))
+        autosize.SetToolTipString(_("Icon size is set automatically based on landscape dimensions."))
+        gridSizer.Add(autosize, pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
+        self.winId['nviz:vector:points:autosize'] = autosize.GetId()
+        autosize.SetValue(UserSettings.Get(group='nviz', key='vector',
+                                           subkey=['points', 'autosize']))
+
+        row += 1
         gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
                                          label=_("Size:")),
                       pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
@@ -610,9 +618,10 @@
                       flag=wx.ALIGN_CENTER_VERTICAL)
 
         # icon symbol
+        row += 1
         gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
                                          label=_("Marker:")),
-                      pos=(row, 2), flag=wx.ALIGN_CENTER_VERTICAL)
+                      pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         isym = wx.Choice(
             parent=panel, id=wx.ID_ANY, size=(100, -1),
             choices=UserSettings.Get(
@@ -623,12 +632,13 @@
         isym.SetSelection(UserSettings.Get(group='nviz', key='vector',
                                            subkey=['points', 'marker']))
         gridSizer.Add(item=isym, flag=wx.ALIGN_CENTER_VERTICAL,
-                      pos=(row, 3))
+                      pos=(row, 1))
 
         # icon color
+        row += 1
         gridSizer.Add(item=wx.StaticText(parent=panel, id=wx.ID_ANY,
                                          label=_("Color:")),
-                      pos=(row, 4), flag=wx.ALIGN_CENTER_VERTICAL)
+                      pos=(row, 0), flag=wx.ALIGN_CENTER_VERTICAL)
         icolor = csel.ColourSelect(panel, id=wx.ID_ANY,
                                    size=globalvar.DIALOG_COLOR_SIZE)
         icolor.SetName('GetColour')
@@ -636,7 +646,7 @@
         icolor.SetColour(UserSettings.Get(group='nviz', key='vector',
                                           subkey=['points', 'color']))
         gridSizer.Add(item=icolor, flag=wx.ALIGN_CENTER_VERTICAL,
-                      pos=(row, 5))
+                      pos=(row, 1))
 
         boxSizer.Add(item=gridSizer, proportion=1,
                      flag=wx.ALL | wx.EXPAND, border=5)

Modified: grass/branches/releasebranch_7_2/gui/wxpython/nviz/workspace.py
===================================================================
--- grass/branches/releasebranch_7_2/gui/wxpython/nviz/workspace.py	2017-01-02 16:16:31 UTC (rev 70202)
+++ grass/branches/releasebranch_7_2/gui/wxpython/nviz/workspace.py	2017-01-02 16:20:35 UTC (rev 70203)
@@ -194,7 +194,7 @@
                 subkey='transp'))
         return data
 
-    def SetVectorDefaultProp(self, data=None):
+    def SetVectorDefaultProp(self, longDim, data=None):
         """Set default vector data properties"""
         if not data:
             data = dict()
@@ -202,7 +202,7 @@
             data[sec] = {}
 
         self.SetVectorLinesDefaultProp(data['lines'])
-        self.SetVectorPointsDefaultProp(data['points'])
+        self.SetVectorPointsDefaultProp(data['points'], longDim)
 
         return data
 
@@ -250,11 +250,17 @@
             for attrb in ('color', 'width', 'mode', 'height', 'thematic'):
                 data[attrb]['update'] = None
 
-    def SetVectorPointsDefaultProp(self, data):
+    def SetVectorPointsDefaultProp(self, data, longDim):
         """Set default vector properties -- points"""
+        size_fraction = 0.005
         # size
-        data['size'] = {'value': UserSettings.Get(group='nviz', key='vector',
-                                                  subkey=['points', 'size'])}
+        autosize = UserSettings.Get(group='nviz', key='vector',
+                                    subkey=['points', 'autosize'])
+        if autosize:
+            data['size'] = {'value': longDim * size_fraction}
+        else:
+            data['size'] = {'value': UserSettings.Get(group='nviz', key='vector',
+                                                      subkey=['points', 'size'])}
 
         # width
         data['width'] = {'value': UserSettings.Get(group='nviz', key='vector',



More information about the grass-commit mailing list