[GRASS-SVN] r69732 - in grass/trunk/gui/wxpython: core nviz

svn_grass at osgeo.org svn_grass at osgeo.org
Tue Oct 25 19:41:19 PDT 2016


Author: annakrat
Date: 2016-10-25 19:41:17 -0700 (Tue, 25 Oct 2016)
New Revision: 69732

Modified:
   grass/trunk/gui/wxpython/core/settings.py
   grass/trunk/gui/wxpython/nviz/mapwindow.py
   grass/trunk/gui/wxpython/nviz/preferences.py
   grass/trunk/gui/wxpython/nviz/workspace.py
Log:
wxGUI/3D view: set point size relatively to region

Modified: grass/trunk/gui/wxpython/core/settings.py
===================================================================
--- grass/trunk/gui/wxpython/core/settings.py	2016-10-26 02:11:49 UTC (rev 69731)
+++ grass/trunk/gui/wxpython/core/settings.py	2016-10-26 02:41:17 UTC (rev 69732)
@@ -672,6 +672,7 @@
                     'points': {
                         'show': False,
                         'size': 100,
+                        'autosize': True,
                         'width': 2,
                         'marker': 2,
                         'color': (0, 0, 0, 255),

Modified: grass/trunk/gui/wxpython/nviz/mapwindow.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/mapwindow.py	2016-10-26 02:11:49 UTC (rev 69731)
+++ grass/trunk/gui/wxpython/nviz/mapwindow.py	2016-10-26 02:41:17 UTC (rev 69732)
@@ -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/trunk/gui/wxpython/nviz/preferences.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/preferences.py	2016-10-26 02:11:49 UTC (rev 69731)
+++ grass/trunk/gui/wxpython/nviz/preferences.py	2016-10-26 02:41:17 UTC (rev 69732)
@@ -594,6 +594,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)
@@ -609,9 +617,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(
@@ -622,12 +631,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')
@@ -635,7 +645,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/trunk/gui/wxpython/nviz/workspace.py
===================================================================
--- grass/trunk/gui/wxpython/nviz/workspace.py	2016-10-26 02:11:49 UTC (rev 69731)
+++ grass/trunk/gui/wxpython/nviz/workspace.py	2016-10-26 02:41:17 UTC (rev 69732)
@@ -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