[GRASS-SVN] r32386 - in grass/branches/develbranch_6: include lib/vector lib/vector/Vlib vector/v.edit

svn_grass at osgeo.org svn_grass at osgeo.org
Wed Jul 30 11:04:32 EDT 2008


Author: martinl
Date: 2008-07-30 11:04:32 -0400 (Wed, 30 Jul 2008)
New Revision: 32386

Modified:
   grass/branches/develbranch_6/include/Vect.h
   grass/branches/develbranch_6/lib/vector/Vlib/break_lines.c
   grass/branches/develbranch_6/lib/vector/vectorlib.dox
   grass/branches/develbranch_6/vector/v.edit/main.c
Log:
vlib: Vect_break_lines_list(), break optionally only lines which intersect reference lines (used in wxGUI digitizer) [merged from trunk, r32381 and r32384]

Modified: grass/branches/develbranch_6/include/Vect.h
===================================================================
--- grass/branches/develbranch_6/include/Vect.h	2008-07-30 14:58:09 UTC (rev 32385)
+++ grass/branches/develbranch_6/include/Vect.h	2008-07-30 15:04:32 UTC (rev 32386)
@@ -270,7 +270,7 @@
 
     /* Cleaning */
 void Vect_break_lines ( struct Map_info *, int, struct Map_info *, FILE * );
-int Vect_break_lines_list (struct Map_info *, struct ilist *, int, struct Map_info *, FILE *);
+int Vect_break_lines_list (struct Map_info *, struct ilist *, struct ilist *, int, struct Map_info *, FILE *);
 void Vect_break_polygons ( struct Map_info *, int, struct Map_info *, FILE * );
 void Vect_remove_duplicates ( struct Map_info *, int, struct Map_info *, FILE * );
 int Vect_line_check_duplicate ( const struct line_pnts *,
@@ -283,8 +283,8 @@
 void Vect_remove_bridges ( struct Map_info *, struct Map_info *, FILE * );
 void Vect_chtype_bridges ( struct Map_info *, struct Map_info *, FILE * );
 int Vect_remove_small_areas ( struct Map_info *, double, struct Map_info *, FILE *, double * );
-int Vect_clean_small_angles_at_nodes ( struct Map_info *Map, int type, struct Map_info *Err, 
-	                               FILE *msgout);
+int Vect_clean_small_angles_at_nodes ( struct Map_info *, int, struct Map_info *, 
+	                               FILE *);
 
     /* Overlay */
 int Vect_overlay_str_to_operator ( const char * );

Modified: grass/branches/develbranch_6/lib/vector/Vlib/break_lines.c
===================================================================
--- grass/branches/develbranch_6/lib/vector/Vlib/break_lines.c	2008-07-30 14:58:09 UTC (rev 32385)
+++ grass/branches/develbranch_6/lib/vector/Vlib/break_lines.c	2008-07-30 15:04:32 UTC (rev 32386)
@@ -36,7 +36,7 @@
 void 
 Vect_break_lines ( struct Map_info *Map, int type, struct Map_info *Err, FILE *msgout )
 {
-    Vect_break_lines_list (Map, NULL, type, Err, msgout);
+    Vect_break_lines_list (Map, NULL, NULL, type, Err, msgout);
 
     return;
 }
@@ -51,8 +51,12 @@
   The function also breaks lines forming collapsed loop, for example
   0,0;1,0;0,0 is broken at 1,0.
   
+  If reference lines are given (<i>List_ref</i>) break only lines
+  which intersect reference lines.
+
   \param Map input vector map 
-  \param List_break list of lines to be broken or NULL
+  \param List_break list of lines (NULL for all lines in vector map)
+  \param List_ref list of reference lines or NULL
   \param type feature type
   \param[out] Err vector map where points at intersections will be written or NULL
   \param[out] msgout file pointer where messages will be written or NULL
@@ -61,7 +65,7 @@
 */
 
 int
-Vect_break_lines_list ( struct Map_info *Map, struct ilist *List_break,
+Vect_break_lines_list ( struct Map_info *Map, struct ilist *List_break, struct ilist *List_ref,
 			int type, struct Map_info *Err, FILE *msgout )
 {
     struct line_pnts *APoints, *BPoints, *Points;
@@ -122,6 +126,10 @@
 	else {
 	    aline = iline + 1;
 	}
+
+	if (List_ref && !Vect_val_in_list(List_ref, aline))
+	    continue;
+
 	G_debug (3, "aline =  %d", aline);
 	if ( !Vect_line_alive ( Map, aline ) )
 	    continue;
@@ -242,6 +250,9 @@
 		    Vect_line_prune ( AXLines[k] );
 		    if ( (atype & GV_POINTS) || AXLines[k]->n_points > 1 ) {
 			ret = Vect_write_line ( Map, atype, AXLines[k], ACats );  
+			if (List_ref) {
+			    Vect_list_append(List_ref, ret);
+			}
 			G_debug (3, "Line %d written, npoints = %d", ret, AXLines[k]->n_points);
 			if (List_break) {
 			    Vect_list_append(List_break, ret);

Modified: grass/branches/develbranch_6/lib/vector/vectorlib.dox
===================================================================
--- grass/branches/develbranch_6/lib/vector/vectorlib.dox	2008-07-30 14:58:09 UTC (rev 32385)
+++ grass/branches/develbranch_6/lib/vector/vectorlib.dox	2008-07-30 15:04:32 UTC (rev 32386)
@@ -947,6 +947,7 @@
 
 Vect_break_lines();
 
+Vect_break_lines_list();
 
 \section break_polygons Vector break_polygons functions
 

Modified: grass/branches/develbranch_6/vector/v.edit/main.c
===================================================================
--- grass/branches/develbranch_6/vector/v.edit/main.c	2008-07-30 14:58:09 UTC (rev 32385)
+++ grass/branches/develbranch_6/vector/v.edit/main.c	2008-07-30 15:04:32 UTC (rev 32386)
@@ -303,7 +303,7 @@
 				    coord, thresh[THRESH_COORDS], NULL);
 	}
 	else {
-	    ret = Vect_break_lines_list(&Map, List,
+	    ret = Vect_break_lines_list(&Map, List, NULL,
 					GV_LINES, NULL, NULL);
 	}
 	G_message(_("%d lines broken"), ret);



More information about the grass-commit mailing list