GRASS GIS 7 Programmer's Manual  7.5.svn(2017)-r71806
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
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

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 69 of file iscatt_structs.c.

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.

References int.

Referenced by I_sc_insert_scatt_data().

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 nuber of categories was reached

Definition at line 155 of file iscatt_structs.c.

References scCats::cats_arr, scCats::cats_ids, scCats::cats_idxs, 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.

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.

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 88 of file iscatt_structs.c.

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

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 209 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.

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 261 of file iscatt_structs.c.

References scdScattData::b_conds_arr, G_zero(), scdScattData::n_vals, NULL, SC_SCATT_CONDITIONS, SC_SCATT_DATA, and scdScattData::scatt_vals_arr.