[GRASS-SVN] r55579 - in grass/trunk: include/vect lib/vector/diglib

svn_grass at osgeo.org svn_grass at osgeo.org
Mon Apr 1 06:04:57 PDT 2013


Author: martinl
Date: 2013-04-01 06:04:57 -0700 (Mon, 01 Apr 2013)
New Revision: 55579

Modified:
   grass/trunk/include/vect/dig_defines.h
   grass/trunk/include/vect/dig_externs.h
   grass/trunk/include/vect/dig_structs.h
   grass/trunk/lib/vector/diglib/plus_line.c
   grass/trunk/lib/vector/diglib/update.c
Log:
diglib: pass const variables to dig_add/restore_line
        track also removed nodes (uplist)
        doxygen cosmetics


Modified: grass/trunk/include/vect/dig_defines.h
===================================================================
--- grass/trunk/include/vect/dig_defines.h	2013-04-01 04:34:48 UTC (rev 55578)
+++ grass/trunk/include/vect/dig_defines.h	2013-04-01 13:04:57 UTC (rev 55579)
@@ -5,12 +5,12 @@
 */
 
 /*! \brief Name of vector directory */
-#define GV_DIRECTORY    "vector"	
+#define GV_DIRECTORY    "vector"
 /*! \brief Format description, data location (OGR) */
 #define GV_FRMT_ELEMENT "frmt"
 /*! \brief Native format, coordinates */
 #define GV_COOR_ELEMENT "coor"
-/*! \brief Native format, header information */	
+/*! \brief Native format, header information */
 #define GV_HEAD_ELEMENT "head"
 /*! \brief Native format, link to database */
 #define GV_DBLN_ELEMENT "dbln"
@@ -163,15 +163,15 @@
 #define WITHOUT_Z	0
 #define WITH_Z		1
 
-/*! \brief Side indicator left/right */
+/*! \brief Boundary side indicator left/right */
 #define GV_LEFT	 1
 #define GV_RIGHT 2
 
-/*! \brief Direction indicator forward/backward */
+/*! \brief Line direction indicator forward/backward */
 #define GV_FORWARD  1
 #define GV_BACKWARD 2
 
-/*! \brief Types used in memory on run time (may change) */
+/*! \brief Feature types used in memory on run time (may change) */
 #define GV_POINT      0x01
 #define GV_LINE	      0x02
 #define GV_BOUNDARY   0x04
@@ -184,7 +184,7 @@
 #define GV_POINTS (GV_POINT | GV_CENTROID )
 #define GV_LINES (GV_LINE | GV_BOUNDARY )
 
-/*! \brief Types used in store like 'coor' file or postgis type column (must not change) */
+/*! \brief Feature types used in store like 'coor' file or postgis type column (must not change) */
 #define GV_STORE_POINT    1
 #define GV_STORE_LINE     2
 #define GV_STORE_BOUNDARY 3
@@ -251,5 +251,5 @@
 
 /*! \brief GRASS-PostGIS data provider - default fid column */
 #define GV_PG_FID_COLUMN       "fid"
-/*! Simple features access */
+/*! \brief GRASS-PostGIS data provider - default geometry column */
 #define GV_PG_GEOMETRY_COLUMN "geom"

Modified: grass/trunk/include/vect/dig_externs.h
===================================================================
--- grass/trunk/include/vect/dig_externs.h	2013-04-01 04:34:48 UTC (rev 55578)
+++ grass/trunk/include/vect/dig_externs.h	2013-04-01 13:04:57 UTC (rev 55579)
@@ -121,9 +121,9 @@
 
 /* plus_line.c */
 int dig_add_line(struct Plus_head *, int, const struct line_pnts *,
-		 struct bound_box *, off_t);
-int dig_restore_line(struct Plus_head *, int, int, struct line_pnts *,
-		     struct bound_box *, off_t);
+		 const struct bound_box *, off_t);
+int dig_restore_line(struct Plus_head *, int, int, const struct line_pnts *,
+		     const struct bound_box *, off_t);
 int dig_del_line(struct Plus_head *, int, double, double, double);
 plus_t dig_line_get_area(struct Plus_head *, plus_t, int);
 int dig_line_set_area(struct Plus_head *, plus_t, int, plus_t);
@@ -250,16 +250,12 @@
 int dig_type_from_store(int);
 
 /* update.c */
-/* unused */
 /* list of updated */
-void dig_line_reset_updated(struct Plus_head *Plus);
-void dig_line_add_updated(struct Plus_head *Plus, int line);
-void dig_node_reset_updated(struct Plus_head *Plus);
-void dig_node_add_updated(struct Plus_head *Plus, int node);
+void dig_line_reset_updated(struct Plus_head *);
+void dig_line_add_updated(struct Plus_head *, int);
+void dig_node_reset_updated(struct Plus_head *);
+void dig_node_add_updated(struct Plus_head *, int);
 
-
-
-
 /*********************************************************************
  *		    unused/removed functions
  *********************************************************************/

Modified: grass/trunk/include/vect/dig_structs.h
===================================================================
--- grass/trunk/include/vect/dig_structs.h	2013-04-01 04:34:48 UTC (rev 55578)
+++ grass/trunk/include/vect/dig_structs.h	2013-04-01 13:04:57 UTC (rev 55579)
@@ -1174,7 +1174,7 @@
     */
     struct {
 	/*!
-	  \brief Used internaly in diglib to know if list is maintained
+	  \brief Indicates if the list of updated features is maintained
 	*/
 	int do_uplist;
 	
@@ -1220,7 +1220,7 @@
   Vector map info
 
   Maintains all information about an individual open vector map. The
-structure must be passed to the mosy vector library routines.
+  structure must be passed to the most vector library routines. 
 */
 struct Map_info
 {

Modified: grass/trunk/lib/vector/diglib/plus_line.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_line.c	2013-04-01 04:34:48 UTC (rev 55578)
+++ grass/trunk/lib/vector/diglib/plus_line.c	2013-04-01 13:04:57 UTC (rev 55579)
@@ -19,7 +19,7 @@
 #include <grass/vector.h>
 
 static int add_line(struct Plus_head *plus, int lineid, int type, const struct line_pnts *Points,
-		    struct bound_box *box, off_t offset)
+		    const struct bound_box *box, off_t offset)
 {
     int node, lp;
     struct P_line *line;
@@ -117,17 +117,17 @@
  * \brief Add new line to Plus_head structure.
  *
  * \param[in,out] plus pointer to Plus_head structure
- * \param[in] type feature type
- * \param[in] Points line geometry
- * \param[in] offset line offset
- * \param[in] box bounding box
+ * \param type feature type
+ * \param Points line geometry
+ * \param box bounding box
+ * \param offset line offset
  *
  * \return -1 on error      
  * \return line id
  */
 int
 dig_add_line(struct Plus_head *plus, int type, const struct line_pnts *Points,
-             struct bound_box *box, off_t offset)
+             const struct bound_box *box, off_t offset)
 {
     int ret;
     
@@ -173,18 +173,18 @@
  * \brief Restore line in Plus_head structure.
  *
  * \param[in,out] plus pointer to Plus_head structure
- * \param[in] type feature type
- * \param[in] Points line geometry
- * \param[in] offset line offset
- * \param[in] box bounding box
+ * \param type feature type
+ * \param Points line geometry
+ * \param box bounding box
+ * \param offset line offset
  *
  * \return -1 on error      
  * \return line id
  */
 int
 dig_restore_line(struct Plus_head *plus, int lineid,
-		 int type, struct line_pnts *Points,
-		 struct bound_box *box, off_t offset)
+		 int type, const struct line_pnts *Points,
+		 const struct bound_box *box, off_t offset)
 {
     if (lineid < 1 || lineid > plus->n_lines) {
 	return -1;
@@ -268,11 +268,10 @@
 	dig_free_node(Node);
 	plus->Node[N1] = NULL;
     }
-    else {
-	if (plus->uplist.do_uplist)
-	    dig_node_add_updated(plus, N1);
+    if (plus->uplist.do_uplist) {
+        dig_node_add_updated(plus, Node->n_lines > 0 ? N1 : -N1);
     }
-
+    
     if (Line->type == GV_LINE) {
 	struct P_topo_l *topo = (struct P_topo_l *)Line->topo;
 
@@ -304,9 +303,8 @@
 	dig_free_node(Node);
 	plus->Node[N2] = NULL;
     }
-    else {
-	if (plus->uplist.do_uplist)
-	    dig_node_add_updated(plus, N2);
+    if (plus->uplist.do_uplist) {
+        dig_node_add_updated(plus, Node->n_lines > 0 ? N2 : -N2);
     }
 
     /* Delete line */

Modified: grass/trunk/lib/vector/diglib/update.c
===================================================================
--- grass/trunk/lib/vector/diglib/update.c	2013-04-01 04:34:48 UTC (rev 55578)
+++ grass/trunk/lib/vector/diglib/update.c	2013-04-01 13:04:57 UTC (rev 55579)
@@ -32,6 +32,7 @@
 
    \param Plus pointer to Plus_head structure
    \param line line id
+   \param offset line offset (negative offset is ignored)
  */
 void dig_line_add_updated(struct Plus_head *Plus, int line)
 {
@@ -42,6 +43,7 @@
 	if (Plus->uplist.uplines[i] == line)
 	    return;
     */
+
     /* Alloc space if needed */
     if (Plus->uplist.n_uplines == Plus->uplist.alloc_uplines) {
 	Plus->uplist.alloc_uplines += 1000;



More information about the grass-commit mailing list