6#include <grass/lidar.h>
244 for (i = 0; i < npoints; i++) {
261 int type, npoints = 0;
262 double xmin = 0, xmax = 0, ymin = 0, ymax = 0;
282 if (points->
z !=
NULL)
312 *dist =
sqrt(((xmax - xmin) * (ymax - ymin)) / npoints);
314 *
dens = npoints / ((xmax - xmin) * (ymax - ymin));
355 if (points->
z !=
NULL)
363 if (npoints >=
pippo) {
370 obs[npoints - 1].coordX =
x;
371 obs[npoints - 1].coordY = y;
372 obs[npoints - 1].coordZ = z;
373 obs[npoints - 1].lineID =
377 obs[npoints - 1].cat =
cat;
444 if (npoints >=
pippo) {
452 obs[npoints - 1].coordX =
x;
453 obs[npoints - 1].coordY = y;
454 obs[npoints - 1].coordZ = z;
542 int ncols,
col, nrows, row;
550 for (row = 0; row < nrows; row++) {
589 "select ID, X, Y, sum(Interp) from %s group by ID, X, Y",
#define DB_SQL_TYPE_INTEGER
#define DB_SQL_TYPE_DOUBLE_PRECISION
dbColumn * db_get_table_column(dbTable *, int)
Returns column structure for given table and column number.
double db_get_value_double(dbValue *)
Get double precision value.
int db_sqltype_to_Ctype(int)
Get C data type based on given SQL data type.
dbValue * db_get_column_value(dbColumn *)
Returns column value for given column structure.
int db_get_column_sqltype(dbColumn *)
Returns column sqltype for column.
void db_set_column_sqltype(dbColumn *, int)
Define column sqltype for column.
int db_set_table_description(dbTable *, const char *)
Set the description of the table.
void db_zero_string(dbString *)
Zero string.
dbTable * db_alloc_table(int)
Allocate a table with a specific number of columns.
dbTable * db_get_cursor_table(dbCursor *)
Get table allocated by cursor.
int db_set_table_name(dbTable *, const char *)
Set the name of the table.
int db_execute_immediate(dbDriver *, dbString *)
Execute SQL statements.
void db_init_string(dbString *)
Initialize dbString.
int db_open_select_cursor(dbDriver *, dbString *, dbCursor *, int)
Open select cursor.
int db_set_column_name(dbColumn *, const char *)
Set column name.
int db_append_string(dbString *, const char *)
Append string to dbString.
int db_create_table(dbDriver *, dbTable *)
Create table.
int db_fetch(dbCursor *, int, int *)
Fetch data from open cursor.
void G_percent(long, long, int)
Print percent complete messages.
void G_warning(const char *,...) __attribute__((format(printf
void G_get_set_window(struct Cell_head *)
Get the current working window (region)
#define G_incr_void_ptr(ptr, size)
int G_debug(int, const char *,...) __attribute__((format(printf
void G_get_window(struct Cell_head *)
Get the current region.
void Rast_set_d_null_value(DCELL *, int)
To set a number of DCELL raster values to NULL.
void Rast_set_d_value(void *, DCELL, RASTER_MAP_TYPE)
Places a DCELL raster value.
size_t Rast_cell_size(RASTER_MAP_TYPE)
Returns size of a raster cell in bytes.
void Rast_put_d_row(int, const DCELL *)
Writes the next row for dcell file (DCELL version)
int Rast_window_cols(void)
Number of columns in active window.
void * Rast_allocate_buf(RASTER_MAP_TYPE)
Allocate memory for a raster map of given type.
int Rast_window_rows(void)
Number of rows in active window.
#define Rast_is_d_null_value(dcellVal)
double Rast_row_to_northing(double, const struct Cell_head *)
Row to northing.
double Rast_col_to_easting(double, const struct Cell_head *)
Column to easting.
int Segment_get(SEGMENT *, void *, off_t, off_t)
Get value from segment file.
void Vect_destroy_line_struct(struct line_pnts *)
Frees all memory associated with a line_pnts structure, including the structure itself.
int Vect_reset_cats(struct line_cats *)
Reset category structure to make sure cats structure is clean to be re-used.
int Vect_region_box(const struct Cell_head *, struct bound_box *)
Copy region window to bounding box.
int Vect_cat_set(struct line_cats *, int, int)
Add new field/cat to category structure if doesn't exist yet.
int Vect_cat_get(const struct line_cats *, int, int *)
Get first found category of given field.
void Vect_destroy_cats_struct(struct line_cats *)
Frees all memory associated with line_cats structure, including the struct itself.
int Vect_copy_xyz_to_pnts(struct line_pnts *, const double *, const double *, const double *, int)
Copy points from array to line_pnts structure.
struct line_cats * Vect_new_cats_struct(void)
Creates and initializes line_cats structure.
off_t Vect_write_line(struct Map_info *, int, const struct line_pnts *, const struct line_cats *)
Writes a new feature.
int Vect_rewind(struct Map_info *)
Rewind vector map to cause reads to start at beginning.
int Vect_read_next_line(struct Map_info *, struct line_pnts *, struct line_cats *)
Read next vector feature.
int Vect_point_in_box(double, double, double, const struct bound_box *)
Tests if point is in 3D box.
struct line_pnts * Vect_new_line_struct(void)
Creates and initializes a line_pnts structure.
#define GV_POINT
Feature types used in memory on run time (may change)
#define UNUSED
A macro for an attribute, if attached to a variable, indicating that the variable is not used.
float mean(IClass_statistics *statistics, int band)
Helper function for computing mean.
2D/3D raster map header (used also for region)
int * cat
Array of categories.
Feature geometry info - coordinates.
double * y
Array of Y coordinates.
double * x
Array of X coordinates.
double * z
Array of Z coordinates.
void P_Aux_to_Vector(struct Map_info *Map, struct Map_info *Out, dbDriver *driver, char *tab_name)
void P_Aux_to_Raster(double **matrix, int fd)
double P_Mean_Calc(struct Cell_head *Elaboration, struct Point *obs, int npoints)
double P_estimate_splinestep(struct Map_info *Map, double *dens, double *dist)
struct Point * P_Read_Vector_Region_Map(struct Map_info *Map, struct Cell_head *Elaboration, int *num_points, int dim_vect, int layer)
int P_get_edge(int interpolator, struct Reg_dimens *dim, double pe, double pn)
void P_zero_dim(struct Reg_dimens *dim)
int P_get_BandWidth(int interpolator, int nsplines)
struct Point * P_Read_Raster_Region_Map(SEGMENT *in_seg, struct Cell_head *Elaboration, struct Cell_head *Original, int *num_points, int dim_vect)
int P_Create_Aux2_Table(dbDriver *driver, char *tab_name)
int P_set_dim(struct Reg_dimens *dim, double pe, double pn, int *nsplx, int *nsply)
int P_Drop_Aux_Table(dbDriver *driver, char *tab_name)
int P_Create_Aux4_Table(dbDriver *driver, char *tab_name)
int P_set_regions(struct Cell_head *Elaboration, struct bound_box *General, struct bound_box *Overlap, struct Reg_dimens dim, int type)