[GRASS-SVN] r59561 - grass/trunk/gui/wxpython/animation
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 2 13:50:58 PDT 2014
Author: annakrat
Date: 2014-04-02 13:50:58 -0700 (Wed, 02 Apr 2014)
New Revision: 59561
Modified:
grass/trunk/gui/wxpython/animation/controller.py
grass/trunk/gui/wxpython/animation/data.py
Log:
wxGUI/animation: fix rendering when zooming in animation tool
Modified: grass/trunk/gui/wxpython/animation/controller.py
===================================================================
--- grass/trunk/gui/wxpython/animation/controller.py 2014-04-02 15:09:52 UTC (rev 59560)
+++ grass/trunk/gui/wxpython/animation/controller.py 2014-04-02 20:50:58 UTC (rev 59561)
@@ -327,7 +327,8 @@
self.animations[i].SetActive(False)
continue
anim = [anim for anim in self.animationData if anim.windowIndex == i][0]
- regions = anim.GetRegions()
+ w, h = self.mapwindows[i].GetClientSize()
+ regions = anim.GetRegions(w, h)
self.animations[i].SetFrames([HashCmds(cmdList, region)
for cmdList, region in zip(anim.cmdMatrix, regions)])
self.animations[i].SetActive(True)
@@ -337,7 +338,8 @@
self.animations[i].SetActive(False)
continue
anim = [anim for anim in self.animationData if anim.windowIndex == i][0]
- regions = anim.GetRegions()
+ w, h = self.mapwindows[i].GetClientSize()
+ regions = anim.GetRegions(w, h)
identifiers = sampleCmdMatrixAndCreateNames(anim.cmdMatrix,
mapNamesDict[anim.firstStdsNameType[0]],
regions)
@@ -371,7 +373,8 @@
def _set2DData(self, animationData):
opacities = [layer.opacity for layer in animationData.layerList if layer.active]
- regions = animationData.GetRegions()
+ w, h = self.mapwindows[animationData.GetWindowIndex()].GetClientSize()
+ regions = animationData.GetRegions(w, h)
self.bitmapProvider.SetCmds(animationData.cmdMatrix, opacities, regions)
def _load3DData(self, animationData):
Modified: grass/trunk/gui/wxpython/animation/data.py
===================================================================
--- grass/trunk/gui/wxpython/animation/data.py 2014-04-02 15:09:52 UTC (rev 59560)
+++ grass/trunk/gui/wxpython/animation/data.py 2014-04-02 20:50:58 UTC (rev 59561)
@@ -210,12 +210,12 @@
zoomRegionValue = property(fset=SetZoomRegionValue, fget=GetZoomRegionValue)
- def GetRegions(self):
- self._computeRegions(self._mapCount, self._startRegion,
+ def GetRegions(self, width, height):
+ self._computeRegions(width, height, self._mapCount, self._startRegion,
self._endRegion, self._zoomRegionValue)
return self._regions
- def _computeRegions(self, count, startRegion, endRegion=None, zoomValue=None):
+ def _computeRegions(self, width, height, count, startRegion, endRegion=None, zoomValue=None):
"""Computes regions based on start region and end region or zoom value
for each of the animation frames."""
currRegion = dict(gcore.region()) # cast to dict, otherwise deepcopy error
@@ -255,6 +255,13 @@
if regions[i]['n'] < regions[i]['s'] or \
regions[i]['e'] < regions[i]['w']:
regions[i] = regions[i - 1]
+
+ for region in regions:
+ mapwidth = abs(region['e'] - region['w'])
+ mapheight = abs(region['n'] - region['s'])
+ region['nsres'] = mapheight / height
+ region['ewres'] = mapwidth / width
+
self._regions = regions
def __repr__(self):
More information about the grass-commit
mailing list