[GRASS-SVN] r60115 - grass/trunk/gui/wxpython/animation
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon May 5 10:27:14 PDT 2014
Author: annakrat
Date: 2014-05-05 10:27:14 -0700 (Mon, 05 May 2014)
New Revision: 60115
Modified:
grass/trunk/gui/wxpython/animation/dialogs.py
grass/trunk/gui/wxpython/animation/utils.py
Log:
wxGUI/animation: support also registered vector layers, not just registered vector maps, in 2D
Modified: grass/trunk/gui/wxpython/animation/dialogs.py
===================================================================
--- grass/trunk/gui/wxpython/animation/dialogs.py 2014-05-05 16:50:45 UTC (rev 60114)
+++ grass/trunk/gui/wxpython/animation/dialogs.py 2014-05-05 17:27:14 UTC (rev 60115)
@@ -37,7 +37,7 @@
from gui_core.gselect import Select
from gui_core.widgets import FloatValidator
-from animation.utils import TemporalMode, getRegisteredMaps
+from animation.utils import TemporalMode, getRegisteredMaps, getNameAndLayer
from animation.data import AnimationData, AnimLayer
from animation.toolbars import AnimSimpleLmgrToolbar, SIMPLE_LMGR_STDS
from gui_core.simplelmgr import SimpleLayerManager, \
@@ -1390,7 +1390,8 @@
try:
maps = getRegisteredMaps(self._name, etype=self._mapType)
if maps:
- cmd.append('map={name}'.format(name=maps[0]))
+ mapName, mapLayer = getNameAndLayer(maps[0])
+ cmd.append('map={name}'.format(name=mapName))
except gcore.ScriptError, e:
GError(parent=self, message=str(e), showTraceback=False)
return None
Modified: grass/trunk/gui/wxpython/animation/utils.py
===================================================================
--- grass/trunk/gui/wxpython/animation/utils.py 2014-05-05 16:50:45 UTC (rev 60114)
+++ grass/trunk/gui/wxpython/animation/utils.py 2014-05-05 17:27:14 UTC (rev 60115)
@@ -119,6 +119,28 @@
return timeseriesMaps
+def getNameAndLayer(name):
+ """!Checks whether map name contains layer
+ and returns map name with mapset (when there was mapset)
+ and layer (can be None).
+
+ >>> getNameAndLayer('name:2 at mapset')
+ ('name at mapset', '2')
+ >>> getNameAndLayer('name at mapset')
+ ('name at mapset', None)
+ >>> getNameAndLayer('name:2')
+ ('name', '2')
+ """
+ mapset = layer = None
+ if '@' in name:
+ name, mapset = name.split('@')
+ if ':' in name:
+ name, layer = name.split(':')
+ if mapset:
+ name = name + '@' + mapset
+ return name, layer
+
+
def checkSeriesCompatibility(mapSeriesList=None, timeseriesList=None):
"""!Checks whether time series (map series and stds) are compatible,
which means they have equal number of maps ad times (in case of stds).
@@ -292,7 +314,15 @@
cmd = layer.cmd[:]
cmds = []
for map_ in layer.maps:
- cmd[i] = 'map={name}'.format(name=map_)
+ # check if dataset uses layers instead of maps
+ mapName, mapLayer = getNameAndLayer(map_)
+ cmd[i] = 'map={name}'.format(name=mapName)
+ if mapLayer:
+ try:
+ idx = cmd.index('layer')
+ cmd[idx] = 'layer={layer}'.format(layer=mapLayer)
+ except ValueError:
+ cmd.append('layer={layer}'.format(layer=mapLayer))
cmds.append(cmd[:])
cmdsForComposition.append(cmds)
else:
More information about the grass-commit
mailing list