[GRASS-SVN] r30730 - grass/trunk/lib/vector/diglib
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Mar 25 12:50:06 EDT 2008
Author: martinl
Date: 2008-03-25 12:50:06 -0400 (Tue, 25 Mar 2008)
New Revision: 30730
Modified:
grass/trunk/lib/vector/diglib/plus.c
grass/trunk/lib/vector/diglib/plus_area.c
grass/trunk/lib/vector/diglib/plus_line.c
grass/trunk/lib/vector/diglib/plus_node.c
grass/trunk/lib/vector/diglib/type.c
Log:
diglib: Doxygen strings updated (don't use \fn)
message standardization ([%d] -> %d)
Modified: grass/trunk/lib/vector/diglib/plus.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus.c 2008-03-25 12:30:46 UTC (rev 30729)
+++ grass/trunk/lib/vector/diglib/plus.c 2008-03-25 16:50:06 UTC (rev 30730)
@@ -1,8 +1,10 @@
/**
* \file plus.c
*
- * \brief Lower level functions for reading/writing/manipulating vectors.
+ * \brief Vector library - update topo structure (lower level functions)
*
+ * Lower level functions for reading/writing/manipulating vectors.
+ *
* This program is free software under the GNU General Public License
* (>=v2). Read the file COPYING that comes with GRASS for details.
*
@@ -10,25 +12,7 @@
*
* \date 2001-2006
*/
-/*
-* $Id$
-*
-****************************************************************************
-*
-* MODULE: Vector library
-*
-* AUTHOR(S): Original author CERL, probably Dave Gerdes.
-* Update to GRASS 5.7 Radim Blazek.
-*
-* PURPOSE: Lower level functions for reading/writing/manipulating vectors.
-*
-* COPYRIGHT: (C) 2001 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
+
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
@@ -37,13 +21,11 @@
#include <grass/glocale.h>
/*!
- * \fn int dig_init_plus (struct Plus_head *Plus)
- *
* \brief Init head structure
*
- * \return 1
+ * \param[in,out] Plus pointer to Plus_head structure
*
- * \param[in,out] Plus Plus_head structure
+ * \return 1
*/
int
dig_init_plus (struct Plus_head *Plus)
@@ -116,11 +98,9 @@
}
/*!
- * \fn void dig_free_plus_nodes (struct Plus_head *Plus)
- *
* \brief Free Plus->Node structure
*
- * \param[in] Plus Plus_head structure
+ * \param[in] Plus pointer to Plus_head structure
*/
void
dig_free_plus_nodes (struct Plus_head *Plus)
@@ -150,11 +130,9 @@
}
/*!
- * \fn void dig_free_plus_lines (struct Plus_head *Plus)
- *
* \brief Free Plus->Line structure
*
- * \param[in] Plus Plus_head structure
+ * \param[in] Plus pointer to Plus_head structure
*/
void
dig_free_plus_lines (struct Plus_head *Plus)
@@ -188,11 +166,9 @@
}
/*!
- * \fn void dig_free_plus_areas (struct Plus_head *Plus)
- *
* \brief Free Plus->Area structure
*
- * \param[in] Plus Plus_head structure
+ * \param[in] Plus pointer to Plus_head structure
*/
void
dig_free_plus_areas (struct Plus_head *Plus)
@@ -224,11 +200,9 @@
}
/*!
- * \fn void dig_free_plus_isles (struct Plus_head *Plus)
- *
* \brief Free Plus->Isle structure
*
- * \param[in] Plus Plus_head structure
+ * \param[in] Plus pointer to Plus_head structure
*/
void
dig_free_plus_isles (struct Plus_head *Plus)
@@ -258,13 +232,11 @@
}
/*!
- * \fn void dig_free_plus (struct Plus_head *Plus)
- *
* \brief Free Plus structure.
*
* Structure is not inited and dig_init_plus() should follow.
*
- * \param[in] Plus Plus_head structure
+ * \param[in] Plus pointer to Plus_head structure
*/
void
dig_free_plus (struct Plus_head *Plus)
@@ -279,16 +251,14 @@
}
/*!
- * \fn int dig_load_plus (struct Plus_head *Plus, GVFILE * plus, int head_only)
- *
* \brief Reads topo file to topo structure.
- *
- * \return 1 on success
- * \return 0 on error
*
- * \param[in,out] Plus Plus_head structure
+ * \param[in,out] Plus pointer to Plus_head structure
* \param[in] plus topo file
* \param[in] head_only read only head
+ *
+ * \return 1 on success
+ * \return 0 on error
*/
int
dig_load_plus ( struct Plus_head *Plus, GVFILE * plus, int head_only)
@@ -315,61 +285,59 @@
/* Nodes */
if ( dig_fseek (plus, Plus->Node_offset, 0) == -1 )
- G_fatal_error (_("Cannot read topo for nodes"));
+ G_fatal_error (_("Unable read topology for nodes"));
dig_alloc_nodes ( Plus, Plus->n_nodes );
for (i = 1; i <= Plus->n_nodes; i++)
{
if ( dig_Rd_P_node ( Plus, i, plus) == -1 )
- G_fatal_error (_("Cannot read topo for node [%d]"), i);
+ G_fatal_error (_("Unable to read topology for node %d"), i);
}
/* Lines */
if ( dig_fseek (plus, Plus->Line_offset, 0) == -1 )
- G_fatal_error (_("Cannot read topo for lines"));
+ G_fatal_error (_("Unable read topology for lines"));
dig_alloc_lines ( Plus, Plus->n_lines );
for (i = 1; i <= Plus->n_lines; i++)
{
if ( dig_Rd_P_line ( Plus, i, plus) == -1 )
- G_fatal_error (_("Cannot read topo for line [%d]"), i);
+ G_fatal_error (_("Unable to read topology for line %d"), i);
}
/* Areas */
if ( dig_fseek (plus, Plus->Area_offset, 0) == -1 )
- G_fatal_error (_("Cannot read topo for areas"));
+ G_fatal_error (_("Unable to read topo for areas"));
dig_alloc_areas ( Plus, Plus->n_areas );
for (i = 1; i <= Plus->n_areas; i++)
{
if ( dig_Rd_P_area ( Plus, i, plus) == -1 )
- G_fatal_error (_("Cannot read topo for area [%d]"), i);
+ G_fatal_error (_("Unable read topology for area %d"), i);
}
/* Isles */
if ( dig_fseek (plus, Plus->Isle_offset, 0) == -1 )
- G_fatal_error (_("Cannot read topo for isles"));
+ G_fatal_error (_("Unable to read topology for isles"));
dig_alloc_isles ( Plus, Plus->n_isles );
for (i = 1; i <= Plus->n_isles; i++)
{
if ( dig_Rd_P_isle ( Plus, i, plus) == -1 )
- G_fatal_error (_("Cannot read topo for isle [%d]"), i);
+ G_fatal_error (_("Unable to read topology for isle %d"), i);
}
return (1);
}
/*!
- * \fn int dig_write_plus_file ( GVFILE * fp_plus, struct Plus_head *Plus)
- *
* \brief Writes topo structure to topo file
*
+ * \param[in,out] fp_plus topo file
+ * \param[in] Plus pointer to Plus_head structure
+ *
* \return 0 on success
* \return -1 on error
- *
- * \param[in,out] fp_plus topo file
- * \param[in] Plus Plus_head structure
*/
int
dig_write_plus_file ( GVFILE * fp_plus,
@@ -381,38 +349,38 @@
if (dig_Wr_Plus_head (fp_plus, Plus) < 0)
{
- fprintf (stderr, "\nERROR: Can't write head to plus file.\n");
+ G_warning(_("Unable to write head to plus file"));
return (-1);
}
if (dig_write_nodes (fp_plus, Plus) < 0)
{
- fprintf (stderr, "\nERROR: Can't write nodes to plus file.\n");
+ G_warning(_("Unable to write nodes to plus file"));
return (-1);
}
if (dig_write_lines (fp_plus, Plus) < 0)
{
- fprintf (stderr, "\nERROR: Can't write lines to plus file.\n");
+ G_warning(_("Unable to write lines to plus file"));
return (-1);
}
if (dig_write_areas (fp_plus, Plus) < 0)
{
- fprintf (stderr, "\nERROR: Can't write areas to plus file.\n");
+ G_warning(_("Unable to write areas to plus file"));
return (-1);
}
if (dig_write_isles (fp_plus, Plus) < 0)
{
- fprintf (stderr, "\nERROR: Can't write isles to plus file.\n");
+ G_warning(_("Unable to write isles to plus file"));
return (-1);
}
dig_rewind (fp_plus);
if (dig_Wr_Plus_head (fp_plus, Plus) < 0)
{
- fprintf (stderr, "\nERROR: Can't write head to plus file.\n");
+ G_warning(_("Unable to write head to plus file"));
return (-1);
}
@@ -421,15 +389,13 @@
} /* write_plus_file() */
/*!
- * \fn int dig_write_nodes ( GVFILE * fp_plus, struct Plus_head *Plus)
- *
* \brief Writes topo structure (nodes) to topo file
*
+ * \param[in,out] fp_plus topo file
+ * \param[in] Plus pointer to Plus_head structure
+ *
* \return 0 on success
* \return -1 on error
- *
- * \param[in,out] fp_plus topo file
- * \param[in] Plus Plus_head structure
*/
int
dig_write_nodes ( GVFILE * plus,
@@ -450,15 +416,13 @@
} /* write_nodes() */
/*!
- * \fn int dig_write_lines ( GVFILE * fp_plus, struct Plus_head *Plus)
- *
* \brief Writes topo structure (lines) to topo file
*
+ * \param[in,out] fp_plus topo file
+ * \param[in] Plus pointer to Plus_head structure
+ *
* \return 0 on success
* \return -1 on error
- *
- * \param[in,out] fp_plus topo file
- * \param[in] Plus Plus_head structure
*/
int
dig_write_lines ( GVFILE * plus,
@@ -480,15 +444,13 @@
} /* write_line() */
/*!
- * \fn int dig_write_areas ( GVFILE * fp_plus, struct Plus_head *Plus)
- *
* \brief Writes topo structure (areas) to topo file
*
+ * \param[in,out] fp_plus topo file
+ * \param[in] Plus pointer to Plus_head structure
+ *
* \return 0 on success
* \return -1 on error
- *
- * \param[in,out] fp_plus topo file
- * \param[in] Plus Plus_head structure
*/
int
dig_write_areas ( GVFILE * plus,
@@ -510,15 +472,13 @@
} /* write_areas() */
/*!
- * \fn int dig_write_isles ( GVFILE * fp_plus, struct Plus_head *Plus)
- *
* \brief Writes topo structure (isles) to topo file
*
+ * \param[in,out] fp_plus topo file
+ * \param[in] Plus pointer to Plus_head structure
+ *
* \return 0 on success
* \return -1 on error
- *
- * \param[in,out] fp_plus topo file
- * \param[in] Plus Plus_head structure
*/
int
dig_write_isles ( GVFILE * plus,
Modified: grass/trunk/lib/vector/diglib/plus_area.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_area.c 2008-03-25 12:30:46 UTC (rev 30729)
+++ grass/trunk/lib/vector/diglib/plus_area.c 2008-03-25 16:50:06 UTC (rev 30730)
@@ -1,8 +1,10 @@
/**
* \file plus_area.c
*
- * \brief Lower level functions for reading/writing/manipulating vectors.
+ * \brief Vector library - update topo for areas (lower level functions)
*
+ * Lower level functions for reading/writing/manipulating vectors.
+ *
* This program is free software under the GNU General Public License
* (>=v2). Read the file COPYING that comes with GRASS for details.
*
@@ -10,57 +12,37 @@
*
* \date 2001-2006
*/
-/*
-* $Id$
-*
-****************************************************************************
-*
-* MODULE: Vector library
-*
-* AUTHOR(S): Dave Gerdes, CERL.
-* Update to GRASS 5.7 Radim Blazek.
-*
-* PURPOSE: Lower level functions for reading/writing/manipulating vectors.
-*
-* COPYRIGHT: (C) 2001 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
+
#include <stdlib.h>
#include <grass/Vect.h>
#include <grass/glocale.h>
/*!
- * \fn int dig_build_area_with_line (struct Plus_head *plus, plus_t first_line, int side, plus_t **lines)
+ * \brief Build topo for area from lines
*
- * \brief This is the real guts of build area stuff
- *
* Area is built in clockwise order.
* Take a given line and start off to the RIGHT/LEFT and try to complete
* an area.
*
* Possible Scenarios:
- * - I. path runs into first line. : AREA!
- * - II. path runs into a dead end (no other area lines at node) : no area
- * - III. path runs into a previous line that is not 1st line or to 1st line but not to start node : no area
+ * - I. path runs into first line. : AREA!
+ * - II. path runs into a dead end (no other area lines at node) : no area
+ * - III. path runs into a previous line that is not 1st line or to 1st line but not to start node : no area
*
* After we find an area then we call point_in_area() to see if the
* specified point is w/in the area
*
- * old returns -1: error 0: no area (1: point in area)
+ * Old returns -1: error 0: no area (1: point in area)
* -2: island !!
*
- * \return -1 on error
- * \return 0 no area
- * number of lines
- *
- * \param[in] plus Plus_head structure
- * \param[in] first_line always positive
+ * \param[in] plus pointer to Plus_head structure
+ * \param[in] first_line line id of first line
* \param[in] side side of line to build area on (GV_LEFT | GV_RIGHT)
* \param[in] lines pointer to array of lines
+ *
+ * \return -1 on error
+ * \return 0 no area
+ * \return number of lines
*/
int
dig_build_area_with_line (struct Plus_head *plus, plus_t first_line, int side, plus_t **lines)
@@ -160,21 +142,19 @@
}
/*!
- * \fn int dig_add_area (struct Plus_head *plus, int n_lines, plus_t *lines)
- *
* \brief Allocate space for new area and create boundary info from array.
*
* Then for each line in area, update line (right,left) info.
*
* Neither islands nor centroids area filled.
*
- * \return number of new area
- * \return -1 on error
- *
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer to Plus_head structure
* \param[in] n_lines number of lines
* \param[in] lines array of lines, negative for reverse direction
- */
+ *
+ * \return number of new area
+ * \return -1 on error
+*/
int
dig_add_area (struct Plus_head *plus, int n_lines, plus_t *lines)
{
@@ -208,7 +188,7 @@
if ( plus->do_uplist ) dig_line_add_updated ( plus, abs(line) );
if (line < 0) { /* revers direction -> area on left */
if ( Line->left != 0 ) {
- G_warning (_("Line [%d] already has area/isle [%d] to left."), line, Line->left);
+ G_warning (_("Line %d already has area/isle %d to left"), line, Line->left);
return -1;
}
@@ -216,7 +196,7 @@
Line->left = area;
} else {
if ( Line->right != 0 ) {
- G_warning (_("Line [%d] already has area/isle [%d] to right."), line, Line->right);
+ G_warning (_("Line %d already has area/isle %d to right"), line, Line->right);
return -1;
}
@@ -241,15 +221,13 @@
}
/*!
- * \fn int dig_area_add_isle (struct Plus_head *plus, int area, int isle)
- *
* \brief Add isle to area if does not exist yet.
*
- * \return 0
- *
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer to Plus_head structure
* \param[in] area area id
* \param[in] isle isle id
+ *
+ * \return 0
*/
int
dig_area_add_isle (struct Plus_head *plus, int area, int isle)
@@ -280,15 +258,13 @@
}
/*!
- * \fn int dig_area_del_isle (struct Plus_head *plus, int area, int isle)
- *
* \brief Delete isle from area.
*
- * \return 0
- *
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer to Plus_head structure
* \param[in] area area id
* \param[in] isle isle id
+ *
+ * \return 0
*/
int
dig_area_del_isle (struct Plus_head *plus, int area, int isle)
@@ -313,17 +289,15 @@
if ( mv ) {
Area->n_isles--;
} else {
- G_fatal_error(_("Attempt to delete not registered isle [%d] from area [%d]"), isle, area);
+ G_fatal_error(_("Attempt to delete not registered isle %d from area %d"), isle, area);
}
return 0;
}
/*!
- * \fn int dig_del_area (struct Plus_head *plus, int area)
+ * \brief Delete area from Plus_head structure
*
- * \brief Delete area from topology.
- *
* This function deletes area from the topo structure and resets references
* to this area in lines, isles (within) to 0.
* Possible new area is not created by this function, so that
@@ -333,11 +307,11 @@
* deleted area is reset to that area outside.
* (currently area info of isles is set to 0)
*
+ * \param[in] plus pointer to Plus_head structure
+ * \param[in] area area id
+ *
* \return 0 on error
* \return 1 on success
- *
- * \param[in] plus Plus_head structure
- * \param[in] area area id
*/
int
dig_del_area (struct Plus_head *plus, int area ) {
@@ -389,7 +363,7 @@
if ( line > 0 ) {
Line = plus->Line[line];
if ( !Line ) {
- G_warning (_("Dead centroid [%d] registered for area (bug in the library)."), line );
+ G_warning (_("Dead centroid %d registered for area (bug in the vector library)"), line );
} else {
Line->left = 0;
if ( plus->do_uplist ) dig_line_add_updated ( plus, line );
@@ -410,7 +384,7 @@
for (i = 0; i < Area->n_isles; i++) {
Isle = plus->Isle[Area->isles[i]];
if ( Isle == NULL ) {
- G_fatal_error (_("Attempt to delete area [%d] info from dead isle [%d]"), area, Area->isles[i] );
+ G_fatal_error (_("Attempt to delete area %d info from dead isle %d"), area, Area->isles[i] );
} else {
/* Isle->area = area_out; */
Isle->area = 0;
@@ -423,15 +397,13 @@
}
/*!
- * \fn int dig_area_set_box (struct Plus_head *plus, plus_t area, BOUND_BOX *Box )
+ * \brief Set area bounding box
*
- * \brief Set area bound box
+ * \param[in] plus pointer to Plus_head structure
+ * \param[in] area area id
+ * \param[in] Box bounding box
*
* \return 1
- *
- * \param[in] plus Plus_head structure
- * \param[in] area area id
- * \param[in] Box bound box structure
*/
int
dig_area_set_box (struct Plus_head *plus, plus_t area, BOUND_BOX *Box ) {
@@ -451,21 +423,19 @@
/*!
- * \fn int dig_angle_next_line (struct Plus_head *plus, plus_t current_line, int side, int type)
- *
* \brief Find number line of next angle to follow an line
*
* Assume that lines are sorted in increasing angle order and angles
* of points and degenerated lines are set to 9 (ignored).
*
+ * \param[in] plus pointer to Plus_head structure
+ * \param[in] current_line current line id, negative if request for node 2
+ * \param[in] side side GV_RIGHT or GV_LEFT
+ * \param[in] type line type (GV_LINE, GV_BOUNDARY or both)
+ *
* \return line number of next angle to follow an line (negative if connected by node2)
* (number of current line may be return if dangle - this is used in build)
* \return 0 on error or not found
- *
- * \param[in] plus Plus_head structure
- * \param[in] current_line current line number, negative if request for node 2
- * \param[in] side GV_RIGHT or GV_LEFT
- * \param[in] type type of line GV_LINE, GV_BOUNDARY or both
*/
int
dig_angle_next_line (struct Plus_head *plus, plus_t current_line, int side, int type)
@@ -538,20 +508,18 @@
}
/*!
- * \fn int dig_node_angle_check (struct Plus_head *plus, plus_t line, int type)
- *
* \brief Checks if angles of adjacent lines differ.
*
- * Negative line number for end point. assume that lines are sorted
+ * Negative line number for end point. Assume that lines are sorted
* in increasing angle order and angles of points and degenerated
* lines are set to 9 (ignored).
*
+ * \param[in] plus pointer to Plus_head structure
+ * \param[in] line current line id, negative if request for node 2
+ * \param[in] type line type (GV_LINE, GV_BOUNDARY or both)
+ *
* \return 1 angles differ
* \return 0 angle of a line up or down is identical
- *
- * \param[in] plus Plus_head structure
- * \param[in] line current line number, negative if request for node 2
- * \param[in] type type of line GV_LINE, GV_BOUNDARY or both
*/
int
dig_node_angle_check (struct Plus_head *plus, plus_t line, int type)
@@ -590,20 +558,19 @@
}
/*!
- * \fn int dig_add_isle (struct Plus_head *plus, int n_lines, plus_t *lines )
- *
* \brief Allocate space for new island and create boundary info from array.
*
- * The order of impult lines is expected to be counter clockwise.
+ * The order of input lines is expected to be counter clockwise.
* Then for each line in isle, update line (right,left) info.
*
* Area number the island is within is not filled.
*
- * \return number of new isle
- * \return -1 on error
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer to Plus_head structure
* \param[in] n_lines number of lines
* \param[in] lines array of lines, negative for reverse direction
+ *
+ * \return number of new isle
+ * \return -1 on error
*/
int
dig_add_isle (struct Plus_head *plus, int n_lines, plus_t *lines )
@@ -645,13 +612,13 @@
if ( plus->do_uplist ) dig_line_add_updated ( plus, abs(line) );
if (line < 0) { /* revers direction -> isle on left */
if ( Line->left != 0 ) {
- G_warning (_("Line [%d] already has area/isle [%d] to left."), line, Line->left);
+ G_warning (_("Line %d already has area/isle %d to left"), line, Line->left);
return -1;
}
Line->left = -isle;
} else {
if ( Line->right != 0 ) {
- G_warning (_("Line [%d] already has area/isle [%d] to left."), line, Line->right);
+ G_warning (_("Line %d already has area/isle %d to left"), line, Line->right);
return -1;
}
@@ -677,15 +644,13 @@
/*!
- * \fn int dig_isle_set_box (struct Plus_head *plus, plus_t isle, BOUND_BOX *Box )
- *
- * \brief Set isle bound box
- *
- * \return 1
+ * \brief Set isle bounding box
*
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer to Plus_head structure
* \param[in] isle isle id
- * \param[in] Box bound box structure
+ * \param[in] Box bounding box
+ *
+ * \return 1
*/
int
dig_isle_set_box (struct Plus_head *plus, plus_t isle, BOUND_BOX *Box ) {
@@ -704,16 +669,14 @@
}
/*!
- * \fn int dig_del_isle (struct Plus_head *plus, int isle )
+ * \brief Delete island from Plus_head structure
*
- * \brief Delete island from topology.
- *
* Reset references to it in lines and area outside.
*
- * \return 1
- *
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer to Plus_head structure
* \param[in] isle isle id
+ *
+ * \return 1
*/
int
dig_del_isle (struct Plus_head *plus, int isle ) {
@@ -738,7 +701,7 @@
G_debug (3, " area outside isle = %d", Isle->area);
if ( Isle->area > 0 ) {
if ( plus->Area[Isle->area] == NULL ) {
- G_fatal_error (_("Attempt to delete isle [%d] info from dead area [%d]"), isle, Isle->area );
+ G_fatal_error (_("Attempt to delete isle %d info from dead area %d"), isle, Isle->area );
} else {
dig_area_del_isle (plus, Isle->area, isle);
}
Modified: grass/trunk/lib/vector/diglib/plus_line.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_line.c 2008-03-25 12:30:46 UTC (rev 30729)
+++ grass/trunk/lib/vector/diglib/plus_line.c 2008-03-25 16:50:06 UTC (rev 30730)
@@ -1,50 +1,31 @@
/**
* \file plus_line.c
*
- * \brief Lower level functions for reading/writing/manipulating vectors.
+ * \brief Vector library - update topo for lines (lower level functions)
*
+ * Lower level functions for reading/writing/manipulating vectors.
+ *
* This program is free software under the GNU General Public License
* (>=v2). Read the file COPYING that comes with GRASS for details.
*
* \author CERL (probably Dave Gerdes), Radim Blazek
*
- * \date 2001-2006
+ * \date 2001-2008
*/
-/*
-* $Id$
-*
-****************************************************************************
-*
-* MODULE: Vector library
-*
-* AUTHOR(S): Original author CERL, probably Dave Gerdes.
-* Update to GRASS 5.7 Radim Blazek.
-*
-* PURPOSE: Lower level functions for reading/writing/manipulating vectors.
-*
-* COPYRIGHT: (C) 2001 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
#include <stdlib.h>
#include <grass/Vect.h>
/*!
- * \fn int dig_add_line (struct Plus_head *plus, int type, struct line_pnts *Points, long offset)
+ * \brief Add new line to Plus_head structure.
*
- * \brief Add new line to plus 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
*
* \return -1 on error
- * \return number of line
- *
- * \param[in,out] plus Plus_head structure
- * \param[in] type line type
- * \param[in] Points container used to store line points within
- * \param[in] offset a given offset
+ * \return line id
*/
int
dig_add_line (struct Plus_head *plus, int type, struct line_pnts *Points, long offset) {
@@ -137,20 +118,19 @@
}
/*!
- * \fn int dig_del_line (struct Plus_head *plus, int line)
+ * \brief Delete line from Plus_head structure.
*
- * \brief Delete line from topology.
- *
- * Doesn't update area/isle references (dig_del_area()/dig_del_isle()) must be
- * run before the line is deleted if the ** line is part of such
+ * Doesn't update area/isle references (dig_del_area() or dig_del_isle()) must be
+ * run before the line is deleted if the line is part of such
* structure). Update is info about line in nodes. If this line is
* last in node then node is deleted.
*
+ * \param[in,out] plus pointer to Plus_head structure
+ * \param[in] line line id
+ *
* \return -1 on error
* \return 0 OK
*
- * \param[in,out] plus Plus_head structure
- * \param[in] line line id to delete
*/
int
dig_del_line (struct Plus_head *plus, int line)
@@ -213,17 +193,15 @@
}
/*!
- * \fn plus_t dig_line_get_area (struct Plus_head *plus, plus_t line, int side)
- *
* \brief Get area number on line side.
*
+ * \param[in] plus pointer Plus_head structure
+ * \param[in] line line id
+ * \param[in] side side id (GV_LEFT || GV_RIGHT)
+ *
* \return area number
* \return 0 no area
* \return -1 on error
- *
- * \param[in] plus Plus_head structure
- * \param[in] line line id
- * \param[in] side side id (GV_LEFT || GV_RIGHT)
*/
plus_t
dig_line_get_area (struct Plus_head *plus, plus_t line, int side) {
@@ -246,16 +224,14 @@
}
/*!
- * \fn int dig_line_set_area (struct Plus_head *plus, plus_t line, int side, plus_t area )
- *
* \brief Set area number on line side
*
- * \return always 1
- *
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer Plus_head structure
* \param[in] line line id
* \param[in] side side id (GV_LEFT || GV_RIGHT)
* \param[in] area area id
+ *
+ * \return 1
*/
int
dig_line_set_area (struct Plus_head *plus, plus_t line, int side, plus_t area ) {
@@ -269,16 +245,14 @@
}
/*!
- * \fn int dig_line_set_box (struct Plus_head *plus, plus_t line, BOUND_BOX *Box )
+ * \brief Set line bounding box
*
- * \brief Set line bound box
- *
- * \return always 1
- *
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer Plus_head structure
* \param[in] line line id
- * \param[in] Box bound box structure
-*/
+ * \param[in] Box bounding box
+ *
+ * \return 1
+ */
int
dig_line_set_box (struct Plus_head *plus, plus_t line, BOUND_BOX *Box ) {
P_LINE *Line;
@@ -296,16 +270,14 @@
}
/*!
- * \fn int dig_line_get_box (struct Plus_head *plus, plus_t line, BOUND_BOX *Box )
- *
- * \brief Get line bound box saved in topo
- *
- * \return always 1
+ * \brief Get line bounding box saved in topo
*
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer Plus_head structure
* \param[in] line line id
- * \param[in,out] Box bound box structure
-*/
+ * \param[in,out] Box bounding box
+ *
+ * \return 1
+ */
int
dig_line_get_box (struct Plus_head *plus, plus_t line, BOUND_BOX *Box ) {
P_LINE *Line;
Modified: grass/trunk/lib/vector/diglib/plus_node.c
===================================================================
--- grass/trunk/lib/vector/diglib/plus_node.c 2008-03-25 12:30:46 UTC (rev 30729)
+++ grass/trunk/lib/vector/diglib/plus_node.c 2008-03-25 16:50:06 UTC (rev 30730)
@@ -1,8 +1,10 @@
/**
* \file plus_node.c
*
- * \brief Lower level functions for reading/writing/manipulating vectors.
+ * \brief Vector library - update topo for nodes (lower level functions)
*
+ * Lower level functions for reading/writing/manipulating vectors.
+ *
* This program is free software under the GNU General Public License
* (>=v2). Read the file COPYING that comes with GRASS for details.
*
@@ -10,25 +12,7 @@
*
* \date 2001-2006
*/
-/*
-* $Id$
-*
-****************************************************************************
-*
-* MODULE: Vector library
-*
-* AUTHOR(S): Original author CERL, probably Dave Gerdes.
-* Update to GRASS 5.7 Radim Blazek.
-*
-* PURPOSE: Lower level functions for reading/writing/manipulating vectors.
-*
-* COPYRIGHT: (C) 2001 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
+
#include <stdlib.h>
#include <math.h>
#include <grass/Vect.h>
@@ -37,23 +21,21 @@
static double dist_squared (double, double, double, double);
/*!
- * \fn int dig_node_add_line ( struct Plus_head *plus, int nodeid, int lineid, struct line_pnts *points, int type)
+ * \brief Add line info to node
*
- * \brief Add 'line' info to 'node'
- *
* Line will be negative if END node
*
* 'node' must of course already exist space will be alloced to add 'line' to array
*
- * \return -1 on error
- * \return 0 line not added (degenerate)
- * \return new number of lines in node
- *
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer to Plus_head structure
* \param[in] nodeid node id
* \param[in] lineid line id
- * \param[in] points container used to store line points within
+ * \param[in] points line geometry
* \param[in] type line type
+ *
+ * \return -1 on error
+ * \return 0 line not added (degenerate)
+ * \return new number of lines in node
*/
int
dig_node_add_line ( struct Plus_head *plus, int nodeid, int lineid,
@@ -103,23 +85,21 @@
}
node->n_lines++;
-#ifdef GDEBUG
+
G_debug (3, "dig_node_add_line(): line %d added position %d n_lines: %d angle %f", lineid, i, node->n_lines, angle);
-#endif
+
return ((int) node->n_lines);
}
/*!
- * \fn int dig_add_node ( struct Plus_head *plus, double x, double y, double z)
- *
* \brief Add new node to plus structure
*
+ * \param[in] plus pointer to Plus_head structure
+ * \param[in] x,y,z coordinates
+ *
* \return -1 on error
* \return number of node
- *
- * \param[in] plus Plus_head structure
- * \param[in] x,y,z coordinates
*/
int
dig_add_node ( struct Plus_head *plus, double x, double y, double z) {
@@ -154,16 +134,14 @@
}
/*!
- * \fn int dig_which_node ( struct Plus_head *plus, double x, double y, double thresh)
- *
* \brief Return actual index into node arrays of the first set of matching coordinates
*
+ * \param[in] plus pointer to Plus_head structure
+ * \param[in] x,y coordinates
+ * \param[in] thresh threshold value
+ *
* \return node index
* \return -1 if no node found
- *
- * \param[in] plus Plus_head structure
- * \param[in] x,y coordinates
- * \param[in] thresh given threshold value
*/
int
dig_which_node ( struct Plus_head *plus, double x, double y, double thresh) {
@@ -210,19 +188,17 @@
} /* which_node () */
/*!
- * \fn float dig_node_line_angle ( struct Plus_head *plus, int nodeid, int lineid )
- *
* \brief Return line angle
*
- * Lines is specified by line ID in topology, NOT by order number.
- * Negative ID if looking for line end point.
+ * Lines is specified by line id in topology, NOT by order number.
+ * Negative id if looking for line end point.
*
- * \return line angle <-PI,PI>
- * \return 0 not reached
- *
- * \param[in] plus Plus_head structure
+ * \param[in] plus pointer to Plus_head structure
* \param[in] nodeid node id
* \param[in] lineid line id
+ *
+ * \return line angle <-PI,PI>
+ * \return 0 not reached
*/
float
dig_node_line_angle ( struct Plus_head *plus, int nodeid, int lineid )
@@ -242,7 +218,7 @@
}
G_fatal_error (_("Attempt to read line angle for the line which is not connected to the node: "
- "node = [%d] line = [%d]"), nodeid, lineid);
+ "node %d, line %d"), nodeid, lineid);
return 0.0; /* not reached */
}
Modified: grass/trunk/lib/vector/diglib/type.c
===================================================================
--- grass/trunk/lib/vector/diglib/type.c 2008-03-25 12:30:46 UTC (rev 30729)
+++ grass/trunk/lib/vector/diglib/type.c 2008-03-25 16:50:06 UTC (rev 30730)
@@ -1,26 +1,27 @@
-/****************************************************************************
-*
-* MODULE: Vector library
-*
-* AUTHOR(S): Radim Blazek
-*
-* PURPOSE: Higher level functions for reading/writing/manipulating vectors.
-*
-* COPYRIGHT: (C) 2001 by the GRASS Development Team
-*
-* This program is free software under the GNU General Public
-* License (>=v2). Read the file COPYING that comes with GRASS
-* for details.
-*
-*****************************************************************************/
+/**
+ * \file diglib/type.c
+ *
+ * \brief Vector library - feature type conversion (lower level functions)
+ *
+ * Lower level functions for reading/writing/manipulating vectors.
+ *
+ * This program is free software under the GNU General Public License
+ * (>=v2). Read the file COPYING that comes with GRASS for details.
+ *
+ * \author Radim Blazek
+ *
+ * \date 2001
+ */
+
#include <grass/gis.h>
#include <grass/Vect.h>
/*!
- \fn int dig_type_to_store (int type)
- \brief convert type to store type
- \return store type
- \param type
+ \brief Convert type to store type
+
+ \param type feature type
+
+ \return store type
*/
int
dig_type_to_store (int type)
@@ -48,10 +49,11 @@
}
/*!
- \fn int Vect_type_from_store (int type)
- \brief convert type from store type
- \return store type
- \param type
+ \brief Convert type from store type
+
+ \param type feature store type
+
+ \return type
*/
int
dig_type_from_store (int stype)
@@ -77,4 +79,3 @@
return 0;
}
}
-
More information about the grass-commit
mailing list