[GRASS-SVN] r30385 - in grass/trunk: include lib/vector/vedit

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Feb 28 06:35:48 EST 2008


Author: martinl
Date: 2008-02-28 06:35:48 -0500 (Thu, 28 Feb 2008)
New Revision: 30385

Modified:
   grass/trunk/include/vedit.h
   grass/trunk/lib/vector/vedit/vertex.c
Log:
veditlib: Vedit_move_vertex() updated for v.edit (thresh for selecting/snapping vector feature)

Modified: grass/trunk/include/vedit.h
===================================================================
--- grass/trunk/include/vedit.h	2008-02-28 10:42:09 UTC (rev 30384)
+++ grass/trunk/include/vedit.h	2008-02-28 11:35:48 UTC (rev 30385)
@@ -70,7 +70,7 @@
 /* vertex.c */
 int Vedit_move_vertex(struct Map_info *, struct Map_info **, int,
 		      struct ilist *,
-		      struct line_pnts*, double,
+		      struct line_pnts*, double, double,
 		      double, double, double,
 		      int, int);
 int Vedit_add_vertex(struct Map_info *Map, struct ilist *,

Modified: grass/trunk/lib/vector/vedit/vertex.c
===================================================================
--- grass/trunk/lib/vector/vedit/vertex.c	2008-02-28 10:42:09 UTC (rev 30384)
+++ grass/trunk/lib/vector/vedit/vertex.c	2008-02-28 11:35:48 UTC (rev 30385)
@@ -24,7 +24,8 @@
    \param[in] BgMap, nbgmaps list of background vector maps for snapping
    \param[in] List list of selected features
    \param[in] coord points location
-   \param[in] thresh threshold value (also size of bounding boxes) (>0)
+   \param[in] thresh_coords threshold value for selecting vector feature
+   \param[in] thresh_snap threshold value used for snapping
    \param[in] move_x,move_y,move_z direction (move_z is used when map is 3D)
    \param[in] move_first move only first vertex found in the bounding box
    \param[in] snap snapping mode (see vedit.h)
@@ -34,7 +35,7 @@
  */
 int Vedit_move_vertex(struct Map_info *Map, struct Map_info **BgMap, int nbgmaps,
 		      struct ilist *List,
-		      struct line_pnts* coord, double thresh,
+		      struct line_pnts* coord, double thresh_coords, double thresh_snap,
 		      double move_x, double move_y, double move_z,
 		      int move_first, int snap)
 {
@@ -93,7 +94,7 @@
 		    dist = Vect_points_distance (east, north, 0.0,
 						 x[k], y[k], z[k],
 						 WITHOUT_Z);
-		    if (dist <= thresh) {
+		    if (dist <= thresh_coords) {
 			G_debug (3, "Vedit_move_vertex(): line=%d; x=%f, y=%f -> x=%f, y=%f",
 				 line, x[k], y[k], x[k] + move_x, y[k] + move_y);
 			x[k] += move_x;
@@ -106,12 +107,12 @@
 			G_debug (3, "Vedit_move_vertex(): line=%d, point=%d", line, k);
 			
 			if (snap != NO_SNAP) {
-			    if (Vedit_snap_point(Map, line, &x[k], &y[k], &z[k], thresh,
+			    if (Vedit_snap_point(Map, line, &x[k], &y[k], &z[k], thresh_snap,
 						(snap == SNAPVERTEX) ? 1 : 0) == 0) {
 				/* check also background maps */
 				int bgi;
 				for (bgi = 0; bgi < nbgmaps; bgi++) {
-				    if (Vedit_snap_point(BgMap[bgi], line, &x[k], &y[k], &z[k], thresh,
+				    if (Vedit_snap_point(BgMap[bgi], line, &x[k], &y[k], &z[k], thresh_snap,
 							 (snap == SNAPVERTEX) ? 1 : 0))
 					moved[k] = 2;
 					break; /* snapped, don't continue */
@@ -135,7 +136,7 @@
 	    if ((type & GV_LINES) &&
 		Vect_points_distance(x[0], y[0], z[0],
 				     x[npoints-1], y[npoints-1], z[npoints-1],
-				     WITHOUT_Z) <= thresh) {
+				     WITHOUT_Z) <= thresh_snap) {
 
 		if (moved[0] == 1) { /* first node moved */
 		    x[0] = x[npoints-1];



More information about the grass-commit mailing list