#include <stdlib.h>
#include <grass/Vect.h>
#include <grass/glocale.h>
Go to the source code of this file.
Functions | |
int | dig_build_area_with_line (struct Plus_head *plus, plus_t first_line, int side, plus_t **lines) |
Build topo for area from lines. | |
int | dig_add_area (struct Plus_head *plus, int n_lines, plus_t *lines) |
Allocate space for new area and create boundary info from array. | |
int | dig_area_add_isle (struct Plus_head *plus, int area, int isle) |
Add isle to area if does not exist yet. | |
int | dig_area_del_isle (struct Plus_head *plus, int area, int isle) |
Delete isle from area. | |
int | dig_del_area (struct Plus_head *plus, int area) |
Delete area from Plus_head structure. | |
int | dig_area_set_box (struct Plus_head *plus, plus_t area, BOUND_BOX *Box) |
Set area bounding box. | |
int | dig_angle_next_line (struct Plus_head *plus, plus_t current_line, int side, int type) |
Find number line of next angle to follow an line. | |
int | dig_node_angle_check (struct Plus_head *plus, plus_t line, int type) |
Checks if angles of adjacent lines differ. | |
int | dig_add_isle (struct Plus_head *plus, int n_lines, plus_t *lines) |
Allocate space for new island and create boundary info from array. | |
int | dig_isle_set_box (struct Plus_head *plus, plus_t isle, BOUND_BOX *Box) |
Set isle bounding box. | |
int | dig_del_isle (struct Plus_head *plus, int isle) |
Delete island from Plus_head structure. |
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.
Definition in file plus_area.c.
int dig_add_area | ( | struct Plus_head * | plus, | |
int | n_lines, | |||
plus_t * | lines | |||
) |
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.
[in] | plus | pointer to Plus_head structure |
[in] | n_lines | number of lines |
[in] | lines | array of lines, negative for reverse direction |
-1 on error
Definition at line 161 of file plus_area.c.
References dig_alloc_area(), dig_alloc_areas(), dig_area_alloc_line(), dig_area_set_box(), dig_box_copy(), dig_box_extend(), dig_line_add_updated(), dig_line_get_box(), and dig_spidx_add_area().
Referenced by Vect_build_line_area().
int dig_add_isle | ( | struct Plus_head * | plus, | |
int | n_lines, | |||
plus_t * | lines | |||
) |
Allocate space for new island and create boundary info from array.
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.
[in] | plus | pointer to Plus_head structure |
[in] | n_lines | number of lines |
[in] | lines | array of lines, negative for reverse direction |
-1 on error
Definition at line 610 of file plus_area.c.
References dig_alloc_isle(), dig_alloc_isles(), dig_box_copy(), dig_box_extend(), dig_isle_alloc_line(), dig_isle_set_box(), dig_line_add_updated(), dig_line_get_box(), and dig_spidx_add_isle().
Referenced by Vect_build_line_area().
int dig_angle_next_line | ( | struct Plus_head * | plus, | |
plus_t | current_line, | |||
int | side, | |||
int | type | |||
) |
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).
[in] | plus | pointer to Plus_head structure |
[in] | current_line | current line id, negative if request for node 2 |
[in] | side | side GV_RIGHT or GV_LEFT |
[in] | type | line type (GV_LINE, GV_BOUNDARY or both) |
0 on error or not found
Definition at line 462 of file plus_area.c.
Referenced by dig_build_area_with_line(), dig_node_angle_check(), and V2_delete_line_nat().
int dig_area_add_isle | ( | struct Plus_head * | plus, | |
int | area, | |||
int | isle | |||
) |
Add isle to area if does not exist yet.
[in] | plus | pointer to Plus_head structure |
[in] | area | area id |
[in] | isle | isle id |
Definition at line 241 of file plus_area.c.
References dig_area_alloc_isle().
Referenced by Vect_attach_isle().
int dig_area_del_isle | ( | struct Plus_head * | plus, | |
int | area, | |||
int | isle | |||
) |
Delete isle from area.
[in] | plus | pointer to Plus_head structure |
[in] | area | area id |
[in] | isle | isle id |
Definition at line 278 of file plus_area.c.
Referenced by dig_del_isle().
int dig_area_set_box | ( | struct Plus_head * | plus, | |
plus_t | area, | |||
BOUND_BOX * | Box | |||
) |
Set area bounding box.
[in] | plus | pointer to Plus_head structure |
[in] | area | area id |
[in] | Box | bounding box |
Definition at line 429 of file plus_area.c.
Referenced by dig_add_area().
int dig_build_area_with_line | ( | struct Plus_head * | plus, | |
plus_t | first_line, | |||
int | side, | |||
plus_t ** | lines | |||
) |
Build topo for area from lines.
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:
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) -2: island !!
[in] | plus | pointer to Plus_head structure |
[in] | first_line | line id of first line |
[in] | side | side of line to build area on (GV_LEFT | GV_RIGHT) |
[in] | lines | pointer to array of lines |
0 no area
number of lines
Definition at line 49 of file plus_area.c.
References dig__falloc(), dig__frealloc(), dig_angle_next_line(), dig_node_angle_check(), dig_node_line_angle(), and dig_out_of_memory().
Referenced by Vect_build_line_area().
int dig_del_area | ( | struct Plus_head * | plus, | |
int | area | |||
) |
Delete area from Plus_head structure.
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 old boundaries participating in this area are left without area information even if form new area. Not enabled now: If area is inside other area, area info for islands within deleted area is reset to that area outside. (currently area info of isles is set to 0)
[in] | plus | pointer to Plus_head structure |
[in] | area | area id |
1 on success
Definition at line 329 of file plus_area.c.
References dig_line_add_updated(), and dig_spidx_del_area().
Referenced by V2_delete_line_nat().
int dig_del_isle | ( | struct Plus_head * | plus, | |
int | isle | |||
) |
Delete island from Plus_head structure.
Reset references to it in lines and area outside.
[in] | plus | pointer to Plus_head structure |
[in] | isle | isle id |
Definition at line 722 of file plus_area.c.
References dig_area_del_isle(), dig_line_add_updated(), and dig_spidx_del_isle().
Referenced by V2_delete_line_nat().
int dig_isle_set_box | ( | struct Plus_head * | plus, | |
plus_t | isle, | |||
BOUND_BOX * | Box | |||
) |
Set isle bounding box.
[in] | plus | pointer to Plus_head structure |
[in] | isle | isle id |
[in] | Box | bounding box |
Definition at line 696 of file plus_area.c.
Referenced by dig_add_isle().
int dig_node_angle_check | ( | struct Plus_head * | plus, | |
plus_t | line, | |||
int | type | |||
) |
Checks if angles of adjacent lines differ.
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).
[in] | plus | pointer to Plus_head structure |
[in] | line | current line id, negative if request for node 2 |
[in] | type | line type (GV_LINE, GV_BOUNDARY or both) |
0 angle of a line up or down is identical
Definition at line 554 of file plus_area.c.
References dig_angle_next_line(), and dig_node_line_angle().
Referenced by dig_build_area_with_line().