[GRASS-SVN] r38931 - in grass/trunk/gui/wxpython: gui_modules vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Mon Aug 31 04:07:23 EDT 2009
Author: martinl
Date: 2009-08-31 04:07:22 -0400 (Mon, 31 Aug 2009)
New Revision: 38931
Modified:
grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
grass/trunk/gui/wxpython/gui_modules/toolbars.py
grass/trunk/gui/wxpython/gui_modules/vdigit.py
grass/trunk/gui/wxpython/vdigit/driver.cpp
grass/trunk/gui/wxpython/vdigit/driver.h
Log:
wxGUI: ZBulk-labeling fixed (trac #737)
(merge from relbr64, r38929)
Modified: grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-08-31 07:58:06 UTC (rev 38930)
+++ grass/trunk/gui/wxpython/gui_modules/mapdisp_window.py 2009-08-31 08:07:22 UTC (rev 38931)
@@ -1428,7 +1428,7 @@
end = self.Pixel2Cell(self.polycoords[-1])
begin = self.Pixel2Cell(self.mouse['begin'])
- self.DrawLines(self.pdcTmp, begin, end)
+ self.DrawLines(self.pdcTmp, polycoords = (begin, end))
def OnLeftDown(self, event):
"""!
@@ -2143,8 +2143,8 @@
dlg = VDigitZBulkDialog(parent=self, title=_("Z bulk-labeling dialog"),
nselected=len(selected))
if dlg.ShowModal() == wx.ID_OK:
- if digitClass.ZBulkLine(pos1, pos2, dlg.value.GetValue(),
- dlg.step.GetValue()) < 0:
+ if digitClass.ZBulkLines(pos1, pos2, dlg.value.GetValue(),
+ dlg.step.GetValue()) < 0:
return
self.UpdateMap(render=False, renderVector=True)
elif digitToolbar.GetAction() == "typeConv":
Modified: grass/trunk/gui/wxpython/gui_modules/toolbars.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/toolbars.py 2009-08-31 07:58:06 UTC (rev 38930)
+++ grass/trunk/gui/wxpython/gui_modules/toolbars.py 2009-08-31 08:07:22 UTC (rev 38931)
@@ -1008,6 +1008,12 @@
def OnZBulk(self, event):
"""!Z bulk-labeling selected lines/boundaries"""
+ if not self.parent.digit.driver.Is3D():
+ wx.MessageBox(parent=self.parent,
+ message=_("Vector map is not 3D. Operation canceled."),
+ caption=_("Error"), style=wx.OK | wx.ICON_ERROR | wx.CENTRE)
+ return
+
if self.action['desc'] == 'zbulkLine': # select previous action
self.toolbar[0].ToggleTool(self.addPoint, True)
self.toolbar[0].ToggleTool(self.additionalTools, False)
Modified: grass/trunk/gui/wxpython/gui_modules/vdigit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/vdigit.py 2009-08-31 07:58:06 UTC (rev 38930)
+++ grass/trunk/gui/wxpython/gui_modules/vdigit.py 2009-08-31 08:07:22 UTC (rev 38931)
@@ -711,6 +711,25 @@
UserSettings.Get(group='vdigit', key='catBoundary',
subkey='enabled'))
+ def ZBulkLines(self, pos1, pos2, start, step):
+ """!Z-bulk labeling
+
+ @param pos1 reference line (start point)
+ @param pos1 reference line (end point)
+ @param start starting value
+ @param step step value
+
+ @return number of modified lines
+ @return -1 on error
+ """
+ ret = self.digit.ZBulkLabeling(pos1[0], pos1[1], pos2[0], pos2[1],
+ start, step)
+
+ if ret > 0:
+ self.toolbar.EnableUndo()
+
+ return ret
+
def __getSnapThreshold(self):
"""!Get snap mode and threshold value
@@ -1018,6 +1037,13 @@
return self.__display.GetMapBoundingBox()
+ def Is3D(self):
+ """!Check if open vector map is 3D
+
+ @return True if 3D
+ @return False if not 3D"""
+ return self.__display.Is3D()
+
def DrawSelected(self, draw=True):
"""!Show/hide selected features"""
self.__display.DrawSelected(draw)
@@ -2463,7 +2489,7 @@
flexSizer.Add(self.step, proportion=0, flag=wx.ALIGN_CENTER | wx.FIXED_MINSIZE)
sizer.Add(item=flexSizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=1)
- border.Add(item=sizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=5)
+ border.Add(item=sizer, proportion=1, flag=wx.ALL | wx.EXPAND, border=0)
# buttons
btnCancel = wx.Button(self, wx.ID_CANCEL)
Modified: grass/trunk/gui/wxpython/vdigit/driver.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/driver.cpp 2009-08-31 07:58:06 UTC (rev 38930)
+++ grass/trunk/gui/wxpython/vdigit/driver.cpp 2009-08-31 08:07:22 UTC (rev 38931)
@@ -617,3 +617,13 @@
return 0;
}
+
+/**
+ \brief Check if vector map is 3D
+
+ \return True for 3D otherwise False
+*/
+bool DisplayDriver::Is3D()
+{
+ return (bool) Vect_is_3d(mapInfo);
+}
Modified: grass/trunk/gui/wxpython/vdigit/driver.h
===================================================================
--- grass/trunk/gui/wxpython/vdigit/driver.h 2009-08-31 07:58:06 UTC (rev 38930)
+++ grass/trunk/gui/wxpython/vdigit/driver.h 2009-08-31 08:07:22 UTC (rev 38931)
@@ -206,6 +206,7 @@
/* misc */
std::vector<double> GetMapBoundingBox();
+ bool Is3D();
/* set */
void SetRegion(double, double, double, double,
More information about the grass-commit
mailing list