[GRASS-SVN] r45266 - in grass/trunk/gui/wxpython: docs gui_modules
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Jan 31 16:51:28 EST 2011
Author: martinl
Date: 2011-01-31 13:51:28 -0800 (Mon, 31 Jan 2011)
New Revision: 45266
Modified:
grass/trunk/gui/wxpython/docs/wxGUI.Vector_Digitizer.html
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/gui_modules/render.py
Log:
wxGUI/vdigit: ctrl+left mouse used for undo
Modified: grass/trunk/gui/wxpython/docs/wxGUI.Vector_Digitizer.html
===================================================================
--- grass/trunk/gui/wxpython/docs/wxGUI.Vector_Digitizer.html 2011-01-31 19:34:02 UTC (rev 45265)
+++ grass/trunk/gui/wxpython/docs/wxGUI.Vector_Digitizer.html 2011-01-31 21:51:28 UTC (rev 45266)
@@ -194,8 +194,8 @@
<h2>NOTES</h2>
<dl><dt><b>Mouse button Functions:</b><dd>
- <dt><i>Left</i> - select/deselect features</dt>
- <dt><i>Middle</i> - cancel action</dt>
+ <dt><i>Left</i> - select/deselect features</dt>
+ <dt><i>Control+Left</i> - cancel action/undo vertex</dt>
<dt><i>Right</i> - confirm action</dt>
</dl>
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2011-01-31 19:34:02 UTC (rev 45265)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2011-01-31 21:51:28 UTC (rev 45266)
@@ -1200,8 +1200,7 @@
# event.Skip()
def OnDragging(self, event):
- """!
- Mouse dragging with left button down
+ """!Mouse dragging
"""
Debug.msg (5, "BufferedWindow.MouseAction(): Dragging")
current = event.GetPositionTuple()[:]
@@ -1549,7 +1548,7 @@
"""
Debug.msg (5, "BufferedWindow.OnLeftDown(): use=%s" % \
self.mouse["use"])
-
+
self.mouse['begin'] = event.GetPositionTuple()[:]
if self.mouse["use"] in ["measure", "profile"]:
@@ -1560,68 +1559,18 @@
self.ClearLines(pdc=self.pdcTmp)
else:
self.mouse['begin'] = self.mouse['end']
+
elif self.mouse['use'] == 'zoom':
pass
-
- #
+
# vector digizer
- #
elif self.mouse["use"] == "pointer" and \
self.parent.toolbars['vdigit']:
- digitToolbar = self.parent.toolbars['vdigit']
- digitClass = self.parent.digit
-
- try:
- mapLayer = digitToolbar.GetLayer().GetName()
- except:
- wx.MessageBox(parent = self,
- message = _("No vector map selected for editing."),
- caption = _("Vector digitizer"),
- style = wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
- event.Skip()
- return
-
- if digitToolbar.GetAction() not in ("moveVertex",
- "addVertex",
- "removeVertex",
- "editLine"):
- # set pen
- self.pen = wx.Pen(colour = 'Red', width = 2, style = wx.SHORT_DASH)
- self.polypen = wx.Pen(colour = 'dark green', width = 2, style = wx.SOLID)
-
- if digitToolbar.GetAction() in ("addVertex",
- "removeVertex",
- "splitLines"):
- # unselect
- digitClass.GetDisplay().SetSelected([])
-
- if digitToolbar.GetAction() == "addLine":
- self.OnLeftDownVDigitAddLine(event)
-
- elif digitToolbar.GetAction() == "editLine" and \
- hasattr(self, "vdigitMove"):
- self.OnLeftDownVDigitEditLine(event)
-
- elif digitToolbar.GetAction() in ("moveLine",
- "moveVertex",
- "editLine") and \
- not hasattr(self, "vdigitMove"):
- self.OnLeftDownVDigitMoveLine(event)
-
- elif digitToolbar.GetAction() in ("displayAttrs"
- "displayCats"):
- self.OnLeftDownVDigitDisplayCA(event)
-
- elif digitToolbar.GetAction() in ("copyCats",
- "copyAttrs"):
- self.OnLeftDownVDigitCopyCA(event)
-
- elif digitToolbar.GetAction() == "copyLine":
- self.OnLeftDownVDigitCopyLine(event)
-
- elif digitToolbar.GetAction() == "zbulkLine":
- self.OnLeftDownVDigitBulkLine(event)
-
+ if event.ControlDown():
+ self.OnLeftDownVDigitUndo(event)
+ else:
+ self.OnLeftDownVDigit(event)
+
elif self.mouse['use'] == 'pointer':
# get decoration or text id
self.idlist = []
@@ -1638,7 +1587,129 @@
event.Skip()
- def OnLeftUpVDigitVarious(self, event):
+ def OnLeftDownVDigitUndo(self, event):
+ """!Left mouse button down with control key pressed - vector
+ digitizer undo functionality
+ """
+ digitToolbar = self.parent.toolbars['vdigit']
+ if self.mouse["use"] != "pointer" or not digitToolbar:
+ return
+
+ digitClass = self.parent.digit
+ if (digitToolbar.GetAction() == "addLine" and \
+ digitToolbar.GetAction('type') in ["line", "boundary", "area"]) or \
+ digitToolbar.GetAction() == "editLine":
+ # add line or boundary -> remove last point from the line
+ try:
+ removed = self.polycoords.pop()
+ Debug.msg(4, "BufferedWindow.OnMiddleDown(): polycoords_poped=%s" % \
+ [removed,])
+ # self.mouse['begin'] = self.Cell2Pixel(self.polycoords[-1])
+ except:
+ pass
+
+ if digitToolbar.GetAction() == "editLine":
+ # remove last vertex & line
+ if len(self.vdigitMove['id']) > 1:
+ self.vdigitMove['id'].pop()
+
+ self.UpdateMap(render = False, renderVector = False)
+
+ elif digitToolbar.GetAction() in ["deleteLine", "moveLine", "splitLine",
+ "addVertex", "removeVertex", "moveVertex",
+ "copyCats", "flipLine", "mergeLine",
+ "snapLine", "connectLine", "copyLine",
+ "queryLine", "breakLine", "typeConv"]:
+ # varios tools -> unselected selected features
+ digitClass.GetDisplay().SetSelected([])
+ if digitToolbar.GetAction() in ["moveLine", "moveVertex", "editLine"] and \
+ hasattr(self, "vdigitMove"):
+ del self.vdigitMove
+
+ elif digitToolbar.GetAction() == "copyCats":
+ try:
+ del self.copyCatsList
+ del self.copyCatsIds
+ except AttributeError:
+ pass
+
+ elif digitToolbar.GetAction() == "copyLine":
+ del self.copyIds
+ if self.layerTmp:
+ self.Map.DeleteLayer(self.layerTmp)
+ self.UpdateMap(render = True, renderVector = False)
+ del self.layerTmp
+
+ self.polycoords = []
+ self.UpdateMap(render = False) # render vector
+
+ elif digitToolbar.GetAction() == "zbulkLine":
+ # reset polyline
+ self.polycoords = []
+ digitClass.GetDisplay().SetSelected([])
+ self.UpdateMap(render = False)
+
+ self.redrawAll = True
+ self.UpdateMap(render = False, renderVector = False)
+
+ def OnLeftDownVDigit(self, event):
+ """!Left mouse button donw - vector digitizer various actions
+ """
+ digitToolbar = self.parent.toolbars['vdigit']
+ digitClass = self.parent.digit
+
+ try:
+ mapLayer = digitToolbar.GetLayer().GetName()
+ except:
+ wx.MessageBox(parent = self,
+ message = _("No vector map selected for editing."),
+ caption = _("Vector digitizer"),
+ style = wx.OK | wx.ICON_INFORMATION | wx.CENTRE)
+ event.Skip()
+ return
+
+ if digitToolbar.GetAction() not in ("moveVertex",
+ "addVertex",
+ "removeVertex",
+ "editLine"):
+ # set pen
+ self.pen = wx.Pen(colour = 'Red', width = 2, style = wx.SHORT_DASH)
+ self.polypen = wx.Pen(colour = 'dark green', width = 2, style = wx.SOLID)
+
+ if digitToolbar.GetAction() in ("addVertex",
+ "removeVertex",
+ "splitLines"):
+ # unselect
+ digitClass.GetDisplay().SetSelected([])
+
+ if digitToolbar.GetAction() == "addLine":
+ self.OnLeftDownVDigitAddLine(event)
+
+ elif digitToolbar.GetAction() == "editLine" and \
+ hasattr(self, "vdigitMove"):
+ self.OnLeftDownVDigitEditLine(event)
+
+ elif digitToolbar.GetAction() in ("moveLine",
+ "moveVertex",
+ "editLine") and \
+ not hasattr(self, "vdigitMove"):
+ self.OnLeftDownVDigitMoveLine(event)
+
+ elif digitToolbar.GetAction() in ("displayAttrs"
+ "displayCats"):
+ self.OnLeftDownVDigitDisplayCA(event)
+
+ elif digitToolbar.GetAction() in ("copyCats",
+ "copyAttrs"):
+ self.OnLeftDownVDigitCopyCA(event)
+
+ elif digitToolbar.GetAction() == "copyLine":
+ self.OnLeftDownVDigitCopyLine(event)
+
+ elif digitToolbar.GetAction() == "zbulkLine":
+ self.OnLeftDownVDigitBulkLine(event)
+
+ def OnLeftUpVDigit(self, event):
"""!Left mouse button up - vector digitizer various actions
"""
digitToolbar = self.parent.toolbars['vdigit']
@@ -1982,7 +2053,7 @@
"breakLine",
"typeConv",
"connectLine"):
- self.OnLeftUpVDigitVarious(event)
+ self.OnLeftUpVDigit(event)
elif digitToolbar.GetAction() in ("splitLine",
"addVertex",
@@ -2274,74 +2345,13 @@
"""
if event:
self.mouse['begin'] = event.GetPositionTuple()[:]
-
- digitToolbar = self.parent.toolbars['vdigit']
- # digitization tool
- if self.mouse["use"] == "pointer" and digitToolbar:
- digitClass = self.parent.digit
- if (digitToolbar.GetAction() == "addLine" and \
- digitToolbar.GetAction('type') in ["line", "boundary", "area"]) or \
- digitToolbar.GetAction() == "editLine":
- # add line or boundary -> remove last point from the line
- try:
- removed = self.polycoords.pop()
- Debug.msg(4, "BufferedWindow.OnMiddleDown(): polycoords_poped=%s" % \
- [removed,])
-
- self.mouse['begin'] = self.Cell2Pixel(self.polycoords[-1])
- except:
- pass
-
- if digitToolbar.GetAction() == "editLine":
- # remove last vertex & line
- if len(self.vdigitMove['id']) > 1:
- self.vdigitMove['id'].pop()
-
- self.UpdateMap(render = False, renderVector = False)
-
- elif digitToolbar.GetAction() in ["deleteLine", "moveLine", "splitLine",
- "addVertex", "removeVertex", "moveVertex",
- "copyCats", "flipLine", "mergeLine",
- "snapLine", "connectLine", "copyLine",
- "queryLine", "breakLine", "typeConv"]:
- # varios tools -> unselected selected features
- digitClass.GetDisplay().SetSelected([])
- if digitToolbar.GetAction() in ["moveLine", "moveVertex", "editLine"] and \
- hasattr(self, "vdigitMove"):
-
- del self.vdigitMove
-
- elif digitToolbar.GetAction() == "copyCats":
- try:
- del self.copyCatsList
- del self.copyCatsIds
- except AttributeError:
- pass
-
- elif digitToolbar.GetAction() == "copyLine":
- del self.copyIds
- if self.layerTmp:
- self.Map.DeleteLayer(self.layerTmp)
- self.UpdateMap(render = True, renderVector = False)
- del self.layerTmp
-
- self.polycoords = []
- self.UpdateMap(render = False) # render vector
-
- elif digitToolbar.GetAction() == "zbulkLine":
- # reset polyline
- self.polycoords = []
- digitClass.GetDisplay().SetSelected([])
- self.UpdateMap(render = False)
-
- self.redrawAll = True
-
+
def OnMiddleUp(self, event):
"""!Middle mouse button released
"""
- if self.parent.toolbars['vdigit']:
- event.Skip()
- return
+ # if self.parent.toolbars['vdigit']:
+ # event.Skip()
+ # return
self.mouse['end'] = event.GetPositionTuple()[:]
Modified: grass/trunk/gui/wxpython/gui_modules/render.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/render.py 2011-01-31 19:34:02 UTC (rev 45265)
+++ grass/trunk/gui/wxpython/gui_modules/render.py 2011-01-31 21:51:28 UTC (rev 45266)
@@ -172,7 +172,7 @@
self.maskfile = None
except gcmd.GException, e:
- sys.stderr.write(e.value)
+ # sys.stderr.write(e.value)
# clean up after problems
try:
os.remove(self.mapfile)
More information about the grass-commit
mailing list