[GRASS-SVN] r30023 - in grass/trunk/gui/wxpython: gui_modules vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Fri Feb 8 16:20:14 EST 2008
Author: martinl
Date: 2008-02-08 16:20:14 -0500 (Fri, 08 Feb 2008)
New Revision: 30023
Modified:
grass/trunk/gui/wxpython/gui_modules/digit.py
grass/trunk/gui/wxpython/vdigit/line.cpp
Log:
wxGUI: Change geometry type of selected features implemented also in vedit component. For vdigit is used veditlib fn.
Modified: grass/trunk/gui/wxpython/gui_modules/digit.py
===================================================================
--- grass/trunk/gui/wxpython/gui_modules/digit.py 2008-02-08 21:08:16 UTC (rev 30022)
+++ grass/trunk/gui/wxpython/gui_modules/digit.py 2008-02-08 21:20:14 UTC (rev 30023)
@@ -607,7 +607,15 @@
"""Connect selected lines/boundaries"""
return self.__ModifyLines('connect')
+ def TypeConvForSelectedLines(self):
+ """Feature type conversion for selected objects.
+ Supported conversions:
+ - point <-> centroid
+ - line <-> boundary
+ """
+ return self.__ModifyLines('chtype')
+
def ZBulkLine(self, pos1, pos2, value, step):
"""Provide z bulk-labeling (automated assigment of z coordinate
to 3d lines
Modified: grass/trunk/gui/wxpython/vdigit/line.cpp
===================================================================
--- grass/trunk/gui/wxpython/vdigit/line.cpp 2008-02-08 21:08:16 UTC (rev 30022)
+++ grass/trunk/gui/wxpython/vdigit/line.cpp 2008-02-08 21:20:14 UTC (rev 30023)
@@ -646,59 +646,12 @@
*/
int Digit::TypeConvLines()
{
- int nlines, line;
- int type, newtype;
- struct line_pnts *Points;
- struct line_cats *Cats;
-
if (!display->mapInfo) {
return -1;
}
- nlines = 0;
-
- Points = Vect_new_line_struct();
- Cats = Vect_new_cats_struct();
-
- for (int i = 0; i < display->selected->n_values; i++) {
- line = display->selected->value[i];
- if (!Vect_line_alive(display->mapInfo, line))
- continue;
- type = Vect_read_line(display->mapInfo, Points, Cats, line);
- if (type < 0) {
- return -1;
- }
- switch (type) {
- case GV_POINT:
- newtype = GV_CENTROID;
- break;
- case GV_CENTROID:
- newtype = GV_POINT;
- break;
- case GV_LINE:
- newtype = GV_BOUNDARY;
- break;
- case GV_BOUNDARY:
- newtype = GV_LINE;
- break;
- default:
- newtype = -1;
- break;
- }
-
- G_debug(3, "Digit.TypeConvLines(): line=%d, from_type=%d, to_type=%d",
- line, type, newtype);
-
- if (newtype > 0) {
- if (Vect_rewrite_line(display->mapInfo, line, newtype, Points, Cats) < 0) {
- return -1;
- }
- nlines++;
- }
- }
-
- Vect_destroy_line_struct(Points);
- Vect_destroy_cats_struct(Cats);
-
- return nlines;
+ int npoints, nlines, ncentroids, nboundaries;
+ return Vedit_chtype_lines (display->mapInfo, display->selected,
+ &npoints, &ncentroids,
+ &nlines, &nboundaries);
}
More information about the grass-commit
mailing list