[GRASS-SVN] r41870 -
grass/branches/develbranch_6/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Apr 14 18:45:37 EDT 2010
Author: martinl
Date: 2010-04-14 18:45:37 -0400 (Wed, 14 Apr 2010)
New Revision: 41870
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
Log:
wxGUI/modeler: fix export to image
(merge r41868 from trunk)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py 2010-04-14 22:45:05 UTC (rev 41869)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/gmodeler.py 2010-04-14 22:45:37 UTC (rev 41870)
@@ -361,8 +361,31 @@
msgType = 'info')
def OnExportImage(self, event):
- """!Export model to image (default image)"""
- size = self.canvas.GetSize()
+ """!Export model to image (default image)
+ """
+ xminImg = 0
+ xmaxImg = 0
+ yminImg = 0
+ ymaxImg = 0
+ for shape in self.canvas.GetDiagram().GetShapeList():
+ w, h = shape.GetBoundingBoxMax()
+ x = shape.GetX()
+ y = shape.GetY()
+ xmin = x - w / 2
+ xmax = x + w / 2
+ ymin = y - h / 2
+ ymax = y + h / 2
+ if xmin < xminImg:
+ xminImg = xmin
+ if xmax > xmaxImg:
+ xmaxImg = xmax
+ if ymin < yminImg:
+ xminImg = xmin
+ if ymax < ymaxImg:
+ xminImg = xmin
+
+ size = wx.Size(int(xmaxImg - xminImg),
+ int(ymaxImg - ymaxImg))
bitmap = wx.EmptyBitmap(width = size.width, height = size.height)
filetype, ltype = GetImageHandlers(wx.ImageFromBitmap(bitmap))
More information about the grass-commit
mailing list