21 #include <grass/gis.h>
22 #include <grass/site.h>
23 #include <grass/Vect.h>
24 #include <grass/glocale.h>
25 #include <grass/gstypes.h>
54 G_warning(_(
"Raster map <%s> not found"), grassname);
60 for (tp = gp; tp; tp = tp->next) {
65 color = (r & 0xff) | ((g & 0xff) << 8) | ((b & 0xff) << 16);
94 static struct line_pnts *Points =
NULL;
95 static struct line_cats *Cats =
NULL;
96 geopoint *top, *gpt, *prev;
98 struct Cell_head wind;
99 RASTER_MAP_TYPE rtype;
105 *has_z = *has_att = 0;
109 G_warning(_(
"Vector map <%s> not found"), grassname);
122 top = gpt = (geopoint *) G_malloc(
sizeof(geopoint));
129 wind.west, PORT_DOUBLE_MAX, -PORT_DOUBLE_MAX);
145 G_warning(_(
"Unable to read vector map <%s>"),
155 if ((ltype & GV_POINTS)) {
157 gpt->p3[
X] = Points->x[0];
158 gpt->p3[
Y] = Points->y[0];
163 gpt->p3[Z] = Points->z[0];
170 if (Cats->n_cats > 0) {
172 gpt->fattr = Cats->field[0];
174 gpt->highlight_color = gpt->highlight_size =
175 gpt->highlight_marker =
FALSE;
182 gpt->iattr = gpt->fattr;
185 G_debug(3,
"loading vector point %d %f %f -- %d",
186 np, Points->x[0], Points->y[0], Cats->n_cats);
188 gpt->next = (geopoint *) G_malloc(
sizeof(geopoint));
206 G_warning(_(
"No points from vector map <%s> fall within current region"),
211 G_message(_(
"Vector map <%s> loaded (%d points)"),
void G_free(void *buf)
Free allocated memory.
int G_get_set_window(struct Cell_head *window)
Get the current working window.
int Vect_read_next_line(struct Map_info *Map, struct line_pnts *line_p, struct line_cats *line_c)
Read next vector feature (level 1 and 2)
struct line_pnts * Vect_new_line_struct()
Creates and initializes a struct line_pnts.
char * G_find_vector2(const char *name, const char *mapset)
find a vector map (look but don't touch)
int G_read_colors(const char *name, const char *mapset, struct Colors *colors)
read map layer color table
int Gp_set_color(const char *grassname, geopoint *gp)
Set color for point set.
int Vect_set_open_level(int level)
Predetermine level at which a map will be opened for reading.
char * G_find_cell2(const char *name, const char *mapset)
find a raster map (look but don't touch)
void G_message(const char *msg,...)
Print a message to stderr.
int G_get_color(CELL n, int *red, int *grn, int *blu, struct Colors *colors)
Get a category color.
geopoint * Gp_load_sites(const char *grassname, int *nsites, int *has_z, int *has_att)
Load to points to memory.
int Vect_set_constraint_region(struct Map_info *Map, double n, double s, double e, double w, double t, double b)
Set constraint region.
int Vect_open_old(struct Map_info *Map, const char *name, const char *mapset)
Open existing vector for reading.
int Vect_close(struct Map_info *Map)
Close vector data file.
struct line_cats * Vect_new_cats_struct()
Creates and initializes line_cats structure.
G_warning("category support for [%s] in mapset [%s] %s", name, mapset, type)
int G_debug(int level, const char *msg,...)
Print debugging message.
char * G_fully_qualified_name(const char *name, const char *mapset)
fully qualified file name
int G_fatal_error(const char *msg,...)
Print a fatal error message to stderr.