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++) {
116 Tot_mem += (np *
sizeof(
Point3));
127 Tot_mem += (np *
sizeof(
Point2));
131 for (i = 0; i < np; i++) {
133 gln->
p3[i][
X] = points->
x[i];
134 gln->
p3[i][
Y] = points->
y[i];
135 gln->
p3[i][
Z] = points->
z[i];
138 gln->
p2[i][
X] = points->
x[i];
139 gln->
p2[i][
Y] = points->
y[i];
144 vect[0][
X] = (float)(gln->
p3[0][
X] - gln->
p3[1][
X]);
145 vect[0][
Y] = (float)(gln->
p3[0][
Y] - gln->
p3[1][
Y]);
146 vect[0][
Z] = (float)(gln->
p3[0][
Z] - gln->
p3[1][
Z]);
147 vect[1][
X] = (float)(gln->
p3[2][
X] - gln->
p3[1][
X]);
148 vect[1][
Y] = (float)(gln->
p3[2][
Y] - gln->
p3[1][
Y]);
149 vect[1][
Z] = (float)(gln->
p3[2][
Z] - gln->
p3[1][
Z]);
167 G_debug(3,
"%d areas loaded", nareas);
170 G_debug(3,
"Reading vector lines ...");
172 G_debug(3,
"line type = %d", type);
197 Tot_mem += (np *
sizeof(
Point3));
208 Tot_mem += (np *
sizeof(
Point2));
212 for (i = 0; i < np; i++) {
214 gln->
p3[i][
X] = points->
x[i];
215 gln->
p3[i][
Y] = points->
y[i];
216 gln->
p3[i][
Z] = points->
z[i];
219 gln->
p2[i][
X] = points->
x[i];
220 gln->
p2[i][
Y] = points->
y[i];
225 vect[0][
X] = (float)(gln->
p3[0][
X] - gln->
p3[1][
X]);
226 vect[0][
Y] = (float)(gln->
p3[0][
Y] - gln->
p3[1][
Y]);
227 vect[0][
Z] = (float)(gln->
p3[0][
Z] - gln->
p3[1][
Z]);
228 vect[1][
X] = (float)(gln->
p3[2][
X] - gln->
p3[1][
X]);
229 vect[1][
Y] = (float)(gln->
p3[2][
Y] - gln->
p3[1][
Y]);
230 vect[1][
Z] = (float)(gln->
p3[2][
Z] - gln->
p3[1][
Z]);
260 G_debug(3,
"%d lines loaded", nl);
275 _(
"No features from vector map <%s> fall within current region"),
280 G_message(
_(
"Vector map <%s> loaded (%d features)"),
287 G_debug(3,
"Total vect memory = %d Kbytes", Tot_mem / 1000);
300 G_debug(5,
"sub_Vectmem(): minus=%d", minus);
326 int nvals, cat, nlines, nskipped;
350 G_warning(
_(
"Database connection not defined for layer %d"),
359 G_message(
_(
"Loading thematic vector layer <%s>..."),
361 nlines = nskipped = 0;
362 for (gvt = gv->
lines; gvt; gvt = gvt->
next) {
384 G_warning(
_(
"No color rule defined for category %d"), cat);
401 G_warning(
_(
"Invalid color definition (%s)"), str);
425 _(
"%d features without category. "
426 "Unable to determine color rules for features without category."),
int G_str_to_color(const char *, int *, int *, int *)
Parse color string and set red,green,blue.
const char * db_get_value_string(dbValue *)
Get string value.
int db_select_value(dbDriver *, const char *, const char *, int, const char *, dbValue *)
Select one (first) value from table/column for key/id.
dbDriver * db_start_driver_open_database(const char *, const char *)
Open driver/database connection.
int db_get_value_int(dbValue *)
Get integer value.
const char * G_find_vector2(const char *, const char *)
Find a vector map (look but don't touch)
void G_zero(void *, int)
Zero out a buffer, buf, of length i.
void G_free(void *)
Free allocated memory.
void void void void G_fatal_error(const char *,...) __attribute__((format(printf
void G_warning(const char *,...) __attribute__((format(printf
void G_get_set_window(struct Cell_head *)
Get the current working window (region)
char * G_fully_qualified_name(const char *, const char *)
Get fully qualified element name.
void G_message(const char *,...) __attribute__((format(printf
int G_debug(int, const char *,...) __attribute__((format(printf
void GS_v3cross(float *, float *, float *)
Get the cross product v3 = v1 cross v2.
int Rast_get_c_color(const CELL *, int *, int *, int *, struct Colors *)
Gets color from raster map (CELL)
plus_t Vect_get_num_areas(struct Map_info *)
Get number of areas in vector map.
int Vect_reset_cats(struct line_cats *)
Reset category structure to make sure cats structure is clean to be re-used.
int Vect_cat_get(const struct line_cats *, int, int *)
Get first found category of given field.
int Vect_set_constraint_region(struct Map_info *, double, double, double, double, double, double)
Set constraint region.
int Vect_get_area_points(struct Map_info *, int, struct line_pnts *)
Returns polygon array of points (outer ring) of given area.
int Vect_close(struct Map_info *)
Close vector map.
int Vect_open_old(struct Map_info *, const char *, const char *)
Open existing vector map for reading.
struct field_info * Vect_get_field(struct Map_info *, int)
Get information about link to database (by layer number)
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
int Vect_read_next_line(struct Map_info *, struct line_pnts *, struct line_cats *)
Read next vector feature.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
int Vect_set_open_level(int)
Predetermine level at which a vector map will be opened for reading.
int Vect_is_3d(struct Map_info *)
Check if vector map is 3D.
#define PORT_DOUBLE_MAX
Limits for portable types.
const struct driver * driver
geoline * Gv_load_vect(const char *grassname, int *nlines)
Load vector map to memory.
int Gv_load_vect_thematic(geovect *gv, struct Colors *colors)
Load styles for geolines based on thematic mapping.
void sub_Vectmem(int minus)
Tracking memory.
2D/3D raster map header (used also for region)
double north
Extent coordinates (north)
double east
Extent coordinates (east)
double top
Extent coordinates (top) - 3D data.
double south
Extent coordinates (south)
double west
Extent coordinates (west)
Layer (old: field) information.
char * table
Name of DB table.
char * driver
Name of DB driver ('sqlite', 'dbf', ...)
char * key
Name of key column (usually 'cat')
gvstyle_thematic * tstyle
int n_cats
Number of categories attached to element.
Feature geometry info - coordinates.
double * y
Array of Y coordinates.
double * x
Array of X coordinates.
int n_points
Number of points.
double * z
Array of Z coordinates.