Skip to content

Commit

Permalink
Vlib: alloc rect boundaries
Browse files Browse the repository at this point in the history
git-svn-id: https://svn.osgeo.org/grass/grass/trunk@51851 15284696-431f-4ddb-bdfa-cd5b030d7da7
  • Loading branch information
metzm committed May 28, 2012
1 parent 34d6221 commit 1a78f0b
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
8 changes: 7 additions & 1 deletion lib/vector/Vlib/break_polygons.c
Original file line number Diff line number Diff line change
Expand Up @@ -113,12 +113,18 @@ void Vect_break_polygons_file(struct Map_info *Map, int type, struct Map_info *E
struct RTree *RTree;
int npoints, nallpoints, nmarks;
XPNT2 XPnt;
struct RTree_Rect rect;
double dx, dy, a1 = 0, a2 = 0;
int closed, last_point;
char cross;
int fd, xpntfd;
char *filename;
static struct RTree_Rect rect;
static int rect_init = 0;

if (!rect_init) {
rect.boundary = G_malloc(6 * sizeof(RectReal));
rect_init = 6;
}

G_debug(1, "File-based version of Vect_break_polygons()");

Expand Down
14 changes: 10 additions & 4 deletions lib/vector/Vlib/snap.c
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,6 @@ Vect_snap_lines_list(struct Map_info *Map, const struct ilist *List_lines,
int line, ltype, line_idx;
double thresh2;

struct RTree *RTree;
int rtreefd = -1;
struct RTree_Rect rect;
int point; /* index in points array */
int nanchors, ntosnap; /* number of anchors and number of points to be snapped */
int nsnapped, ncreated; /* number of snapped verices, number of new vertices (on segments) */
Expand All @@ -107,6 +104,16 @@ Vect_snap_lines_list(struct Map_info *Map, const struct ilist *List_lines,
int *Index = NULL; /* indexes of anchors for vertices */
int aindex = 0; /* allocated Index */

struct RTree *RTree;
int rtreefd = -1;
static struct RTree_Rect rect;
static int rect_init = 0;

if (!rect_init) {
rect.boundary = G_malloc(6 * sizeof(RectReal));
rect_init = 6;
}

if (List_lines->n_values < 1)
return;

Expand Down Expand Up @@ -469,7 +476,6 @@ Vect_snap_lines(struct Map_info *Map, int type, double thresh,
struct Map_info *Err)
{
int line, nlines, ltype;

struct ilist *List;

List = Vect_new_list();
Expand Down

0 comments on commit 1a78f0b

Please sign in to comment.