GRASS 8 Programmer's Manual 8.6.0dev(2026)-4bb960b182
Loading...
Searching...
No Matches
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.
 
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.
 
void I_sc_init_cats (struct scCats *cats, int n_bands, int type)
 Initialize structure for storing scatter plots data.
 
void I_sc_free_cats (struct scCats *cats)
 Free data of struct scCats, the structure itself remains allocated.
 
int I_sc_add_cat (struct scCats *cats)
 Add category.
 
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).
 
void I_scd_init_scatt_data (struct scdScattData *scatt_data, int type, int n_vals, void *data)
 Insert scatter plot data.
 

Detailed Description

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

SPDX-FileCopyrightText: 2013 GRASS Development Team SPDX-License-Identifier: GPL-2.0-or-later

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 68 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 39 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 153 of file iscatt_structs.c.

References scCats::cats_arr, scCats::cats_ids, scCats::cats_idxs, G_malloc, G_zero(), scCats::n_a_cats, scCats::n_cats, and scCats::n_scatts.

◆ 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 117 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, 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 87 of file iscatt_structs.c.

References scCats::cats_arr, scCats::cats_ids, scCats::cats_idxs, G_malloc, G_zero(), scCats::n_a_cats, scCats::n_bands, scCats::n_cats, scCats::n_scatts, and scCats::type.

◆ 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
scatt_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 206 of file iscatt_structs.c.

References 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, 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 257 of file iscatt_structs.c.

References G_malloc, G_zero(), NULL, SC_SCATT_CONDITIONS, and SC_SCATT_DATA.