33 static int Tot_mem = 0;
53 int np, i, n, nareas, nl = 0, area, type, is3d;
60 G_warning(
_(
"Vector map <%s> not found"), grassname);
94 G_debug(3,
"Reading vector areas (nareas = %d)", n);
95 for (area = 1; area <= n; area++) {
115 Tot_mem += (np *
sizeof(
Point3));
125 Tot_mem += (np *
sizeof(
Point2));
129 for (i = 0; i < np; i++) {
131 gln->
p3[i][
X] = points->
x[i];
132 gln->
p3[i][
Y] = points->
y[i];
133 gln->
p3[i][
Z] = points->
z[i];
136 gln->
p2[i][
X] = points->
x[i];
137 gln->
p2[i][
Y] = points->
y[i];
142 vect[0][
X] = (float)(gln->
p3[0][
X] - gln->
p3[1][
X]);
143 vect[0][
Y] = (float)(gln->
p3[0][
Y] - gln->
p3[1][
Y]);
144 vect[0][
Z] = (float)(gln->
p3[0][
Z] - gln->
p3[1][
Z]);
145 vect[1][
X] = (float)(gln->
p3[2][
X] - gln->
p3[1][
X]);
146 vect[1][
Y] = (float)(gln->
p3[2][
Y] - gln->
p3[1][
Y]);
147 vect[1][
Z] = (float)(gln->
p3[2][
Z] - gln->
p3[1][
Z]);
166 G_debug(3,
"%d areas loaded", nareas);
169 G_debug(3,
"Reading vector lines ...");
171 G_debug(3,
"line type = %d", type);
194 Tot_mem += (np *
sizeof(
Point3));
204 Tot_mem += (np *
sizeof(
Point2));
208 for (i = 0; i < np; i++) {
210 gln->
p3[i][
X] = points->
x[i];
211 gln->
p3[i][
Y] = points->
y[i];
212 gln->
p3[i][
Z] = points->
z[i];
215 gln->
p2[i][
X] = points->
x[i];
216 gln->
p2[i][
Y] = points->
y[i];
221 vect[0][
X] = (float)(gln->
p3[0][
X] - gln->
p3[1][
X]);
222 vect[0][
Y] = (float)(gln->
p3[0][
Y] - gln->
p3[1][
Y]);
223 vect[0][
Z] = (float)(gln->
p3[0][
Z] - gln->
p3[1][
Z]);
224 vect[1][
X] = (float)(gln->
p3[2][
X] - gln->
p3[1][
X]);
225 vect[1][
Y] = (float)(gln->
p3[2][
Y] - gln->
p3[1][
Y]);
226 vect[1][
Z] = (float)(gln->
p3[2][
Z] - gln->
p3[1][
Z]);
255 G_debug(3,
"%d lines loaded", nl);
269 G_warning(
_(
"No features from vector map <%s> fall within current region"),
274 G_message(
_(
"Vector map <%s> loaded (%d features)"),
281 G_debug(3,
"Total vect memory = %d Kbytes", Tot_mem / 1000);
294 G_debug(5,
"sub_Vectmem(): minus=%d", minus);
320 int nvals, cat, nlines, nskipped;
344 G_warning(
_(
"Database connection not defined for layer %d"),
353 G_message(
_(
"Loading thematic vector layer <%s>..."),
355 nlines = nskipped = 0;
356 for(gvt = gv->
lines; gvt; gvt = gvt->
next) {
377 G_warning(
_(
"No color rule defined for category %d"), cat);
415 "Unable to determine color rules for features without category."),
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
const char * G_find_vector2(const char *, const char *)
Find a vector map (look but don't touch)
2D/3D raster map header (used also for region)
double west
Extent coordinates (west)
int n_points
Number of points.
int G_str_to_color(const char *, int *, int *, int *)
Parse color string and set red,green,blue.
gvstyle_thematic * tstyle
char * table
Name of DB table.
void G_free(void *)
Free allocated memory.
int db_get_value_int(dbValue *)
Get integer value.
dbDriver * db_start_driver_open_database(const char *, const char *)
Open driver/database connection.
int Vect_close(struct Map_info *)
Close vector map.
geoline * Gv_load_vect(const char *grassname, int *nlines)
Load vector map to memory.
struct field_info * Vect_get_field(const struct Map_info *, int)
Get information about link to database (by layer number)
int Vect_set_constraint_region(struct Map_info *, double, double, double, double, double, double)
Set constraint region.
void GS_v3cross(float *, float *, float *)
Get the cross product v3 = v1 cross v2.
double top
Extent coordinates (top) - 3D data.
Layer (old: field) information.
void G_message(const char *,...) __attribute__((format(printf
double * x
Array of X coordinates.
Feature geometry info - coordinates.
double north
Extent coordinates (north)
char * G_fully_qualified_name(const char *, const char *)
Get fully qualified element name.
int db_select_value(dbDriver *, const char *, const char *, int, const char *, dbValue *)
Select one (first) value from table/column for key/id.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
double south
Extent coordinates (south)
int n_cats
Number of categories attached to element.
const struct driver * driver
plus_t Vect_get_num_areas(const struct Map_info *)
Get number of areas in vector map.
void G_get_set_window(struct Cell_head *)
Get the current working window (region)
int Gv_load_vect_thematic(geovect *gv, struct Colors *colors)
Load styles for geolines based on thematic mapping.
int Vect_reset_cats(struct line_cats *)
Reset category structure to make sure cats structure is clean to be re-used.
int Vect_set_open_level(int)
Predetermine level at which a vector map will be opened for reading.
#define PORT_DOUBLE_MAX
Limits for portable types.
const char * db_get_value_string(dbValue *)
Get string value.
double * y
Array of Y coordinates.
char * driver
Name of DB driver ('sqlite', 'dbf', ...)
int Rast_get_c_color(const CELL *, int *, int *, int *, struct Colors *)
Gets color from raster map (CELL)
int Vect_is_3d(const struct Map_info *)
Check if vector map is 3D.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
void G_warning(const char *,...) __attribute__((format(printf
double east
Extent coordinates (east)
double * z
Array of Z coordinates.
void sub_Vectmem(int minus)
Tracking memory.
int Vect_open_old(struct Map_info *, const char *, const char *)
Open existing vector map for reading.
int Vect_read_next_line(const struct Map_info *, struct line_pnts *, struct line_cats *)
Read next vector feature.
int Vect_get_area_points(const struct Map_info *, int, struct line_pnts *)
Returns polygon array of points (outer ring) of given area.
int G_debug(int, const char *,...) __attribute__((format(printf
int Vect_cat_get(const struct line_cats *, int, int *)
Get first found category of given field.
char * key
Name of key column (usually 'cat')