[GRASS-SVN] r42788 - grass/trunk/gui/wxpython/gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Jul 14 15:11:12 EDT 2010
Author: martinl
Date: 2010-07-14 19:11:12 +0000 (Wed, 14 Jul 2010)
New Revision: 42788
Modified:
grass/trunk/gui/wxpython/gui_modules/gmodeler.py
Log:
wxGUI/modeler: fix closing loops
Modified: grass/trunk/gui/wxpython/gui_modules/gmodeler.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/gmodeler.py 2010-07-14 15:14:01 UTC (rev 42787)
+++ grass/trunk/gui/wxpython/gui_modules/gmodeler.py 2010-07-14 19:11:12 UTC (rev 42788)
@@ -1432,7 +1432,7 @@
if points:
for x, y in points:
rel.InsertLineControlPoint(point = wx.RealPoint(x, y))
-
+
self._addEvent(rel)
if isinstance(fromShape, ModelCondition): ### ???
fromShape = toShape
@@ -1540,44 +1540,37 @@
self.canvas.GetDiagram().RemoveShape(rel)
loop.Clear()
- for action in loop.GetItems():
- rel = ModelRelation(parent, action)
- dx = action.GetX() - parent.GetX()
- dy = action.GetY() - parent.GetY()
+ for item in loop.GetItems():
+ rel = ModelRelation(parent, item)
+ dx = item.GetX() - parent.GetX()
+ dy = item.GetY() - parent.GetY()
loop.AddRelation(rel)
- self.AddLine(rel)
if dx != 0:
- rel.MakeLineControlPoints(0)
- rel.InsertLineControlPoint(point = wx.RealPoint(parent.GetX(),
- parent.GetY() + parent.GetHeight() / 2))
- rel.InsertLineControlPoint(point = wx.RealPoint(action.GetX(),
- action.GetY() - action.GetHeight() / 2))
- rel.InsertLineControlPoint(point = wx.RealPoint(parent.GetX(),
- parent.GetY() + dy / 2))
- rel.InsertLineControlPoint(point = wx.RealPoint(parent.GetX() + dx,
- parent.GetY() + dy / 2))
- parent = action
+ rel.SetControlPoints(((parent.GetX(), parent.GetY() + dy / 2),
+ (parent.GetX() + dx, parent.GetY() + dy / 2)))
+ self.AddLine(rel)
+ parent = item
# close loop
- action = loop.GetItems()[-1]
- rel = ModelRelation(action, loop)
+ item = loop.GetItems()[-1]
+ rel = ModelRelation(item, loop)
loop.AddRelation(rel)
self.AddLine(rel)
- dx = (action.GetX() - loop.GetX()) + loop.GetWidth() / 2 + 50
- dy = action.GetHeight() / 2 + 50
+ dx = (item.GetX() - loop.GetX()) + loop.GetWidth() / 2 + 50
+ dy = item.GetHeight() / 2 + 50
rel.MakeLineControlPoints(0)
rel.InsertLineControlPoint(point = wx.RealPoint(loop.GetX() - loop.GetWidth() / 2 ,
loop.GetY()))
- rel.InsertLineControlPoint(point = wx.RealPoint(action.GetX(),
- action.GetY() + action.GetHeight() / 2))
- rel.InsertLineControlPoint(point = wx.RealPoint(action.GetX(),
- action.GetY() + dy))
- rel.InsertLineControlPoint(point = wx.RealPoint(action.GetX() - dx,
- action.GetY() + dy))
- rel.InsertLineControlPoint(point = wx.RealPoint(action.GetX() - dx,
+ rel.InsertLineControlPoint(point = wx.RealPoint(item.GetX(),
+ item.GetY() + item.GetHeight() / 2))
+ rel.InsertLineControlPoint(point = wx.RealPoint(item.GetX(),
+ item.GetY() + dy))
+ rel.InsertLineControlPoint(point = wx.RealPoint(item.GetX() - dx,
+ item.GetY() + dy))
+ rel.InsertLineControlPoint(point = wx.RealPoint(item.GetX() - dx,
loop.GetY()))
- self.canvas.Refresh(False)
+ self.canvas.Refresh()
class ModelCanvas(ogl.ShapeCanvas):
"""!Canvas where model is drawn"""
@@ -2201,6 +2194,8 @@
self._previousHandler.OnEndDragLeft(x, y, keys, attachment)
shape = self.GetShape()
+ if isinstance(shape, ModelLoop):
+ self.frame.DefineLoop(shape)
loop = shape.GetLoop()
if loop:
self.frame.DefineLoop(loop)
More information about the grass-commit
mailing list