GRASS GIS 7 Programmer's Manual
7.8.3(2020)-exported
|
Go to the documentation of this file.
17 #include <grass/gis.h>
18 #include <grass/ogsf.h>
20 #define FIRST_SITE_ID 21720
22 static geosite *Site_top =
NULL;
36 G_debug(5,
"gp_get_site(%d)",
id);
38 for (gp = Site_top; gp; gp = gp->next) {
39 if (gp->gsite_id ==
id) {
59 G_debug(5,
"gp_get_prev_site(%d)",
id);
61 for (pp = Site_top; pp; pp = pp->next) {
62 if (pp->gsite_id ==
id - 1) {
80 for (i = 0, gp = Site_top; gp; gp = gp->next, i++) ;
82 G_debug(5,
"gp_num_sites(): n=%d", i);
103 for (lp = Site_top; lp->next; lp = lp->next) ;
105 G_debug(5,
" last site id: %d", lp->gsite_id);
120 np = (geosite *) G_malloc(
sizeof(geosite));
124 G_zero(np,
sizeof(geosite));
129 np->gsite_id = lp->gsite_id + 1;
135 np->style = (gvstyle *) G_malloc(
sizeof(gvstyle));
138 G_zero(np->style, sizeof (gvstyle));
139 np->hstyle = (gvstyle *) G_malloc(
sizeof(gvstyle));
142 G_zero(np->hstyle, sizeof (gvstyle));
144 G_debug(5,
"gp_get_new_site id=%d", np->gsite_id);
159 for (gp = Site_top; gp; gp = gp->next) {
161 for (i = 0; i < gp->n_surfs; i++) {
162 if (gp->drape_surf_id[i]) {
164 for (j = i; j < gp->n_surfs - 1; j++) {
165 gp->drape_surf_id[j] = gp->drape_surf_id[j + 1];
168 gp->n_surfs = gp->n_surfs - 1;
193 G_debug(5,
"gp_set_defaults() id=%d", gp->gsite_id);
197 gp->style->color = 0xF0F0F0;
198 gp->style->size = dim / 100.;
199 gp->style->width = 1;
200 gp->style->symbol = ST_X;
201 gp->hstyle->color = 0xFF0000;
202 gp->hstyle->size = dim / 150.;
203 gp->hstyle->symbol = ST_X;
263 G_debug(5,
"gp_free_site(id=%d)", fp->gsite_id);
266 if (fp == Site_top) {
267 if (Site_top->next) {
279 for (gp = Site_top; gp && !found; gp = gp->next) {
282 if (gp->next == fp) {
311 G_free((
void *)fp->filename);
320 for (gpt = fp->points; gpt;) {
336 G_free(fp->tstyle->color_column);
337 G_free(fp->tstyle->symbol_column);
338 G_free(fp->tstyle->size_column);
339 G_free(fp->tstyle->width_column);
356 for (i = 0; i < nsurfs && i < MAX_SURFS; i++) {
357 gp->drape_surf_id[i] = hsurfs[i];
mat_struct * G_matrix_copy(const mat_struct *A)
Copy a matrix.
int gp_init_site(geosite *gp)
Initialize geosite struct.
vec_struct * G_matvect_get_column(mat_struct *mt, int col)
Retrieve a column of the matrix to a vector structure.
geosite * gp_get_new_site(void)
Create new geosite instance and add it to list.
vec_struct * G_matvect_get_row(mat_struct *mt, int row)
Retrieve a row of the matrix to a vector structure.
mat_struct * G_matrix_transpose(mat_struct *mt)
Transpose a matrix.
int G_vector_set(vec_struct *A, int cells, int ldim, vtype vt, int vindx)
Set parameters for vector structure.
int gp_num_sites(void)
Get number of loaded point sets.
geosite * gp_get_prev_site(int id)
Get previous geosite struct from list.
void output(const char *fmt,...)
int gp_free_site(geosite *fp)
Free allocated geosite struct.
geosurf * gs_get_surf(int id)
Get geosurf struct.
vec_struct * G_vector_init(int cells, int ldim, vtype vt)
Initialize a vector structure.
double G_vector_norm_euclid(vec_struct *vc)
Calculates euclidean norm.
mat_struct * G_matrix_add(mat_struct *mt1, mat_struct *mt2)
Adds two matricies.
void gp_delete_site(int id)
Delete point set and remove from list.
int GS_get_longdim(float *dim)
Get largest dimension.
int G_matvect_extract_vector(mat_struct *mt, vtype vt, int indx)
Convert matrix to vector.
double G_matrix_get_element(mat_struct *mt, int rowval, int colval)
Retrieve value of the (i,j)th element.
void G_message(const char *msg,...)
Print a message to stderr.
int G_matrix_LU_solve(const mat_struct *mt1, mat_struct **xmat0, const mat_struct *bmat, mat_type mtype)
Solve a general system A.X = B.
void G_free(void *buf)
Free allocated memory.
int G_matrix_set(mat_struct *A, int rows, int cols, int ldim)
Set parameters for an initialized matrix.
mat_struct * G_matrix_inverse(mat_struct *mt)
Returns the matrix inverse.
void gp_set_drapesurfs(geosite *gp, int hsurfs[], int nsurfs)
Set drape surfaces.
void gp_free_sitemem(geosite *fp)
Free geosite (lower level)
void G_zero(void *buf, int i)
Zero out a buffer, buf, of length i.
mat_struct * G_matrix_scale(mat_struct *mt1, const double c)
Scale a matrix by a scalar value.
int main(int argc, char *argv[])
vec_struct * G_vector_copy(const vec_struct *vc1, int comp_flag)
Returns a vector copied from vc1. Underlying structure is preserved unless DO_COMPACT flag.
geosite * gp_get_last_site(void)
Get last point set.
int G_matvect_retrieve_matrix(vec_struct *vc)
Revert a vector to matrix.
mat_struct * G_matrix_product(mat_struct *mt1, mat_struct *mt2)
Returns product of two matricies.
void G_matrix_print(mat_struct *mt)
Print out a matrix.
void G_matrix_free(mat_struct *mt)
Free up allocated matrix.
mat_struct * G_matrix_init(int rows, int cols, int ldim)
Initialize a matrix structure.
if(!DBFLoadRecord(psDBF, hEntity)) return NULL
mat_struct * G_matrix_subtract(mat_struct *mt1, mat_struct *mt2)
Subtract two matricies.
int G_debug(int level, const char *msg,...)
Print debugging message.
int G_matrix_set_element(mat_struct *mt, int rowval, int colval, double val)
Set the value of the (i, j)th element.
int gp_set_defaults(geosite *gp)
Set default value for geosite struct.
void G_vector_free(vec_struct *v)
Free an allocated vector structure.
void gp_update_drapesurfs(void)
Update drape surfaces.
double G_vector_norm_maxval(vec_struct *vc, int vflag)
Calculates maximum value.
geosite * gp_get_site(int id)
Get geosite struct.