[GRASS-SVN] r33235 - in grass/branches/develbranch_6/gui/wxpython:
gui_modules vdigit
svn_grass at osgeo.org
svn_grass at osgeo.org
Wed Sep 3 11:24:25 EDT 2008
Author: martinl
Date: 2008-09-03 11:24:18 -0400 (Wed, 03 Sep 2008)
New Revision: 33235
Modified:
grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
grass/branches/develbranch_6/gui/wxpython/vdigit/cats.cpp
grass/branches/develbranch_6/gui/wxpython/vdigit/line.cpp
grass/branches/develbranch_6/gui/wxpython/vdigit/vertex.cpp
Log:
wxGUI/vdigit: undo still disabled, comment-out relevant code (bug fix)
Modified: grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2008-09-03 10:58:54 UTC (rev 33234)
+++ grass/branches/develbranch_6/gui/wxpython/gui_modules/mapdisp.py 2008-09-03 15:24:18 UTC (rev 33235)
@@ -1707,12 +1707,13 @@
if digitToolbar.GetAction() == "moveLine":
# move line
- digitClass.MoveSelectedLines(move)
+ if digitClass.MoveSelectedLines(move) < 0:
+ return
elif digitToolbar.GetAction() == "moveVertex":
# move vertex
- digitClass.MoveSelectedVertex(pFrom,
- move)
-
+ if digitClass.MoveSelectedVertex(pFrom, move) < 0:
+ return
+
del self.moveBegin
del self.moveCoords
del self.moveIds
@@ -1785,24 +1786,30 @@
"input=%s" % sqlfile.name])
elif digitToolbar.GetAction() == "deleteLine":
# -> delete selected vector features
- digitClass.DeleteSelectedLines()
+ if digitClass.DeleteSelectedLines() < 0:
+ return
elif digitToolbar.GetAction() == "splitLine":
# split line
- digitClass.SplitLine(self.Pixel2Cell(self.mouse['begin']))
+ if digitClass.SplitLine(self.Pixel2Cell(self.mouse['begin'])) < 0:
+ return
elif digitToolbar.GetAction() == "addVertex":
# add vertex
- digitClass.AddVertex(self.Pixel2Cell(self.mouse['begin']))
+ if digitClass.AddVertex(self.Pixel2Cell(self.mouse['begin'])) < 0:
+ return
elif digitToolbar.GetAction() == "removeVertex":
# remove vertex
- digitClass.RemoveVertex(self.Pixel2Cell(self.mouse['begin']))
+ if digitClass.RemoveVertex(self.Pixel2Cell(self.mouse['begin'])) < 0:
+ return
elif digitToolbar.GetAction() in ("copyCats", "copyAttrs"):
try:
if digitToolbar.GetAction() == 'copyCats':
- digitClass.CopyCats(self.copyCatsList,
- self.copyCatsIds, copyAttrb=False)
+ if digitClass.CopyCats(self.copyCatsList,
+ self.copyCatsIds, copyAttrb=False) < 0:
+ return
else:
- digitClass.CopyCats(self.copyCatsList,
- self.copyCatsIds, copyAttrb=True)
+ if digitClass.CopyCats(self.copyCatsList,
+ self.copyCatsIds, copyAttrb=True) < 0:
+ return
del self.copyCatsList
del self.copyCatsIds
@@ -1810,24 +1817,31 @@
pass
elif digitToolbar.GetAction() == "editLine" and hasattr(self, "moveBegin"):
line = digitClass.driver.GetSelected()
- digitClass.EditLine(line, self.polycoords)
+ if digitClass.EditLine(line, self.polycoords) < 0:
+ return
del self.moveBegin
del self.moveCoords
del self.moveIds
elif digitToolbar.GetAction() == "flipLine":
- digitClass.FlipLine()
+ if digitClass.FlipLine() < 0:
+ return
elif digitToolbar.GetAction() == "mergeLine":
- digitClass.MergeLine()
+ if digitClass.MergeLine() < 0:
+ return
elif digitToolbar.GetAction() == "breakLine":
- digitClass.BreakLine()
+ if digitClass.BreakLine() < 0:
+ return
elif digitToolbar.GetAction() == "snapLine":
- digitClass.SnapLine()
+ if digitClass.SnapLine() < 0:
+ return
elif digitToolbar.GetAction() == "connectLine":
if len(digitClass.driver.GetSelected()) > 1:
- digitClass.ConnectLine()
+ if digitClass.ConnectLine() < 0:
+ return
elif digitToolbar.GetAction() == "copyLine":
- digitClass.CopyLine(self.copyIds)
+ if digitClass.CopyLine(self.copyIds) < 0:
+ return
del self.copyIds
if self.layerTmp:
self.Map.DeleteLayer(self.layerTmp)
@@ -1842,14 +1856,16 @@
dlg = VDigitZBulkDialog(parent=self, title=_("Z bulk-labeling dialog"),
nselected=len(selected))
if dlg.ShowModal() == wx.ID_OK:
- digitClass.ZBulkLine(pos1, pos2, dlg.value.GetValue(), dlg.step.GetValue())
-
+ if digitClass.ZBulkLine(pos1, pos2, dlg.value.GetValue(),
+ dlg.step.GetValue()) < 0:
+ return
self.UpdateMap(render=False, renderVector=True)
elif digitToolbar.GetAction() == "typeConv":
# -> feature type conversion
# - point <-> centroid
# - line <-> boundary
- digitClass.TypeConvForSelectedLines()
+ if digitClass.TypeConvForSelectedLines() < 0:
+ return
if digitToolbar.GetAction() != "addLine":
# unselect and re-render
Modified: grass/branches/develbranch_6/gui/wxpython/vdigit/cats.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/vdigit/cats.cpp 2008-09-03 10:58:54 UTC (rev 33234)
+++ grass/branches/develbranch_6/gui/wxpython/vdigit/cats.cpp 2008-09-03 15:24:18 UTC (rev 33235)
@@ -271,7 +271,7 @@
}
/* register changeset */
- AddActionToChangeset(changesets.size(), REWRITE, display->selected.values->value[0]);
+ // AddActionToChangeset(changesets.size(), REWRITE, display->selected.values->value[0]);
ret = Vect_rewrite_line(display->mapInfo, line, type,
Points, Cats);
Modified: grass/branches/develbranch_6/gui/wxpython/vdigit/line.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/vdigit/line.cpp 2008-09-03 10:58:54 UTC (rev 33234)
+++ grass/branches/develbranch_6/gui/wxpython/vdigit/line.cpp 2008-09-03 15:24:18 UTC (rev 33235)
@@ -178,7 +178,7 @@
}
/* register changeset */
- AddActionToChangeset(changesets.size(), ADD, newline);
+ // AddActionToChangeset(changesets.size(), ADD, newline);
Vect_destroy_line_struct(Points);
Vect_destroy_cats_struct(Cats);
@@ -269,21 +269,22 @@
}
/* register changeset */
- AddActionToChangeset(changesets.size(), REWRITE, line);
+ // AddActionToChangeset(changesets.size(), REWRITE, line);
/* rewrite line */
if (ret == 0) {
ret = Vect_rewrite_line(display->mapInfo, line, type, points, cats);
}
+ /* TODO
if (ret > 0) {
- /* updates feature id (id is changed since line has been rewriten) */
changesets[changesets.size()-1][0].line = Vect_get_num_lines(display->mapInfo);
}
else {
changesets.erase(changesets.size()-1);
}
-
+ */
+
Vect_destroy_line_struct(points);
Vect_destroy_cats_struct(cats);
@@ -324,17 +325,21 @@
/* register changeset */
changeset = changesets.size();
+ /*
for (int i = 0; i < display->selected.values->n_values; i++) {
AddActionToChangeset(changeset, DELETE, display->selected.values->value[i]);
}
-
+ */
+
ret = Vedit_split_lines(display->mapInfo, display->selected.values,
point, thresh, list);
+ /*
for (int i = 0; i < list->n_values; i++) {
AddActionToChangeset(changeset, ADD, list->value[i]);
}
-
+ */
+
Vect_destroy_list(list);
Vect_destroy_line_struct(point);
@@ -400,10 +405,11 @@
/* register changeset */
changeset = changesets.size();
+ /*
for (int i = 0; i < display->selected.values->n_values; i++) {
AddActionToChangeset(changeset, DELETE, display->selected.values->value[i]);
}
-
+ */
ret = Vedit_delete_lines(display->mapInfo, display->selected.values);
if (ret > 0 && delete_records) {
@@ -512,9 +518,11 @@
/* register changeset */
changeset = changesets.size();
+ /*
for (int i = 0; i < display->selected.values->n_values; i++) {
AddActionToChangeset(changeset, REWRITE, display->selected.values->value[i]);
}
+ */
nlines = Vect_get_num_lines(display->mapInfo);
ret = Vedit_move_lines(display->mapInfo, BgMap, nbgmaps,
@@ -522,6 +530,7 @@
move_x, move_y, move_z,
snap, thresh);
+ /* TODO
if (ret > 0) {
for (int i = 0; i < display->selected.values->n_values; i++) {
changesets[changeset][i].line = nlines + i + 1;
@@ -530,7 +539,8 @@
else {
changesets.erase(changeset);
}
-
+ */
+
if (BgMap && BgMap[0]) {
Vect_close(BgMap[0]);
}
@@ -556,13 +566,16 @@
/* register changeset */
changeset = changesets.size();
+ /*
for (int i = 0; i < display->selected.values->n_values; i++) {
AddActionToChangeset(changeset, REWRITE, display->selected.values->value[i]);
}
+ */
nlines = Vect_get_num_lines(display->mapInfo);
ret = Vedit_flip_lines(display->mapInfo, display->selected.values);
+ /*
if (ret > 0) {
for (int i = 0; i < display->selected.values->n_values; i++) {
changesets[changeset][i].line = nlines + i + 1;
@@ -571,7 +584,8 @@
else {
changesets.erase(changeset);
}
-
+ */
+
return ret;
}
@@ -592,10 +606,11 @@
/* register changeset */
changeset = changesets.size();
+ /*
for (int i = 0; i < display->selected.values->n_values; i++) {
AddActionToChangeset(changeset, DELETE, display->selected.values->value[i]);
}
-
+ */
ret = Vedit_merge_lines(display->mapInfo, display->selected.values);
if (ret > 0) {
@@ -603,18 +618,16 @@
for (int i = 0; i < display->selected.values->n_values; i++) {
line = display->selected.values->value[i];
if (Vect_line_alive(display->mapInfo, line)) {
- RemoveActionFromChangeset(changeset, DELETE, line);
+ // RemoveActionFromChangeset(changeset, DELETE, line);
}
}
for(int i = 0; i < Vect_get_num_updated_lines(display->mapInfo); i++) {
line = Vect_get_updated_line(display->mapInfo, i);
- AddActionToChangeset(changeset, ADD, line);
+ // AddActionToChangeset(changeset, ADD, line);
}
- for (int i = 0; i < display->selected.values->n_values; i++) {
- }
}
else {
- changesets.erase(changeset);
+ // changesets.erase(changeset);
}
return ret;
@@ -639,10 +652,11 @@
/* register changeset */
changeset = changesets.size();
+ /*
for (int i = 0; i < display->selected.values->n_values; i++) {
AddActionToChangeset(changeset, DELETE, display->selected.values->value[i]);
}
-
+ */
ret = Vect_break_lines_list(display->mapInfo, display->selected.values, NULL,
GV_LINES, NULL, NULL);
@@ -651,18 +665,16 @@
for (int i = 0; i < display->selected.values->n_values; i++) {
line = display->selected.values->value[i];
if (Vect_line_alive(display->mapInfo, line)) {
- RemoveActionFromChangeset(changeset, DELETE, line);
+ // RemoveActionFromChangeset(changeset, DELETE, line);
}
}
for(int i = 0; i < Vect_get_num_updated_lines(display->mapInfo); i++) {
line = Vect_get_updated_line(display->mapInfo, i);
- AddActionToChangeset(changeset, ADD, line);
+ // AddActionToChangeset(changeset, ADD, line);
}
- for (int i = 0; i < display->selected.values->n_values; i++) {
- }
}
else {
- changesets.erase(changeset);
+ // changesets.erase(changeset);
}
return ret;
@@ -709,10 +721,11 @@
/* register changeset */
changeset = changesets.size();
+ /*
for (int i = 0; i < display->selected.values->n_values; i++) {
AddActionToChangeset(changeset, DELETE, display->selected.values->value[i]);
}
-
+ */
nlines_diff = Vect_get_num_lines(display->mapInfo);
ret = Vedit_connect_lines(display->mapInfo, display->selected.values,
@@ -721,11 +734,11 @@
if (ret > 0) {
nlines_diff = Vect_get_num_lines(display->mapInfo) - nlines_diff;
for(int i = Vect_get_num_lines(display->mapInfo); i > nlines_diff; i--) {
- AddActionToChangeset(changeset, ADD, i);
+ // AddActionToChangeset(changeset, ADD, i);
}
}
else {
- changesets.erase(changeset);
+ // changesets.erase(changeset);
}
return ret;
@@ -811,9 +824,11 @@
if (ret > 0) {
/* register changeset */
changeset = changesets.size();
+ /*
for (int i = 0; i < list->n_values; i++) {
AddActionToChangeset(changeset, ADD, nlines + i + 1);
}
+ */
}
if (list != display->selected.values) {
@@ -901,10 +916,11 @@
/* register changeset */
changeset = changesets.size();
+ /*
for (int i = 0; i < display->selected.values->n_values; i++) {
AddActionToChangeset(changeset, DELETE, display->selected.values->value[i]);
}
-
+ */
nlines_diff = Vect_get_num_lines(display->mapInfo);
ret = Vedit_chtype_lines (display->mapInfo, display->selected.values,
@@ -913,11 +929,11 @@
if(ret > 0) {
for(int i = Vect_get_num_lines(display->mapInfo); i > nlines_diff; i--) {
- AddActionToChangeset(changeset, ADD, i);
+ // AddActionToChangeset(changeset, ADD, i);
}
}
else {
- changesets.erase(changeset);
+ // changesets.erase(changeset);
}
return ret;
Modified: grass/branches/develbranch_6/gui/wxpython/vdigit/vertex.cpp
===================================================================
--- grass/branches/develbranch_6/gui/wxpython/vdigit/vertex.cpp 2008-09-03 10:58:54 UTC (rev 33234)
+++ grass/branches/develbranch_6/gui/wxpython/vdigit/vertex.cpp 2008-09-03 15:24:18 UTC (rev 33235)
@@ -69,7 +69,7 @@
Vect_append_point(point, x, y, z);
/* register changeset */
- AddActionToChangeset(changesets.size(), REWRITE, display->selected.values->value[0]);
+ // AddActionToChangeset(changesets.size(), REWRITE, display->selected.values->value[0]);
/* move only first found vertex in bbox */
ret = Vedit_move_vertex(display->mapInfo, BgMap, nbgmaps,
@@ -78,14 +78,15 @@
move_x, move_y, move_z,
1, snap);
+ /* TODO
if (ret > 0) {
- /* updates feature id (id is changed since line has been rewriten) */
changesets[changesets.size()-1][0].line = Vect_get_num_lines(display->mapInfo);
}
else {
changesets.erase(changesets.size()-1);
}
-
+ */
+
if (BgMap && BgMap[0]) {
Vect_close(BgMap[0]);
}
@@ -126,7 +127,7 @@
Vect_append_point(point, x, y, z);
/* register changeset */
- AddActionToChangeset(changesets.size(), REWRITE, display->selected.values->value[0]);
+ // AddActionToChangeset(changesets.size(), REWRITE, display->selected.values->value[0]);
if (add) {
ret = Vedit_add_vertex(display->mapInfo, display->selected.values,
@@ -137,14 +138,15 @@
point, thresh);
}
+ /* TODO
if (ret > 0) {
- /* updates feature id (id is changed since line has been rewriten) */
changesets[changesets.size()-1][0].line = Vect_get_num_lines(display->mapInfo);
}
else {
changesets.erase(changesets.size()-1);
}
-
+ */
+
Vect_destroy_line_struct(point);
return ret;
More information about the grass-commit
mailing list