1
#include <grass/vector.h>
2
#include <grass/dbmi.h>
7
/* define codes for characteristics of relation between two nearest features */
8
#define CAT 1 /* category of nearest feature */
9
#define FROM_X 2 /* x coordinate of nearest point on 'from' feature */
10
#define FROM_Y 3 /* y coordinate of nearest point on 'from' feature */
11
#define TO_X 4 /* x coordinate of nearest point on 'to' feature */
12
#define TO_Y 5 /* y coordinate of nearest point on 'to' feature */
13
#define FROM_ALONG 6 /* distance to nearest point on 'from' along linear feature */
14
#define TO_ALONG 7 /* distance to nearest point on 'to' along linear feature */
15
#define DIST 8 /* minimum distance to nearest feature */
16
#define TO_ANGLE 9 /* angle of linear feature in nearest point */
17
#define TO_ATTR 10 /* attribute of nearest feature */
18
#define END 11 /* end of list */
20
/* Structure to store info about nearest feature for each category */
23
int from_cat; /* category (from) */
24
int count; /* number of features already found */
25
int to_cat; /* category (to) */
26
double from_x, from_y, from_z; /* coordinates of nearest 'from' point */
27
double to_x, to_y, to_z; /* coordinates of nearest 'to' point */
28
double from_along, to_along; /* distance along a linear feature to the nearest point */
29
double from_angle; /* angle of linear feature in nearest point */
30
double to_angle; /* angle of linear feature in nearest point */
31
double dist; /* distance to nearest feature */
34
/* Upload and column store */
37
int upload; /* code */
38
char *column; /* column name */
42
typedef int dist_func(const struct line_pnts *, double, double, double, int,
43
double *, double *, double *, double *, double *,
45
extern dist_func *line_distance;
48
int cmp_near(const void *, const void *);
49
int cmp_near_to(const void *, const void *);
50
int cmp_exist(const void *, const void *);
53
int get_line_box(const struct line_pnts *Points,
54
struct bound_box *box);
55
int line2line(struct line_pnts *FPoints, int ftype,
56
struct line_pnts *TPoints, int ttype,
57
double *fx, double *fy, double *fz,
58
double *falong, double *fangle,
59
double *tx, double *ty, double *tz,
60
double *talong, double *tangle,
63
int line2area(const struct Map_info *To,
64
struct line_pnts *Points, int type,
65
int area, const struct bound_box *abox,
66
double *fx, double *fy, double *fz,
67
double *falong, double *fangle,
68
double *tx, double *ty, double *tz,
69
double *talong, double *tangle,
74
int print_upload(NEAR *, UPLOAD *, int, dbCatValArray *, dbCatVal *, char *);