GRASS GIS 7 Programmer's Manual  7.7.svn(2018)-r73786
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
plus_line.c File Reference

Vector library - update topo for lines (lower level functions) More...

#include <sys/types.h>
#include <stdlib.h>
#include <grass/vector.h>
#include <grass/glocale.h>
Include dependency graph for plus_line.c:

Go to the source code of this file.

Functions

int dig_add_line (struct Plus_head *plus, int type, const struct line_pnts *Points, const struct bound_box *box, off_t offset)
 Add new line to Plus_head structure. More...
 
int dig_restore_line (struct Plus_head *plus, int lineid, int type, const struct line_pnts *Points, const struct bound_box *box, off_t offset)
 Restore line in Plus_head structure. More...
 
int dig_del_line (struct Plus_head *plus, int line, double x, double y, double z)
 Delete line from Plus_head structure. More...
 
plus_t dig_line_get_area (struct Plus_head *plus, plus_t line, int side)
 Get area number on line side. More...
 
int dig_line_set_area (struct Plus_head *plus, plus_t line, int side, plus_t area)
 Set area number on line side. More...
 

Detailed Description

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-2008

Definition in file plus_line.c.

Function Documentation

int dig_add_line ( struct Plus_head plus,
int  type,
const struct line_pnts Points,
const struct bound_box box,
off_t  offset 
)

Add new line to Plus_head structure.

Parameters
[in,out]pluspointer to Plus_head structure
typefeature type
Pointsline geometry
boxbounding box
offsetline offset
Returns
-1 on error
line id

Definition at line 136 of file plus_line.c.

References Plus_head::alloc_lines, dig_alloc_lines(), GV_BOUNDARY, GV_FACE, GV_KERNEL, GV_LINE, Plus_head::n_blines, Plus_head::n_clines, Plus_head::n_flines, Plus_head::n_klines, Plus_head::n_lines, Plus_head::n_llines, and Plus_head::n_plines.

Referenced by V2__add_line_to_topo_nat(), V2_write_line_sfa(), and Vect_build_nat().

int dig_del_line ( struct Plus_head plus,
int  line,
double  x,
double  y,
double  z 
)

Delete line from Plus_head structure.

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.

Parameters
[in,out]pluspointer to Plus_head structure
[in]lineline id
[in]x,y,zcoordinates
Returns
-1 on error
0 OK

Definition at line 219 of file plus_line.c.

References _, P_node::angles, dig_free_line(), dig_free_node(), dig_line_add_updated(), dig_node_add_updated(), dig_spidx_del_line(), dig_spidx_del_node(), Plus_head::do_uplist, G_debug(), G_fatal_error(), GV_BOUNDARY, GV_LINE, GV_LINES, Plus_head::Line, P_node::lines, P_topo_l::N1, P_topo_b::N1, P_topo_l::N2, P_topo_b::N2, P_node::n_lines, Plus_head::Node, NULL, P_line::offset, P_line::topo, P_line::type, and Plus_head::uplist.

Referenced by V2__delete_line_from_topo_nat(), V2_delete_line_sfa(), and Vect_remove_small_areas_nat().

plus_t dig_line_get_area ( struct Plus_head plus,
plus_t  line,
int  side 
)

Get area number on line side.

Parameters
[in]pluspointer Plus_head structure
[in]lineline id
[in]sideside id (GV_LEFT || GV_RIGHT)
Returns
area number
0 no area
-1 on error

Definition at line 343 of file plus_line.c.

References G_debug(), GV_BOUNDARY, GV_LEFT, GV_RIGHT, if(), P_topo_b::left, Plus_head::Line, P_topo_b::right, P_line::topo, and P_line::type.

Referenced by Vect_build_line_area().

int dig_line_set_area ( struct Plus_head plus,
plus_t  line,
int  side,
plus_t  area 
)

Set area number on line side.

Parameters
[in]pluspointer Plus_head structure
[in]lineline id
[in]sideside id (GV_LEFT || GV_RIGHT)
[in]areaarea id
Returns
1

Definition at line 384 of file plus_line.c.

References GV_BOUNDARY, GV_LEFT, GV_RIGHT, if(), P_topo_b::left, Plus_head::Line, P_topo_b::right, P_line::topo, and P_line::type.

int dig_restore_line ( struct Plus_head plus,
int  lineid,
int  type,
const struct line_pnts Points,
const struct bound_box box,
off_t  offset 
)

Restore line in Plus_head structure.

Parameters
[in,out]pluspointer to Plus_head structure
typefeature type
Pointsline geometry
boxbounding box
offsetline offset
Returns
-1 on error
line id

Definition at line 192 of file plus_line.c.

References Plus_head::n_lines.

Referenced by V2__add_line_to_topo_nat().