GRASS GIS 8 Programmer's Manual  8.5.0dev(2024)-36359e2344
iscatt_structs.c File Reference

Imagery library - functions for manipulation with structures used by wx.iscatt (wx Interactive Scatter Plot Tool) More...

#include <math.h>
#include <grass/imagery.h>
#include <grass/gis.h>
Include dependency graph for iscatt_structs.c:

Go to the source code of this file.

Functions

int I_id_scatt_to_bands (const int scatt_id, const int n_bands, int *b_1_id, int *b_2_id)
 Compute band ids from scatter plot id. More...
 
int I_bands_to_id_scatt (const int b_1_id, const int b_2_id, const int n_bands, int *scatt_id)
 Compute scatter plot id from band ids. More...
 
void I_sc_init_cats (struct scCats *cats, int n_bands, int type)
 Initialize structure for storing scatter plots data. More...
 
void I_sc_free_cats (struct scCats *cats)
 Free data of struct scCats, the structure itself remains allocated. More...
 
int I_sc_add_cat (struct scCats *cats)
 Add category. More...
 
int I_sc_insert_scatt_data (struct scCats *cats, struct scdScattData *scatt_data, int cat_id, int scatt_id)
 Insert scatter plot data . Inserted scatt_data struct must have same type as cats struct (SC_SCATT_DATA or SC_SCATT_CONDITIONS). More...
 
void I_scd_init_scatt_data (struct scdScattData *scatt_data, int type, int n_vals, void *data)
 Insert scatter plot data. More...
 

Detailed Description

Imagery library - functions for manipulation with structures used by wx.iscatt (wx Interactive Scatter Plot Tool)

Copyright (C) 2013 by the GRASS Development Team

This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.

Author
Stepan Turek stepa.nosp@m.n.tu.nosp@m.rek@s.nosp@m.ezna.nosp@m.m.cz (GSoC 2013, Mentor: Martin Landa)

Definition in file iscatt_structs.c.

Function Documentation

◆ I_bands_to_id_scatt()

int I_bands_to_id_scatt ( const int  b_1_id,
const int  b_2_id,
const int  n_bands,
int *  scatt_id 
)

Compute scatter plot id from band ids.

See also I_id_scatt_to_bands

Parameters
b_1_idid of band1
b_1_idid of band2
n_bandsnumber of bands
[out]scatt_idscatter plot id
Returns
0

Definition at line 70 of file iscatt_structs.c.

◆ I_id_scatt_to_bands()

int I_id_scatt_to_bands ( const int  scatt_id,
const int  n_bands,
int *  b_1_id,
int *  b_2_id 
)

Compute band ids from scatter plot id.

Scatter plot id describes which bands defines the scatter plot.

Let say we have 3 bands, their ids are 0, 1 and 2. Scatter plot with id 0 consists of band 1 (b_1_id) 0 and band 2 (b_2_id) 1. All scatter plots: scatt_id b_1_id b_2_id 0 0 1 1 0 2 2 1 2

Parameters
scatt_idscatter plot id
n_bandsnumber of bands
[out]b_1_idid of band1
[out]b_2_idid of band2
Returns
0

Definition at line 41 of file iscatt_structs.c.

Referenced by I_sc_insert_scatt_data().

◆ I_sc_add_cat()

int I_sc_add_cat ( struct scCats cats)

Add category.

Category represents group of scatter plots.

Parameters
catspointer to scCats struct
Returns
assigned category id (starts with 0)
-1 if maximum number of categories was reached

Definition at line 155 of file iscatt_structs.c.

References scCats::cats_arr, scCats::cats_ids, scCats::cats_idxs, G_malloc, G_zero(), scCats::n_a_cats, scScatts::n_a_scatts, scCats::n_cats, scCats::n_scatts, scScatts::scatt_idxs, scScatts::scatts_arr, and scScatts::scatts_bands.

◆ I_sc_free_cats()

void I_sc_free_cats ( struct scCats cats)

Free data of struct scCats, the structure itself remains allocated.

Parameters
catspointer to existing scCats struct

Definition at line 119 of file iscatt_structs.c.

References scCats::cats_arr, scCats::cats_ids, scCats::cats_idxs, G_free(), scCats::n_a_cats, scCats::n_bands, scCats::n_cats, scCats::n_scatts, scScatts::scatt_idxs, scScatts::scatts_arr, scScatts::scatts_bands, and scCats::type.

◆ I_sc_init_cats()

void I_sc_init_cats ( struct scCats cats,
int  n_bands,
int  type 
)

Initialize structure for storing scatter plots data.

Parameters
catspointer to scCats struct
n_bandsnumber of bands
typeSC_SCATT_DATA - stores scatter plots
typeSC_SCATT_CONDITIONS - stores selected areas in scatter plots

Definition at line 89 of file iscatt_structs.c.

◆ I_sc_insert_scatt_data()

int I_sc_insert_scatt_data ( struct scCats cats,
struct scdScattData scatt_data,
int  cat_id,
int  scatt_id 
)

Insert scatter plot data . Inserted scatt_data struct must have same type as cats struct (SC_SCATT_DATA or SC_SCATT_CONDITIONS).

Parameters
catspointer to scCats struct
scarr_datapointer to scdScattData struct
cat_idid number of category
scatt_idid number of scatter plot
Returns
0 on success
-1 on failure

Definition at line 208 of file iscatt_structs.c.

References scdScattData::b_conds_arr, scCats::cats_arr, scCats::cats_idxs, I_id_scatt_to_bands(), scScatts::n_a_scatts, scCats::n_bands, scCats::n_cats, scCats::n_scatts, SC_SCATT_CONDITIONS, SC_SCATT_DATA, scScatts::scatt_idxs, scdScattData::scatt_vals_arr, scScatts::scatts_arr, scScatts::scatts_bands, and scCats::type.

◆ I_scd_init_scatt_data()

void I_scd_init_scatt_data ( struct scdScattData scatt_data,
int  type,
int  n_vals,
void *  data 
)

Insert scatter plot data.

Parameters
scatt_datapointer to existing struct scdScattData
typeSC_SCATT_DATA for scatter plots or SC_SCATT_CONDITIONS for selected areas in scatter plot
n_valsnumber of data values
dataarray of values (unsigned char for SC_SCATT_CONDITIONS, unsigned int for SC_SCATT_DATA)

Definition at line 259 of file iscatt_structs.c.