[GRASS-SVN] r48015 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Thu Sep 1 04:58:40 EDT 2011
Author: annakrat
Date: 2011-09-01 01:58:40 -0700 (Thu, 01 Sep 2011)
New Revision: 48015
Modified:
grass/trunk/gui/wxpython/gui_modules/mapdisp.py
grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
Log:
wxNviz: reuse 2d vector querying for 3d
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-09-01 07:11:55 UTC (rev 48014)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp.py 2011-09-01 08:58:40 UTC (rev 48015)
@@ -1296,7 +1296,9 @@
rast.append(iname)
elif ltype in ('vector', 'thememap', 'themechart'):
vect.append(name)
-
+ # rasters are not queried this way in 3D, we don't want them now
+ if self.IsPaneShown('3d'):
+ rast = list()
# use display region settings instead of computation region settings
self.tmpreg = os.getenv("GRASS_REGION")
os.environ["GRASS_REGION"] = self.Map.SetRegion(windres = False)
@@ -1412,25 +1414,28 @@
cats = self.dialogs['attributes'].GetCats()
- try:
- qlayer = self.Map.GetListOfLayers(l_name = globalvar.QUERYLAYER)[0]
- except IndexError:
- qlayer = None
+ qlayer = None
+ if not self.IsPaneShown('3d'):
+ try:
+ qlayer = self.Map.GetListOfLayers(l_name = globalvar.QUERYLAYER)[0]
+ except IndexError:
+ pass
if self.dialogs['attributes'].mapDBInfo and cats:
- # highlight feature & re-draw map
- if qlayer:
- qlayer.SetCmd(self.AddTmpVectorMapLayer(mapName, cats,
- useId = False,
- addLayer = False))
- else:
- qlayer = self.AddTmpVectorMapLayer(mapName, cats, useId = False)
-
- # set opacity based on queried layer
- opacity = self.tree.GetPyData(self.tree.layer_selected)[0]['maplayer'].GetOpacity(float = True)
- qlayer.SetOpacity(opacity)
-
- self.MapWindow.UpdateMap(render = False, renderVector = False)
+ if not self.IsPaneShown('3d'):
+ # highlight feature & re-draw map
+ if qlayer:
+ qlayer.SetCmd(self.AddTmpVectorMapLayer(mapName, cats,
+ useId = False,
+ addLayer = False))
+ else:
+ qlayer = self.AddTmpVectorMapLayer(mapName, cats, useId = False)
+
+ # set opacity based on queried layer
+ opacity = self.tree.GetPyData(self.tree.layer_selected)[0]['maplayer'].GetOpacity(float = True)
+ qlayer.SetOpacity(opacity)
+
+ self.MapWindow.UpdateMap(render = False, renderVector = False)
if not self.dialogs['attributes'].IsShown():
self.dialogs['attributes'].Show()
else:
Modified: grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-09-01 07:11:55 UTC (rev 48014)
+++ grass/trunk/gui/wxpython/gui_modules/nviz_mapdisp.py 2011-09-01 08:58:40 UTC (rev 48015)
@@ -108,6 +108,8 @@
# list of past views
self.viewhistory = []
self.saveHistory = False
+ # offset for dialog (e.g. DisplayAttributesDialog)
+ self.dialogOffset = 5
# overlays
self.overlays = {}
self.imagedict = {}
@@ -489,13 +491,21 @@
def OnLeftUp(self, event):
self.mouse['end'] = event.GetPositionTuple()
if self.mouse["use"] == "query":
+ # querying
layers = self.GetSelectedLayer(multi = True)
-
+ isRaster = False
+ nVectors = 0
for l in layers:
if l.GetType() == 'raster':
- self.OnQuerySurface(event)
+ isRaster = True
+ break
if l.GetType() == 'vector':
- self.OnQueryVector(event)
+ nVectors += 1
+
+ if isRaster or nVectors > 1:
+ self.OnQueryMap(event)
+ else:
+ self.OnQueryVector(event)
elif self.mouse["use"] == 'cplane':
self.lmgr.nviz.OnCPlaneChangeDone(None)
@@ -719,6 +729,11 @@
self.render['quick'] = False
self.Refresh(False)
+
+ def OnQueryMap(self, event):
+ """!Query raster and vector maps"""
+ self.OnQuerySurface(event)
+ self.parent.QueryMap(event.GetX(), event.GetY())
def OnQuerySurface(self, event):
"""!Query surface on given position"""
@@ -765,8 +780,7 @@
def OnQueryVector(self, event):
"""!Query vector on given position"""
- self.log.WriteWarning(_("Vector querying is not implemented yet"))
- self.log.WriteCmdLog('-' * 80)
+ self.parent.QueryVector(*event.GetPosition())
def UpdateView(self, event):
"""!Change view settings"""
More information about the grass-commit
mailing list