grass  7.8.6
About: GRASS (Geographic Resources Analysis Support System) is a raster- and vector-based GIS, image processing system, graphics production system and spatial modeling system.
  Fossies Dox: grass-7.8.6.tar.gz  ("unofficial" and yet experimental doxygen-generated source code documentation)  

group.c File Reference
#include <string.h>
#include <stdlib.h>
#include <grass/imagery.h>
Include dependency graph for group.c:

Go to the source code of this file.

Functions

static int get_ref (const char *, const char *, const char *, struct Ref *)
 
static int set_color (const char *, const char *, const char *, struct Ref *)
 
static int put_ref (const char *, const char *, const struct Ref *)
 
int I_get_group (char *group)
 
int I_put_group (const char *group)
 
int I_get_subgroup (const char *group, char *subgroup)
 
int I_put_subgroup (const char *group, const char *subgroup)
 
int I_get_group_ref (const char *group, struct Ref *ref)
 read group REF file More...
 
int I_get_group_ref2 (const char *group, const char *mapset, struct Ref *ref)
 read group REF file More...
 
int I_get_subgroup_ref (const char *group, const char *subgroup, struct Ref *ref)
 read subgroup REF file More...
 
int I_get_subgroup_ref2 (const char *group, const char *subgroup, const char *mapset, struct Ref *ref)
 read subgroup REF file More...
 
int I_init_ref_color_nums (struct Ref *ref)
 
int I_put_group_ref (const char *group, const struct Ref *ref)
 write group REF file More...
 
int I_put_subgroup_ref (const char *group, const char *subgroup, const struct Ref *ref)
 write subgroup REF file More...
 
int I_add_file_to_group_ref (const char *name, const char *mapset, struct Ref *ref)
 add file name to Ref structure More...
 
int I_transfer_group_ref_file (const struct Ref *ref2, int n, struct Ref *ref1)
 copy Ref lists More...
 
int I_init_group_ref (struct Ref *ref)
 initialize Ref structure More...
 
int I_free_group_ref (struct Ref *ref)
 free Ref structure More...
 

Function Documentation

◆ get_ref()

static int get_ref ( const char *  group,
const char *  subgroup,
const char *  gmapset,
struct Ref ref 
)
static

MODULE: imagery library AUTHOR(S): Original author(s) name(s) unknown - written by CERL PURPOSE: Image processing library COPYRIGHT: (C) 1999, 2005 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.

I_get_group (group); I_put_group (group);

I_get_group_ref (group, &Ref); I_put_group_ref (group, &Ref); I_get_subgroup_ref_file (group, subgroup, &Ref); I_put_subgroup_ref_file (group, subgroup, &Ref); I_add_file_to_group_ref (name, mapset, &Ref) I_transfer_group_ref_file (&Src_ref, n, &Dst_ref) I_init_group_ref (&Ref); I_free_group_ref (&Ref);

Definition at line 182 of file group.c.

References G_getl2(), G_mapset(), G_suppress_warnings(), G_unqualified_name(), GMAPSET_MAX, GNAME_MAX, I_add_file_to_group_ref(), I_fopen_group_ref_old2(), I_fopen_subgroup_ref_old2(), I_init_group_ref(), I_init_ref_color_nums(), INAME_LEN, name, NULL, and set_color().

Referenced by I_get_group_ref(), I_get_group_ref2(), I_get_subgroup_ref(), and I_get_subgroup_ref2().

◆ I_add_file_to_group_ref()

int I_add_file_to_group_ref ( const char *  name,
const char *  mapset,
struct Ref ref 
)

add file name to Ref structure

This routine adds the file name and mapset to the list contained in the ref structure, if it is not already in the list. The ref structure must have been properly initialized. This routine is used by programs, such as i.maxlik, to add to the group new raster maps created from files already in the group. Returns the index into the file array within the ref structure for the file after insertion; see Imagery_Library_Data_Structures.

Parameters
name
mapset
ref
Returns
int

Definition at line 396 of file group.c.

References Ref::file, Ref_Files::mapset, Ref_Files::name, name, and Ref::nfiles.

Referenced by get_ref(), and I_transfer_group_ref_file().

◆ I_free_group_ref()

int I_free_group_ref ( struct Ref ref)

free Ref structure

This routine frees memory allocated to the ref structure.

Parameters
ref
Returns
int

Definition at line 502 of file group.c.

References Ref::file, and Ref::nfiles.

Referenced by I_iclass_init_group().

◆ I_get_group()

int I_get_group ( char *  group)

Definition at line 38 of file group.c.

References G_fopen_old(), G_mapset(), G_suppress_warnings(), GROUPFILE, and NULL.

◆ I_get_group_ref()

int I_get_group_ref ( const char *  group,
struct Ref ref 
)

read group REF file

Reads the contents of the REF file for the specified group into the ref structure. Returns 1 if successful; 0 otherwise (but no error messages are printed).

Parameters
group
ref
Returns
int

Definition at line 114 of file group.c.

References get_ref(), and NULL.

Referenced by I_iclass_init_group().

◆ I_get_group_ref2()

int I_get_group_ref2 ( const char *  group,
const char *  mapset,
struct Ref ref 
)

read group REF file

Reads the contents of the REF file for the specified group into the ref structure. Returns 1 if successful; 0 otherwise (but no error messages are printed).

Parameters
group
mapset
ref
Returns
int

Definition at line 133 of file group.c.

References get_ref().

◆ I_get_subgroup()

int I_get_subgroup ( const char *  group,
char *  subgroup 
)

Definition at line 68 of file group.c.

References G_suppress_warnings(), I_find_group(), I_fopen_group_file_old(), NULL, and SUBGROUPFILE.

◆ I_get_subgroup_ref()

int I_get_subgroup_ref ( const char *  group,
const char *  subgroup,
struct Ref ref 
)

read subgroup REF file

Reads the contents of the REF file for the specified subgroup of the specified group into the ref structure. Returns 1 if successful; 0 otherwise (but no error messages are printed).

Parameters
group
subgroup
ref
Returns
int

Definition at line 153 of file group.c.

References get_ref(), and NULL.

Referenced by I_iclass_init_group().

◆ I_get_subgroup_ref2()

int I_get_subgroup_ref2 ( const char *  group,
const char *  subgroup,
const char *  mapset,
struct Ref ref 
)

read subgroup REF file

Reads the contents of the REF file for the specified subgroup of the specified group into the ref structure. Returns 1 if successful; 0 otherwise (but no error messages are printed).

Parameters
group
subgroup
mapset
ref
Returns
int

Definition at line 174 of file group.c.

References get_ref().

◆ I_init_group_ref()

int I_init_group_ref ( struct Ref ref)

initialize Ref structure

This routine initializes the ref structure for other library calls which require a Ref structure. This routine must be called before any use of the structure can be made. Note. The routines I_get_group_ref and I_get_subgroup_ref call this routine automatically.

Parameters
ref
Returns
int

Definition at line 483 of file group.c.

References Ref::blu, Ref_Color::n, Ref::nfiles, NULL, and Ref_Color::table.

Referenced by get_ref(), and I_iclass_init_group().

◆ I_init_ref_color_nums()

int I_init_ref_color_nums ( struct Ref ref)

Definition at line 260 of file group.c.

References Ref::blu, Ref_Color::index, Ref_Color::n, Ref::nfiles, NULL, and Ref_Color::table.

Referenced by get_ref().

◆ I_put_group()

int I_put_group ( const char *  group)

Definition at line 55 of file group.c.

References G_fopen_new(), GROUPFILE, and NULL.

◆ I_put_group_ref()

int I_put_group_ref ( const char *  group,
const struct Ref ref 
)

write group REF file

Writes the contents of the ref structure to the REF file for the specified group. Returns 1 if successful; 0 otherwise (and prints a diagnostic error). Note. This routine will create the group, if it does not already exist.

Parameters
group
ref
Returns
int

Definition at line 318 of file group.c.

References put_ref().

◆ I_put_subgroup()

int I_put_subgroup ( const char *  group,
const char *  subgroup 
)

Definition at line 87 of file group.c.

References I_find_group(), I_fopen_group_file_new(), NULL, and SUBGROUPFILE.

◆ I_put_subgroup_ref()

int I_put_subgroup_ref ( const char *  group,
const char *  subgroup,
const struct Ref ref 
)

write subgroup REF file

Writes the contents of the ref structure into the REF file for the specified subgroup of the specified group. Returns 1 if successful; 0 otherwise (and prints a diagnostic error). Note. This routine will create the subgroup, if it does not already exist.

Parameters
group
subgroup
ref
Returns
int

Definition at line 340 of file group.c.

References put_ref().

◆ I_transfer_group_ref_file()

int I_transfer_group_ref_file ( const struct Ref ref2,
int  n,
struct Ref ref1 
)

copy Ref lists

This routine is used to copy file names from one Ref structure to another. The name and mapset for file n from the src structure are copied into the dst structure (which must be properly initialized). For example, the following code copies one Ref structure to another:

struct Ref src,dst;
int n;
// some code to get information into <b>src</b>
...
I_init_group_ref (&dst);
for (n = 0; n < src.nfiles; n++)
static int src[2][2]
Definition: raster.c:25
static double dst[2][2]
Definition: raster.c:26
int I_transfer_group_ref_file(const struct Ref *ref2, int n, struct Ref *ref1)
copy Ref lists
Definition: group.c:448
Definition: imagery.h:27

This routine is used by g.gui.gcp to create the REF file for a subgroup.

Parameters
src
n
dst
Returns
int

Definition at line 448 of file group.c.

References Ref::blu, Ref::file, I_add_file_to_group_ref(), Ref_Files::mapset, Ref_Color::n, and Ref_Files::name.

◆ put_ref()

static int put_ref ( const char *  group,
const char *  subgroup,
const struct Ref ref 
)
static

◆ set_color()

static int set_color ( const char *  name,
const char *  mapset,
const char *  color,
struct Ref ref 
)
static

Definition at line 224 of file group.c.

References Ref::blu, Ref::file, Ref_Files::mapset, Ref_Color::n, Ref_Files::name, name, and Ref::nfiles.

Referenced by get_ref().