GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-a6bc2b9278
|
#include <grass/config.h>
#include <stdarg.h>
#include <stdio.h>
#include <setjmp.h>
#include <sys/types.h>
#include <sys/stat.h>
Go to the source code of this file.
Macros | |
#define | G_alloca(n) G_malloc(n) |
#define | G_freea(p) G_free(p) |
#define | RELDIR "?" |
#define | G_incr_void_ptr(ptr, size) ((void *)((const unsigned char *)(ptr) + (size))) |
#define | G_malloc(n) G__malloc(RELDIR "/" __FILE__, __LINE__, (n)) |
#define | G_calloc(m, n) G__calloc(RELDIR "/" __FILE__, __LINE__, (m), (n)) |
#define | G_realloc(p, n) G__realloc(RELDIR "/" __FILE__, __LINE__, (p), (n)) |
Functions | |
void | G_adjust_Cell_head (struct Cell_head *, int, int) |
Adjust cell header. More... | |
void | G_adjust_Cell_head3 (struct Cell_head *, int, int, int) |
Adjust cell header for 3D values. More... | |
int | G_adjust_window_ll (struct Cell_head *cellhd) |
Adjust window for lat/lon. More... | |
void * | G__malloc (const char *, int, size_t) |
Memory allocation. More... | |
void * | G__calloc (const char *, int, size_t, size_t) |
Memory allocation. More... | |
void * | G__realloc (const char *, int, void *, size_t) |
Memory reallocation. More... | |
void | G_free (void *) |
Free allocated memory. More... | |
int | G_begin_cell_area_calculations (void) |
Begin cell area calculations. More... | |
double | G_area_of_cell_at_row (int) |
Cell area in specified row. More... | |
int | G_begin_polygon_area_calculations (void) |
Begin polygon area calculations. More... | |
double | G_area_of_polygon (const double *, const double *, int) |
Area in square meters of polygon. More... | |
void | G_begin_zone_area_on_ellipsoid (double, double, double) |
Begin area calculations for ellipsoid. More... | |
double | G_darea0_on_ellipsoid (double) |
Calculate integral for area between two latitudes. More... | |
double | G_area_for_zone_on_ellipsoid (double, double) |
Calculates area between latitudes. More... | |
void | G_begin_ellipsoid_polygon_area (double, double) |
Begin area calculations. More... | |
double | G_ellipsoid_polygon_area (const double *, const double *, int) |
Area of lat-long polygon. More... | |
double | G_planimetric_polygon_area (const double *, const double *, int) |
Calculates planimetric polygon area. More... | |
void | G_begin_zone_area_on_sphere (double, double) |
Initialize calculations for sphere. More... | |
double | G_darea0_on_sphere (double) |
Calculates integral for area between two latitudes. More... | |
double | G_area_for_zone_on_sphere (double, double) |
Calculates area between latitudes. More... | |
void | G_ascii_check (char *) |
Removes non-ascii characters from buffer. More... | |
int | G_vasprintf (char **, const char *, va_list) |
Safe replacement for asprintf(). More... | |
int | G_asprintf (char **, const char *,...) __attribute__((format(printf |
int int | G_rasprintf (char **, size_t *, const char *,...) __attribute__((format(printf |
int int int | G_aprintf (const char *,...) |
Adjust the width of string specifiers to the display space instead of the number of bytes for wide characters and print them formatted using the adjusted display width. More... | |
int | G_faprintf (FILE *, const char *,...) |
fprintf() version of G_aprintf(). See G_aprintf() for more details. More... | |
int | G_saprintf (char *, const char *,...) |
sprintf() version of G_aprintf(). See G_aprintf() for more details. More... | |
int | G_snaprintf (char *, size_t, const char *,...) |
snprintf() version of G_aprintf(). See G_aprintf() for more details. More... | |
int | G_vaprintf (const char *, va_list) |
vprintf() version of G_aprintf(). See G_aprintf() for more details. More... | |
int | G_vfaprintf (FILE *, const char *, va_list) |
vfprintf() version of G_aprintf(). See G_aprintf() for more details. More... | |
int | G_vsaprintf (char *, const char *, va_list) |
vsprintf() version of G_aprintf(). See G_aprintf() for more details. More... | |
int | G_vsnaprintf (char *, size_t, const char *, va_list) |
vsnprintf() version of G_aprintf(). See G_aprintf() for more details. More... | |
size_t | G_strlcat (char *, const char *, size_t) |
Size-bounded string concatenation. More... | |
size_t | G_strlcpy (char *, const char *, size_t) |
Safe string copy function. More... | |
char * | G_basename (char *, const char *) |
Truncates filename to the base part (before the last '.') if it matches the extension, otherwise leaves it unchanged. More... | |
size_t | G_get_num_decimals (const char *) |
Get number of decimals from a string. More... | |
char * | G_double_to_basename_format (double, size_t, size_t) |
Convert a double to a string substituting the dot with underscore 12.3456 => '12_3456'. More... | |
char * | G_get_basename_separator (void) |
Return the environmental basename variable or the default value. More... | |
char * | G_join_basename_strings (const char **, size_t) |
join an array of strings using the basename separator More... | |
char * | G_generate_basename (const char *, double, size_t, size_t) |
Generate the format string. More... | |
void | G_bresenham_line (int, int, int, int, int(*)(int, int)) |
Bresenham line algorithm. More... | |
void | G_clicker (void) |
char * | G_color_rules_options (void) |
Get list of color rules for Option->options. More... | |
char * | G_color_rules_descriptions (void) |
Get color rules description for Option->descriptions. More... | |
char * | G_color_rules_description_type (void) |
Get color rules description for Option->descriptions. More... | |
void | G_list_color_rules (FILE *) |
Print color rules. More... | |
void | G_list_color_rules_description_type (FILE *, char *) |
Print color rules with description and type. More... | |
int | G_find_color_rule (const char *) |
Check if color rule is defined. More... | |
int | G_num_standard_colors (void) |
Get number of named colors (RGB triplets) More... | |
int | G_insert_commas (char *) |
Inserts commas into a number string. More... | |
void | G_remove_commas (char *) |
Removes commas from number string. More... | |
int | G_compressor_number (char *) |
char * | G_compressor_name (int) |
int | G_default_compressor (void) |
int | G_check_compressor (int) |
int | G_write_compressed (int, unsigned char *, int, int) |
int | G_write_unompressed (int, unsigned char *, int) |
int | G_read_compressed (int, int, unsigned char *, int, int) |
int | G_compress_bound (int, int) |
int | G_compress (unsigned char *, int, unsigned char *, int, int) |
int | G_expand (unsigned char *, int, unsigned char *, int, int) |
int | G_no_compress (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_no_expand (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_rle_compress (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_rle_expand (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_zlib_compress (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_zlib_expand (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_lz4_compress (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_lz4_expand (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_bz2_compress (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_bz2_expand (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_zstd_compress (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_zstd_expand (unsigned char *src, int src_sz, unsigned char *dst, int dst_sz) |
int | G_recursive_copy (const char *, const char *) |
Copy recursively source directory to destination directory. More... | |
int | G_copy_file (const char *, const char *) |
Copies one file to another. More... | |
int | G_is_initialized (int *) |
void | G_initialize_done (int *) |
void | G_init_counter (struct Counter *, int) |
int | G_counter_next (struct Counter *) |
const char * | G_date (void) |
Current date and time. More... | |
int | G_get_datum_by_name (const char *) |
const char * | G_datum_name (int) |
const char * | G_datum_description (int) |
const char * | G_datum_ellipsoid (int) |
int | G_get_datumparams_from_projinfo (const struct Key_Value *, char *, char *) |
void | G_read_datum_table (void) |
void | G_init_debug (void) |
Initiate debugging. More... | |
int | G_debug (int, const char *,...) __attribute__((format(printf |
int int | G_begin_distance_calculations (void) |
Begin distance calculations. More... | |
double | G_distance (double, double, double, double) |
Returns distance in meters. More... | |
double | G_distance_between_line_segments (double, double, double, double, double, double, double, double) |
Returns distance between two line segments in meters. More... | |
double | G_distance_point_to_line_segment (double, double, double, double, double, double) |
Returns distance between a point and line segment in meters. More... | |
void | G_done_msg (const char *,...) __attribute__((format(printf |
void int | G_is_little_endian (void) |
Tests for little ENDIAN. More... | |
void | G_init_env (void) |
Initialize variables. More... | |
const char * | G_getenv (const char *) |
Get environment variable. More... | |
const char * | G_getenv2 (const char *, int) |
Get variable from specific place. More... | |
const char * | G_getenv_nofatal (const char *) |
Get environment variable. More... | |
const char * | G_getenv_nofatal2 (const char *, int) |
Get environment variable from specific place. More... | |
void | G_setenv (const char *, const char *) |
Set environment variable (updates .gisrc) More... | |
void | G_setenv2 (const char *, const char *, int) |
Set environment variable from specific place (updates .gisrc) More... | |
void | G_setenv_nogisrc (const char *, const char *) |
Set environment name to value (doesn't update .gisrc) More... | |
void | G_setenv_nogisrc2 (const char *, const char *, int) |
Set environment name to value from specific place (doesn't update .gisrc) More... | |
void | G_unsetenv (const char *) |
Remove name from environment. More... | |
void | G_unsetenv2 (const char *, int) |
Remove name from environment from specific place. More... | |
const char * | G_get_env_name (int) |
Get variable name for index n. More... | |
void | G_set_gisrc_mode (int) |
Set where to find/store variables. More... | |
int | G_get_gisrc_mode (void) |
Get info where variables are stored. More... | |
void | G_create_alt_env (void) |
Set up alternative environment variables. More... | |
void | G_switch_env (void) |
Switch environments. More... | |
void | G__read_mapset_env (void) |
Force to read the mapset environment file VAR. More... | |
void | G__read_gisrc_env (void) |
Force to read the GISRC environment file. More... | |
void | G__read_gisrc_path (void) |
Read or read again the GISRC (session) environment variable. More... | |
jmp_buf * | G_fatal_longjmp (int) |
int | G_info_format (void) |
Get current message format. More... | |
void | G_message (const char *,...) __attribute__((format(printf |
void void | G_verbose_message (const char *,...) __attribute__((format(printf |
void void void | G_important_message (const char *,...) __attribute__((format(printf |
void void void void | G_fatal_error (const char *,...) __attribute__((format(printf |
void void void void | __attribute__ ((noreturn)) |
void | G_warning (const char *,...) __attribute__((format(printf |
void int | G_suppress_warnings (int) |
Suppress printing a warning message to stderr. More... | |
int | G_sleep_on_error (int) |
Turn on/off no_sleep flag. More... | |
void | G_set_error_routine (int(*)(const char *, int)) |
Establishes error_routine as the routine that will handle the printing of subsequent error messages. More... | |
void | G_unset_error_routine (void) |
After this call subsequent error messages will be handled in the default method. More... | |
void | G_init_logging (void) |
char * | G_file_name (char *, const char *, const char *, const char *) |
Builds full path names to GIS data files. More... | |
char * | G_file_name_misc (char *, const char *, const char *, const char *, const char *) |
Builds full path names to GIS misc data files. More... | |
char * | G_file_name_tmp (char *, const char *, const char *, const char *) |
Builds full path names to GIS data files in temporary directory (for internal use only) More... | |
char * | G_file_name_basedir (char *, const char *, const char *, const char *, const char *) |
Builds full path names to GIS data files in temporary directory (for internal use only) More... | |
const char * | G_find_file (const char *, char *, const char *) |
Searches for a file from the mapset search list or in a specified mapset. More... | |
const char * | G_find_file2 (const char *, const char *, const char *) |
Searches for a file from the mapset search list or in a specified mapset. (look but don't touch) More... | |
const char * | G_find_file_misc (const char *, const char *, char *, const char *) |
Searches for a misc file from the mapset search list or in a specified mapset. More... | |
const char * | G_find_file2_misc (const char *, const char *, const char *, const char *) |
Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch) More... | |
char * | G_find_etc (const char *) |
searches for a file from the etc search list in GRASS_ADDON_ETC returns the full path to where the file was found. More... | |
const char * | G_find_raster (char *, const char *) |
Find a raster map. More... | |
const char * | G_find_raster2 (const char *, const char *) |
Find a raster map (look but don't touch) More... | |
const char * | G_find_raster3d (const char *, const char *) |
Search for a 3D raster map in current search path or in a specified mapset. More... | |
const char * | G_find_vector (char *, const char *) |
Finds a vector map. More... | |
const char * | G_find_vector2 (const char *, const char *) |
Find a vector map (look but don't touch) More... | |
int | G_begin_geodesic_equation (double, double, double, double) |
double | G_geodesic_lat_from_lon (double) |
void | G_begin_geodesic_distance (double, double) |
Begin geodesic distance. More... | |
void | G_set_geodesic_distance_lat1 (double) |
Sets geodesic distance lat1. More... | |
void | G_set_geodesic_distance_lat2 (double) |
Sets geodesic distance lat2. More... | |
double | G_geodesic_distance_lon_to_lon (double, double) |
Calculates geodesic distance. More... | |
double | G_geodesic_distance (double, double, double, double) |
Calculates geodesic distance. More... | |
int | G_get_ellipsoid_parameters (double *, double *) |
get ellipsoid parameters More... | |
int | G_get_spheroid_by_name (const char *, double *, double *, double *) |
Get spheroid parameters by name. More... | |
int | G_get_ellipsoid_by_name (const char *, double *, double *) |
Get ellipsoid parameters by name. More... | |
const char * | G_ellipsoid_name (int) |
Get ellipsoid name. More... | |
const char * | G_ellipsoid_description (int) |
Get description for nth ellipsoid. More... | |
int | G_read_ellipsoid_table (int) |
Read ellipsoid table. More... | |
struct Key_Value * | G_get_projunits (void) |
Gets units information for location. More... | |
struct Key_Value * | G_get_projinfo (void) |
Gets projection information for location. More... | |
struct Key_Value * | G_get_projepsg (void) |
Gets EPSG information for the current location. More... | |
char * | G_get_projwkt (void) |
Get WKT information for the current location. More... | |
char * | G_get_projsrid (void) |
Get srid (spatial reference id) for the current location. More... | |
void | G_get_window (struct Cell_head *) |
Get the current region. More... | |
void | G_get_default_window (struct Cell_head *) |
Get the default region. More... | |
void | G_get_element_window (struct Cell_head *, const char *, const char *, const char *) |
Get region for selected element (raster, vector, window, etc.) More... | |
int | G_getl (char *, int, FILE *) |
Gets a line of text from a file. More... | |
int | G_getl2 (char *, int, FILE *) |
Gets a line of text from a file of any pedigree. More... | |
const char * | G_gisbase (void) |
Get full path name of the top level module directory. More... | |
const char * | G_gisdbase (void) |
Get name of top level database directory. More... | |
void | G__gisinit (const char *, const char *) |
Initialize GIS Library and ensures a valid mapset is available. More... | |
void | G__no_gisinit (const char *) |
Initialize GIS Library. More... | |
void | G_init_all (void) |
Initialize environment. More... | |
void | G_add_error_handler (void(*)(void *), void *) |
Add new error handler. More... | |
void | G_remove_error_handler (void(*)(void *), void *) |
Remove existing error handler. More... | |
const char * | G_home (void) |
Get user's home directory. More... | |
const char * | G_config_path (void) |
Get user's config path directory. More... | |
void | G_init_ilist (struct ilist *) |
Init an integer list and free allocated memory. More... | |
void | G_free_ilist (struct ilist *) |
Free allocated memory of an integer list. More... | |
struct ilist * | G_new_ilist (void) |
Return a new integer list. More... | |
void | G_ilist_add (struct ilist *, int) |
Add item to ilist. More... | |
int | G_intersect_line_segments (double, double, double, double, double, double, double, double, double *, double *, double *, double *) |
int | G_is_gisbase (const char *) |
Test if specified directory is GISBASE. More... | |
int | G_is_location (const char *) |
Test if specified directory is location. More... | |
int | G_is_mapset (const char *) |
Test if specified directory is mapset. More... | |
struct Key_Value * | G_create_key_value (void) |
Allocate and initialize Key_Value structure. More... | |
void | G_set_key_value (const char *, const char *, struct Key_Value *) |
Set value for given key. More... | |
const char * | G_find_key_value (const char *, const struct Key_Value *) |
Find given key (case sensitive) More... | |
void | G_free_key_value (struct Key_Value *) |
Free allocated Key_Value structure. More... | |
int | G_fwrite_key_value (FILE *, const struct Key_Value *) |
Write key/value pairs to file. More... | |
struct Key_Value * | G_fread_key_value (FILE *) |
Read key/values pairs from file. More... | |
void | G_write_key_value_file (const char *, const struct Key_Value *) |
Write key/value pairs to file. More... | |
struct Key_Value * | G_read_key_value_file (const char *) |
Read key/values pairs from file. More... | |
void | G_update_key_value_file (const char *, const char *, const char *) |
Update file, set up value for given key. More... | |
int | G_lookup_key_value_from_file (const char *, const char *, char[], int) |
Look up for key in file. More... | |
int | G_legal_filename (const char *) |
Check for legal database file name. More... | |
int | G_check_input_output_name (const char *, const char *, int) |
Check input and output file names. More... | |
void | G_set_distance_to_line_tolerance (double) |
double | G_distance2_point_to_line (double, double, double, double, double, double) |
void | G_list_element (const char *, const char *, const char *, int(*)(const char *, const char *, char *)) |
General purpose list function. More... | |
char ** | G_list (int, const char *, const char *, const char *) |
List specified type of elements. Application must release the allocated memory. More... | |
void | G_free_list (char **) |
Free list. More... | |
void | G_lat_format (double, char *) |
const char * | G_lat_format_string (void) |
void | G_lon_format (double, char *) |
const char * | G_lon_format_string (void) |
void | G_llres_format (double, char *) |
const char * | G_llres_format_string (void) |
void | G_lat_parts (double, int *, int *, double *, char *) |
void | G_lon_parts (double, int *, int *, double *, char *) |
int | G_lat_scan (const char *, double *) |
int | G_lon_scan (const char *, double *) |
int | G_llres_scan (const char *, double *) |
const char * | G_location (void) |
Get current location name. More... | |
char * | G_location_path (void) |
Get current location UNIX-like path. More... | |
void | G_srand48 (long) |
Seed the pseudo-random number generator. More... | |
long | G_srand48_auto (void) |
Seed the pseudo-random number generator from the time and PID. More... | |
long | G_lrand48 (void) |
Generate an integer in the range [0, 2^31) More... | |
long | G_mrand48 (void) |
Generate an integer in the range [-2^31, 2^31) More... | |
double | G_drand48 (void) |
Generate a floating-point value in the range [0,1) More... | |
void | G_set_ls_filter (int(*)(const char *, void *), void *) |
void | G_set_ls_exclude_filter (int(*)(const char *, void *), void *) |
char ** | G_ls2 (const char *, int *) |
Stores a sorted directory listing in an array. More... | |
void | G_ls (const char *, FILE *) |
Prints a directory listing to a stream, in prettified column format. More... | |
void | G_ls_format (char **, int, int, FILE *) |
Prints a listing of items to a stream, in prettified column format. More... | |
void * | G_ls_regex_filter (const char *, int, int, int) |
void * | G_ls_glob_filter (const char *, int, int) |
void | G_free_ls_filter (void *) |
int | G_make_location (const char *, struct Cell_head *, const struct Key_Value *, const struct Key_Value *) |
Create a new location. More... | |
int | G_make_location_epsg (const char *, struct Cell_head *, const struct Key_Value *, const struct Key_Value *, const struct Key_Value *) |
Create a new location. More... | |
int | G_make_location_crs (const char *, struct Cell_head *, const struct Key_Value *, const struct Key_Value *, const char *, const char *) |
Create a new location. More... | |
int | G_write_projsrid (const char *, const char *) |
Write srid (spatial reference id) to file. More... | |
int | G_write_projwkt (const char *, const char *) |
Write WKT definition to file. More... | |
int | G_compare_projections (const struct Key_Value *, const struct Key_Value *, const struct Key_Value *, const struct Key_Value *) |
Compare projections including units. More... | |
int | G_make_mapset (const char *, const char *, const char *) |
Create a new mapset. More... | |
char * | G_tolcase (char *) |
convert string to lower case More... | |
char * | G_toucase (char *) |
convert string to upper case More... | |
const char * | G_mapset (void) |
Get current mapset name. More... | |
char * | G_mapset_path (void) |
Get current mapset UNIX-like path. More... | |
int | G_make_mapset_element (const char *) |
Create element in the current mapset. More... | |
int | G_make_mapset_element_tmp (const char *) |
Create element in the temporary directory. More... | |
int | G_make_mapset_object_group (const char *) |
Create directory for group of elements of a given type. More... | |
int | G_make_mapset_dir_object (const char *, const char *) |
Create directory for an object of a given type. More... | |
int | G_make_mapset_object_group_tmp (const char *) |
Create directory for type of objects in the temporary directory. More... | |
int | G_make_mapset_object_group_basedir (const char *, const char *) |
Create directory for type of objects in the temporary directory. More... | |
int | G__make_mapset_element_misc (const char *, const char *) |
Create misc element in the current mapset. More... | |
int | G_mapset_permissions (const char *) |
Check for user mapset permission. More... | |
int | G_mapset_permissions2 (const char *, const char *, const char *) |
Check for user mapset permission. More... | |
const char * | G_get_mapset_name (int) |
Get name of the n'th mapset from the current mapset search path. More... | |
void | G_create_alt_search_path (void) |
Define alternative mapset search path. More... | |
void | G_switch_search_path (void) |
Switch mapset search path. More... | |
void | G_reset_mapsets (void) |
Reset number of mapsets. More... | |
char ** | G_get_available_mapsets (void) |
Get list of available mapsets for current location. More... | |
void | G_add_mapset_to_search_path (const char *) |
Add mapset to the list of mapsets in search path. More... | |
int | G_is_mapset_in_search_path (const char *) |
Check if given mapset is in search path. More... | |
char * | G_myname (void) |
Returns location title. More... | |
int | G_color_values (const char *, float *, float *, float *) |
const char * | G_color_name (int) |
void | G_newlines_to_spaces (char *) |
int | G_name_is_fully_qualified (const char *, char *, char *) |
Check if map name is fully qualified (map @ mapset) More... | |
char * | G_fully_qualified_name (const char *, const char *) |
Get fully qualified element name. More... | |
int | G_unqualified_name (const char *, const char *, char *, char *) |
Returns unqualified map name (without @ mapset) More... | |
int | G_set_omp_num_threads (struct Option *) |
Set the number of threads for OpenMP The intended usage is at the beginning of a C tool when parameters are processed, namely the G_OPT_M_NPROCS standard option. More... | |
int | G_open_new (const char *, const char *) |
Open a new database file. More... | |
int | G_open_old (const char *, const char *, const char *) |
Open a database file for reading. More... | |
int | G_open_update (const char *, const char *) |
Open a database file for update. More... | |
FILE * | G_fopen_new (const char *, const char *) |
Open a new database file. More... | |
FILE * | G_fopen_old (const char *, const char *, const char *) |
Open a database file for reading. More... | |
FILE * | G_fopen_append (const char *, const char *) |
Open a database file for update (append mode) More... | |
FILE * | G_fopen_modify (const char *, const char *) |
Open a database file for update (r+ mode) More... | |
int | G_open_new_misc (const char *, const char *, const char *) |
open a new database misc file More... | |
int | G_open_old_misc (const char *, const char *, const char *, const char *) |
open a database misc file for reading More... | |
int | G_open_update_misc (const char *, const char *, const char *) |
open a database misc file for update More... | |
FILE * | G_fopen_new_misc (const char *, const char *, const char *) |
open a new database misc file More... | |
FILE * | G_fopen_old_misc (const char *, const char *, const char *, const char *) |
open a database misc file for reading More... | |
FILE * | G_fopen_append_misc (const char *, const char *, const char *) |
FILE * | G_fopen_modify_misc (const char *, const char *, const char *) |
int | G_check_overwrite (int argc, char **argv) |
Check for overwrite mode. More... | |
FILE * | G_open_pager (struct Popen *) |
void | G_close_pager (struct Popen *) |
FILE * | G_open_mail (struct Popen *) |
void | G_close_mail (struct Popen *) |
void | G_disable_interactive (void) |
Disables the ability of the parser to operate interactively. More... | |
struct GModule * | G_define_module (void) |
Initializes a new module. More... | |
struct Flag * | G_define_flag (void) |
Initializes a Flag struct. More... | |
struct Option * | G_define_option (void) |
Initializes an Option struct. More... | |
struct Option * | G_define_standard_option (int) |
Create standardised Option structure. More... | |
struct Flag * | G_define_standard_flag (int) |
Create standardised Flag structure. More... | |
int | G_parser (int, char **) |
Parse command line. More... | |
void | G_usage (void) |
Command line help/usage message. More... | |
char * | G_recreate_command (void) |
Creates command to run non-interactive. More... | |
void | G_add_keyword (const char *) |
Add keyword to the list. More... | |
void | G_set_keywords (const char *) |
Set keywords from the string. More... | |
int | G_get_overwrite (void) |
Get overwrite value. More... | |
char * | G_option_to_separator (const struct Option *) |
Get separator string from the option. More... | |
FILE * | G_open_option_file (const struct Option *) |
Get an input/output file pointer from the option. If the file name is omitted or '-', it returns either stdin or stdout based on the gisprompt. More... | |
void | G_close_option_file (FILE *) |
Close an input/output file returned by G_open_option_file(). If the file pointer is stdin, stdout, or stderr, nothing happens. More... | |
void | G_option_rule (int, int, void **) |
Set generic option rule. More... | |
void | G_option_exclusive (void *,...) |
Sets the options to be mutually exclusive. More... | |
void | G_option_required (void *,...) |
Sets the options to be required. More... | |
void | G_option_requires (void *,...) |
Define a list of options from which at least one option is required if first option is present. More... | |
void | G_option_requires_all (void *,...) |
Define additionally required options for an option. More... | |
void | G_option_excludes (void *,...) |
Exclude selected options. More... | |
void | G_option_collective (void *,...) |
Sets the options to be collective. More... | |
int | G_mkdir (const char *) |
Creates a new directory. More... | |
int | G_is_dirsep (char) |
Checks if a specified character is a valid directory separator character on the host system. More... | |
int | G_is_absolute_path (const char *) |
Checks if a specified path looks like an absolute path on the host system. More... | |
char * | G_convert_dirseps_to_host (char *) |
Converts directory separator characters in a string to the native host separator character (/ on Unix, \ on Windows) More... | |
char * | G_convert_dirseps_from_host (char *) |
Converts directory separator characters in a string from the native host character to the GRASS separator character (/) More... | |
int | G_lstat (const char *, struct stat *) |
Get file status. More... | |
int | G_stat (const char *, struct stat *) |
Get file status. More... | |
int | G_owner (const char *) |
Get owner id of path. More... | |
void | G_percent (long, long, int) |
Print percent complete messages. More... | |
void | G_percent_reset (void) |
Reset G_percent() to 0%; do not add newline. More... | |
void | G_progress (long, int) |
Print progress info messages. More... | |
void | G_set_percent_routine (int(*)(int)) |
Establishes percent_routine as the routine that will handle the printing of percentage progress messages. More... | |
void | G_unset_percent_routine (void) |
After this call subsequent percentage progress messages will be handled in the default method. More... | |
void | G_popen_clear (struct Popen *) |
FILE * | G_popen_write (struct Popen *, const char *, const char **) |
FILE * | G_popen_read (struct Popen *, const char *, const char **) |
void | G_popen_close (struct Popen *) |
void | G_setup_plot (double, double, double, double, int(*)(int, int), int(*)(int, int)) |
Initialize plotting routines. More... | |
void | G_setup_fill (int) |
Set row_fill routine to row_solid_fill or row_dotted_fill. More... | |
void | G_plot_where_xy (double, double, int *, int *) |
Converts east,north to x,y. More... | |
void | G_plot_where_en (int, int, double *, double *) |
Converts x,y to east,north. More... | |
void | G_plot_point (double, double) |
Plot point. More... | |
void | G_plot_line (double, double, double, double) |
Plot line between latlon coordinates (fastline) More... | |
void | G_plot_line2 (double, double, double, double) |
Plot line between latlon coordinates (slowline) More... | |
int | G_plot_polygon (const double *, const double *, int) |
Plot filled polygon with n vertices. More... | |
int | G_plot_area (double *const *, double *const *, int *, int) |
Plot multiple polygons. More... | |
void | G_plot_fx (double(*)(double), double, double) |
Plot f(east1) to f(east2) More... | |
int | G_pole_in_polygon (const double *, const double *, int) |
Check if pole is in polygon. More... | |
const char * | G_program_name (void) |
Return module name. More... | |
const char * | G_original_program_name (void) |
Return original path of the executed program. More... | |
void | G_set_program_name (const char *) |
Set program name. More... | |
int | G_projection (void) |
Query cartographic projection. More... | |
int | G_projection_units (int) |
Get projection units code (for internal use only) More... | |
const char * | G_projection_name (int) |
Get projection name. More... | |
const char * | G_database_unit_name (int) |
Get units (localized) name for the current location. More... | |
int | G_database_unit (void) |
Get units id for the current location. More... | |
const char * | G_database_projection_name (void) |
Query cartographic projection for the current location. More... | |
const char * | G_database_datum_name (void) |
Get datum name for the current location. More... | |
const char * | G_database_ellipse_name (void) |
Get ellipsoid name for the current location. More... | |
double | G_database_units_to_meters_factor (void) |
Conversion to meters. More... | |
const char * | G_database_epsg_code (void) |
Get EPGS code for the current location. More... | |
int | G_put_window (const struct Cell_head *) |
Writes the region (window) More... | |
int | G_put_element_window (const struct Cell_head *, const char *, const char *) |
Write the region. More... | |
void | G_putenv (const char *, const char *) |
Sets the UNIX environment variable name to value. More... | |
double | G_meridional_radius_of_curvature (double, double, double) |
Meridional radius of curvature. More... | |
double | G_transverse_radius_of_curvature (double, double, double) |
Transverse radius of curvature. More... | |
double | G_radius_of_conformal_tangent_sphere (double, double, double) |
Radius of conformal tangent sphere. More... | |
void | G__read_Cell_head (FILE *, struct Cell_head *) |
Read cell header (for internal use only) More... | |
void | G__read_Cell_head_array (char **, struct Cell_head *) |
Read window from NULL terminated array of strings (for internal use only) More... | |
int | G_remove (const char *, const char *) |
Remove a database file. More... | |
int | G_remove_misc (const char *, const char *, const char *) |
Remove a database misc file. More... | |
int | G_recursive_remove (const char *) |
Recursively remove all files in given directory. More... | |
int | G_rename_file (const char *, const char *) |
Rename a file or a directory in the filesystem. More... | |
int | G_rename (const char *, const char *, const char *) |
Rename a database file. More... | |
int | G_begin_rhumbline_equation (double, double, double, double) |
Start rhumbline calculations. More... | |
double | G_rhumbline_lat_from_lon (double) |
Calculates rhumbline latitude. More... | |
void | G_rotate_around_point (double, double, double *, double *, double) |
Rotate point (double version) More... | |
void | G_rotate_around_point_int (int, int, int *, int *, double) |
Rotate point (int version) More... | |
off_t | G_ftell (FILE *) |
Get the current file position of the stream. More... | |
void | G_fseek (FILE *, off_t, int) |
Change the file position of the stream. More... | |
void | G_get_set_window (struct Cell_head *) |
Get the current working window (region) More... | |
void | G_set_window (struct Cell_head *) |
Establishes window as the current working window (region). More... | |
void | G_unset_window (void) |
Unset current region. More... | |
void | G_shortest_way (double *, double *) |
Shortest way between two eastings. More... | |
void | G_sleep (unsigned int) |
int | G_snprintf (char *, size_t, const char *,...) __attribute__((format(printf |
int int | G_strcasecmp (const char *, const char *) |
String compare ignoring case (upper or lower) More... | |
int | G_strncasecmp (const char *, const char *, int) |
String compare ignoring case (upper or lower) - limited number of characters. More... | |
char * | G_store (const char *) |
Copy string to allocated memory. More... | |
char * | G_store_upper (const char *) |
Copy string to allocated memory and convert copied string to upper case. More... | |
char * | G_store_lower (const char *) |
Copy string to allocated memory and convert copied string to lower case. More... | |
char * | G_strchg (char *, char, char) |
Replace all occurrences of character in string bug with new. More... | |
char * | G_str_replace (const char *, const char *, const char *) |
Replace all occurrences of old_str in buffer with new_str. More... | |
char * | G_str_concat (const char **, int, const char *, int) |
String concatenation. More... | |
void | G_strip (char *) |
Removes all leading and trailing white space from string. More... | |
char * | G_chop (char *) |
Chop leading and trailing white spaces. More... | |
void | G_str_to_upper (char *) |
Convert string to upper case. More... | |
void | G_str_to_lower (char *) |
Convert string to lower case. More... | |
int | G_str_to_sql (char *) |
Make string SQL compliant. More... | |
void | G_squeeze (char *) |
Remove superfluous white space. More... | |
char * | G_strcasestr (const char *, const char *) |
Finds the first occurrence of the sub-string in the null-terminated string ignoring case (upper or lower) More... | |
void | G_init_tempfile (void) |
Initialize environment for creating tempfiles. More... | |
char * | G_tempfile (void) |
Returns a temporary file name. More... | |
char * | G_tempfile_basedir (const char *) |
Returns a temporary file name. More... | |
char * | G_tempfile_pid (int) |
Create tempfile from process id. More... | |
char * | G_tempfile_pid_basedir (int, const char *) |
Create tempfile from process id in given base directory. More... | |
void | G_temp_element (char *) |
Populates element with a path string. More... | |
void | G__temp_element (char *, int) |
Populates element with a path string (internal use only!) More... | |
void | G__temp_element_basedir (char *, const char *) |
Populates element with a path string (internal use only!) More... | |
char * | G_mktemp (char *) |
Opens a temporary file. More... | |
int | G_mkstemp (char *, int, int) |
Returns a file descriptor. More... | |
FILE * | G_mkstemp_fp (char *, int, int) |
Returns a file descriptor. More... | |
void | G_init_timestamp (struct TimeStamp *) |
Initialize timestamp structure. More... | |
void | G_set_timestamp (struct TimeStamp *, const struct DateTime *) |
void | G_set_timestamp_range (struct TimeStamp *, const struct DateTime *, const struct DateTime *) |
int | G_write_timestamp (FILE *, const struct TimeStamp *) |
Output TimeStamp structure to a file as a formatted string. More... | |
void | G_get_timestamps (const struct TimeStamp *, struct DateTime *, struct DateTime *, int *) |
Copy TimeStamp into [two] Datetimes structs. More... | |
int | G_format_timestamp (const struct TimeStamp *, char *) |
Create text string from TimeStamp structure. More... | |
int | G_scan_timestamp (struct TimeStamp *, const char *) |
Fill a TimeStamp structure from a datetime string. More... | |
int | G_has_raster_timestamp (const char *, const char *) |
Check if timestamp for raster map exists. More... | |
int | G_read_raster_timestamp (const char *, const char *, struct TimeStamp *) |
Read timestamp from raster map. More... | |
int | G_write_raster_timestamp (const char *, const struct TimeStamp *) |
Write timestamp of raster map. More... | |
int | G_remove_raster_timestamp (const char *) |
Remove timestamp from raster map. More... | |
int | G_has_vector_timestamp (const char *, const char *, const char *) |
Check if timestamp for vector map exists. More... | |
int | G_read_vector_timestamp (const char *, const char *, const char *, struct TimeStamp *) |
Read timestamp from vector map. More... | |
int | G_write_vector_timestamp (const char *, const char *, const struct TimeStamp *) |
Write timestamp of vector map. More... | |
int | G_remove_vector_timestamp (const char *, const char *) |
Remove timestamp from vector map. More... | |
int | G_has_raster3d_timestamp (const char *, const char *) |
Check if timestamp for 3D raster map exists. More... | |
int | G_read_raster3d_timestamp (const char *, const char *, struct TimeStamp *) |
Read timestamp from 3D raster map. More... | |
int | G_remove_raster3d_timestamp (const char *) |
Remove timestamp from 3D raster map. More... | |
int | G_write_raster3d_timestamp (const char *, const struct TimeStamp *) |
Write timestamp of 3D raster map. More... | |
char ** | G_tokenize (const char *, const char *) |
Tokenize string. More... | |
char ** | G_tokenize2 (const char *, const char *, const char *) |
Tokenize string. More... | |
int | G_number_of_tokens (char **) |
Return number of tokens. More... | |
void | G_free_tokens (char **) |
Free memory allocated to tokens. More... | |
void | G_trim_decimal (char *) |
Removes trailing zeros from decimal number. More... | |
double | G_meters_to_units_factor (int) |
Units conversion from meters to units. More... | |
double | G_meters_to_units_factor_sq (int) |
Units conversion from square meters to square units. More... | |
const char * | G_get_units_name (int, int, int) |
Get localized units name. More... | |
int | G_units (const char *) |
Get units code by name. More... | |
int | G_is_units_type_spatial (int) |
Check if the unit is of spatial type. More... | |
int | G_is_units_type_temporal (int) |
Check if the unit is of temporal type. More... | |
char * | G_rc_path (const char *, const char *) |
Returns path to element and item. More... | |
int | G_verbose (void) |
Get current verbosity level. More... | |
int | G_verbose_min (void) |
Get min verbosity level. More... | |
int | G_verbose_std (void) |
Get standard verbosity level. More... | |
int | G_verbose_max (void) |
Get max verbosity level. More... | |
int | G_set_verbose (int) |
Set verbosity level. More... | |
void | G_3dview_warning (int) |
Turns 3D View warnings on and off. More... | |
int | G_get_3dview_defaults (struct G_3dview *, struct Cell_head *) |
Sets default for v based on w. More... | |
int | G_put_3dview (const char *, const struct G_3dview *, const struct Cell_head *) |
Saves info to a 3d.view file in the current mapset. More... | |
int | G_get_3dview (const char *, const char *, struct G_3dview *) |
Gets a 3D View. More... | |
const char * | G_whoami (void) |
Gets user's name. More... | |
void | G_adjust_window_to_box (const struct Cell_head *, struct Cell_head *, int, int) |
Adjusts window to a rectangular box. More... | |
void | G_format_northing (double, char *, int) |
Northing to ASCII. More... | |
void | G_format_easting (double, char *, int) |
Easting to ASCII. More... | |
void | G_format_resolution (double, char *, int) |
Resolution to ASCII. More... | |
int | G_point_in_region (double, double) |
Returns TRUE if coordinate is within the current region settings. More... | |
int | G_point_in_window (double, double, const struct Cell_head *) |
Returns TRUE if coordinate is within the given map region. More... | |
int | G_limit_east (double *, int) |
int | G_limit_west (double *, int) |
int | G_limit_north (double *, int) |
Limit north (y) coordinate. More... | |
int | G_limit_south (double *, int) |
Limit south (y) coordinate. More... | |
int | G_window_overlap (const struct Cell_head *, double, double, double, double) |
Determines if a box overlays a map window. More... | |
double | G_window_percentage_overlap (const struct Cell_head *, double, double, double, double) |
Determines percentage of box is contained in the window. More... | |
int | G_scan_northing (const char *, double *, int) |
ASCII northing to double. More... | |
int | G_scan_easting (const char *, double *, int) |
ASCII easting to double. More... | |
int | G_scan_resolution (const char *, double *, int) |
ASCII resolution to double. More... | |
double | G_adjust_east_longitude (double, double) |
Adjust east longitude. More... | |
double | G_adjust_easting (double, const struct Cell_head *) |
Returns east not smaller than west. More... | |
void | G__init_window (void) |
Initialize window (region). More... | |
void | G_begin_execute (void(*func)(void *), void *, void **, int) |
void | G_end_execute (void **) |
void | G_init_workers (void) |
void | G_finish_workers (void) |
void | G__write_Cell_head (FILE *, const struct Cell_head *, int) |
Write cell header or window. More... | |
void | G__write_Cell_head3 (FILE *, const struct Cell_head *, int) |
Write 3D cell header or window. More... | |
void | G_write_zeros (int, size_t) |
Writes n bytes of zero to file descriptor fd More... | |
void | G_xdr_get_int (int *, const void *) |
void | G_xdr_put_int (void *, const int *) |
void | G_xdr_get_float (float *, const void *) |
void | G_xdr_put_float (void *, const float *) |
void | G_xdr_get_double (double *, const void *) |
void | G_xdr_put_double (void *, const double *) |
void | G_zero (void *, int) |
Zero out a buffer, buf, of length i. More... | |
int | G_zone (void) |
Query cartographic zone. More... | |
#define G_alloca | ( | n | ) | G_malloc(n) |
Definition at line 57 of file defs/gis.h.
Definition at line 95 of file defs/gis.h.
#define G_freea | ( | p | ) | G_free(p) |
Definition at line 58 of file defs/gis.h.
#define G_incr_void_ptr | ( | ptr, | |
size | |||
) | ((void *)((const unsigned char *)(ptr) + (size))) |
Definition at line 81 of file defs/gis.h.
Definition at line 94 of file defs/gis.h.
#define G_realloc | ( | p, | |
n | |||
) | G__realloc(RELDIR "/" __FILE__, __LINE__, (p), (n)) |
Definition at line 96 of file defs/gis.h.
#define RELDIR "?" |
Definition at line 72 of file defs/gis.h.
void void void void __attribute__ | ( | (noreturn) | ) |
void G_3dview_warning | ( | int | b | ) |
void* G__calloc | ( | const char * | file, |
int | line, | ||
size_t | m, | ||
size_t | n | ||
) |
Memory allocation.
Allocates a properly aligned block of memory n*m bytes in length, initializes the allocated memory to zero, and returns a pointer to the allocated block of memory.
Dies with error message on memory allocation fail.
Note: Allocating memory for reading and writing raster maps is discussed in Allocating Raster I/O Buffers.
file | fine name |
line | line number |
m | element size |
n | number of elements |
Definition at line 73 of file gis/alloc.c.
void G__gisinit | ( | const char * | version, |
const char * | pgm | ||
) |
Initialize GIS Library and ensures a valid mapset is available.
version | |
pgm | program (module) name |
void G__init_window | ( | void | ) |
Initialize window (region).
Definition at line 76 of file gis/window_map.c.
References G_get_window(), G_initialize_done(), G_is_initialized(), G__::window, and G__::window_set.
Referenced by G_init_all(), and Rast__init_window().
int G__make_mapset_element_misc | ( | const char * | dir, |
const char * | name | ||
) |
Create misc element in the current mapset.
dir | directory path (e.g., cell_misc ) |
name | element to be created in mapset (e.g., elevation ) |
Definition at line 260 of file mapset_msc.c.
References G_make_mapset_dir_object(), and name.
Referenced by I_fopen_subgroup_file_append(), I_fopen_subgroup_file_new(), Rast__close_null(), and Rast__quant_export().
void* G__malloc | ( | const char * | file, |
int | line, | ||
size_t | n | ||
) |
Memory allocation.
Allocates a block of memory at least n bytes which is aligned properly for all data types. A pointer to the aligned block is returned.
Dies with error message on memory allocation fail.
file | file name |
line | line number |
n | number of elements |
Definition at line 32 of file gis/alloc.c.
void G__no_gisinit | ( | const char * | version | ) |
void G__read_Cell_head | ( | FILE * | fd, |
struct Cell_head * | cellhd | ||
) |
Read cell header (for internal use only)
fp | file descriptor | |
[out] | cellhd | pointer to Cell_head structure |
Definition at line 56 of file rd_cellhd.c.
References count, G__read_Cell_head_array(), G_calloc, G_debug(), G_free(), G_fseek(), G_getl(), and G_store().
Referenced by Rast_get_cellhd().
void G__read_Cell_head_array | ( | char ** | array, |
struct Cell_head * | cellhd | ||
) |
Read window from NULL terminated array of strings (for internal use only)
array | array of strings | |
[out] | cellhd | pointer to Cell_head structure |
Definition at line 96 of file rd_cellhd.c.
Referenced by G__read_Cell_head().
void G__read_gisrc_env | ( | void | ) |
void G__read_gisrc_path | ( | void | ) |
Read or read again the GISRC (session) environment variable.
The GISRC environment variable will be read and its value stored, ignoring if it was read before.
Calls G_fatal_error when the GISRC variable is not set.
Definition at line 125 of file env.c.
References _, G_fatal_error(), and st.
void G__read_mapset_env | ( | void | ) |
Force to read the mapset environment file VAR.
The mapset specific VAR file of the mapset set with G_setenv() will be read into memory, ignoring if it was readed before. Existing values will be overwritten, new values appended.
void* G__realloc | ( | const char * | file, |
int | line, | ||
void * | buf, | ||
size_t | n | ||
) |
Memory reallocation.
Changes the size of a previously allocated block of memory at ptr and returns a pointer to the new block of memory. The size may be larger or smaller than the original size. If the original block cannot be extended "in place", then a new block is allocated and the original block copied to the new block.
Note: If buf is NULL, then this routine simply allocates a block of n bytes else buf must point to memory that has been dynamically allocated by G_malloc(), G_calloc(), G_realloc(), malloc(3), alloc(3), or realloc(3).. This routine works around broken realloc() routines, which do not handle a NULL buf.
file | file name | |
line | line number | |
[in,out] | buf | buffer holding original data |
[in] | n | array size |
Definition at line 119 of file gis/alloc.c.
void G__temp_element | ( | char * | element, |
int | tmp | ||
) |
Populates element with a path string (internal use only!)
[out] | element | element name |
tmp | TRUE to use G_make_mapset_element_tmp() instead of G_make_mapset_element() |
Definition at line 159 of file tempfile.c.
Referenced by G_temp_element(), and Vect__get_path().
void G__temp_element_basedir | ( | char * | element, |
const char * | basedir | ||
) |
Populates element with a path string (internal use only!)
[out] | element | element name |
tmp | TRUE to use G_make_mapset_element_tmp() instead of G_make_mapset_element() |
Definition at line 185 of file tempfile.c.
References G__machine_name(), G_debug(), G_make_mapset_object_group(), G_make_mapset_object_group_basedir(), NULL, and strcpy.
Referenced by G_tempfile_pid_basedir().
void G__write_Cell_head | ( | FILE * | fd, |
const struct Cell_head * | cellhd, | ||
int | is_cellhd | ||
) |
Write cell header or window.
[in,out] | fd | header file |
[in] | cellhd | pointed to cell header structure |
[in] | is_cellhd | 1 cell header; 0 window |
Definition at line 28 of file wr_cellhd.c.
References Cell_head::cols, Cell_head::compressed, Cell_head::east, Cell_head::ew_res, Cell_head::format, G_format_easting(), G_format_northing(), G_format_resolution(), Cell_head::north, Cell_head::ns_res, Cell_head::proj, Cell_head::rows, Cell_head::south, Cell_head::west, and Cell_head::zone.
Referenced by G__write_Cell_head3(), and Rast_put_cellhd().
void G__write_Cell_head3 | ( | FILE * | fd, |
const struct Cell_head * | cellhd, | ||
int | is_cellhd | ||
) |
Write 3D cell header or window.
[in,out] | fd | header file |
[in] | cellhd | pointer to cell header structure |
[in] | is_cellhd | 1 cell header; 0 window |
Definition at line 74 of file wr_cellhd.c.
References Cell_head::bottom, Cell_head::cols3, Cell_head::depths, Cell_head::ew_res3, G__write_Cell_head(), G_format_resolution(), Cell_head::ns_res3, Cell_head::proj, Cell_head::rows3, Cell_head::tb_res, and Cell_head::top.
void G_add_error_handler | ( | void(*)(void *) | func, |
void * | closure | ||
) |
Add new error handler.
Example
func | handler to add |
closure | pointer to closure data |
Definition at line 71 of file gis/handler.c.
Referenced by db_set_error_handler_driver().
void G_add_keyword | ( | const char * | keyword | ) |
void G_add_mapset_to_search_path | ( | const char * | mapset | ) |
Add mapset to the list of mapsets in search path.
Mapset is add in memory only, not to the SEARCH_PATH file! List is check first if already exists.
mapset | mapset name to be added to the search path |
Definition at line 203 of file mapset_nme.c.
References G_is_mapset_in_search_path().
void G_adjust_Cell_head | ( | struct Cell_head * | cellhd, |
int | row_flag, | ||
int | col_flag | ||
) |
Adjust cell header.
This function fills in missing parts of the input cell header (or region). It also makes projection-specific adjustments. The cellhd structure must have its north, south, east, west, and proj fields set.
If row_flag is true, then the north-south resolution is computed from the number of rows in the cellhd structure. Otherwise the number of rows is computed from the north-south resolution in the structure, similarly for col_flag and the number of columns and the east-west resolution.
Note: 3D values are not adjusted.
[in,out] | cellhd | pointer to Cell_head structure |
row_flag | compute n-s resolution | |
col_flag | compute e-w resolution |
Definition at line 51 of file adj_cellhd.c.
References _, Cell_head::cols, Cell_head::ew_res, G_fatal_error(), Cell_head::north, Cell_head::ns_res, Cell_head::proj, PROJECTION_LL, Cell_head::rows, and Cell_head::south.
void G_adjust_Cell_head3 | ( | struct Cell_head * | cellhd, |
int | row_flag, | ||
int | col_flag, | ||
int | depth_flag | ||
) |
Adjust cell header for 3D values.
This function fills in missing parts of the input cell header (or region). It also makes projection-specific adjustments. The cellhd structure must have its north, south, east, west, and proj fields set.
If row_flag is true, then the north-south resolution is computed from the number of rows in the cellhd structure. Otherwise the number of rows is computed from the north-south resolution in the structure, similarly for col_flag and the number of columns and the east-west resolution.
If depth_flag is true, top-bottom resolution is calculated from depths. If depth_flag are false, number of depths is calculated from top-bottom resolution.
[in,out] | cellhd | pointer to Cell_head structure |
row_flag | compute n-s resolution | |
col_flag | compute e-w resolution | |
depth_flag | compute t-b resolution |
Definition at line 163 of file adj_cellhd.c.
References _, Cell_head::cols, Cell_head::cols3, Cell_head::depths, Cell_head::ew_res, Cell_head::ew_res3, G_fatal_error(), Cell_head::north, Cell_head::ns_res, Cell_head::ns_res3, Cell_head::proj, PROJECTION_LL, Cell_head::rows, Cell_head::rows3, Cell_head::south, and Cell_head::tb_res.
double G_adjust_east_longitude | ( | double | east, |
double | west | ||
) |
Adjust east longitude.
This routine returns an equivalent east that is at least as large as the west coordinate.
Note: This routine should be used only with latitude-longitude coordinates.
east | east coordinate |
west | west coordinate |
Definition at line 32 of file gis/window_map.c.
double G_adjust_easting | ( | double | east, |
const struct Cell_head * | window | ||
) |
Returns east not smaller than west.
If the region projection is PROJECTION_LL
, then this routine returns an equivalent east that is not smaller than the coordinate for the western edge of the region and, if possible, smaller than the coordinate for the eastern edge of the region. Otherwise no adjustment is made and the original east is returned.
east | east coordinate |
window | pointer to Cell_head |
Definition at line 58 of file gis/window_map.c.
Referenced by G_plot_where_en().
int G_adjust_window_ll | ( | struct Cell_head * | cellhd | ) |
Adjust window for lat/lon.
This function tries to automatically fix fp precision issues and adjust rounding errors for lat/lon.
Note: 3D values are not adjusted.
[in,out] | cellhd | pointer to Cell_head structure |
Definition at line 552 of file adj_cellhd.c.
References _, Cell_head::east, Cell_head::ew_res, G_fatal_error(), G_lat_format(), G_lat_scan(), G_llres_format(), G_llres_scan(), G_lon_format(), G_lon_scan(), Cell_head::north, Cell_head::ns_res, Cell_head::proj, PROJECTION_LL, Cell_head::south, and Cell_head::west.
void G_adjust_window_to_box | ( | const struct Cell_head * | src, |
struct Cell_head * | dst, | ||
int | rows, | ||
int | cols | ||
) |
Adjusts window to a rectangular box.
Creates a new window dst from a window src which fits into the rectangular box with dimensions rows by cols.
[in] | src | source window |
[in,out] | dst | destination window |
[in] | rows | number of rows in box |
[in] | cols | number of columns in box |
Definition at line 31 of file wind_2_box.c.
int int int G_aprintf | ( | const char * | format, |
... | |||
) |
Adjust the width of string specifiers to the display space instead of the number of bytes for wide characters and print them formatted using the adjusted display width.
compare
ABCD|
and
ABCD|
[in] | format | string format |
[in] | ... | arguments for the format string |
double G_area_for_zone_on_ellipsoid | ( | double | north, |
double | south | ||
) |
Calculates area between latitudes.
This routine shows how to calculate area between two lats, but isn't efficient for row by row since G_darea0_on_ellipsoid() will be called twice for the same lat, once as a south then again as a north.
Returns the area between latitudes north and south scaled by the factor s passed to G_begin_zone_area_on_ellipsoid().
north | north coordinate |
south | south coordinate |
Definition at line 89 of file area_ellipse.c.
References G_darea0_on_ellipsoid().
double G_area_for_zone_on_sphere | ( | double | north, |
double | south | ||
) |
Calculates area between latitudes.
This routine shows how to calculate area between two lats, but isn't efficient for row by row since G_darea0_on_sphere() will be called twice for the same lat, once as a south then again as a north.
Returns the area between latitudes north and south scaled by the factor s passed to G_begin_zone_area_on_sphere().
north | ||
[in] | south |
Definition at line 69 of file area_sphere.c.
References G_darea0_on_sphere().
double G_area_of_cell_at_row | ( | int | row | ) |
Cell area in specified row.
This routine returns the area in square meters of a cell in the specified row. This value is constant for planimetric grids and varies with the row if the projection is latitude-longitude.
row | row number |
Definition at line 87 of file gis/area.c.
References PROJECTION_LL, and st.
double G_area_of_polygon | ( | const double * | x, |
const double * | y, | ||
int | n | ||
) |
Area in square meters of polygon.
Returns the area in square meters of the polygon described by the n pairs of x,y coordinate vertices. It is used both for planimetric and latitude-longitude projections.
You should call G_begin_polygon_area_calculations() function before calling this function.
Note: If the database is planimetric with the non-meter grid, this routine performs the required unit conversion to produce square meters.
x | array of x coordinates |
y | array of y coordinates |
n | number of x,y coordinate pairs |
Definition at line 159 of file gis/area.c.
References G_ellipsoid_polygon_area(), G_planimetric_polygon_area(), PROJECTION_LL, st, and x.
void G_ascii_check | ( | char * | string | ) |
Removes non-ascii characters from buffer.
Updates string with non_ascii characters removed, except for tabs, which are turned into spaces.
[in,out] | string | buffer to have non-ascii characters removed |
Definition at line 31 of file ascii_chk.c.
Referenced by Rast__read_history().
int G_asprintf | ( | char ** | , |
const char * | , | ||
... | |||
) |
char* G_basename | ( | char * | filename, |
const char * | desired_ext | ||
) |
Truncates filename to the base part (before the last '.') if it matches the extension, otherwise leaves it unchanged.
Checks if a filename matches a certain file extension (case insensitive) and if so, truncates the string to the base file name (cf. basename Unix command)
filename | string containing filename |
desired_ext | string containing extension to look for (case insensitive) |
Definition at line 36 of file basename.c.
Referenced by G_parser().
int G_begin_cell_area_calculations | ( | void | ) |
Begin cell area calculations.
This routine must be called once before any call to G_area_of_cell_at_row(). It perform all inititalizations needed to do area calculations for grid cells, based on the current window "projection" field. It can be used in either planimetric projections or the latitude-longitude projection.
Definition at line 46 of file gis/area.c.
int int G_begin_distance_calculations | ( | void | ) |
Begin distance calculations.
Initializes the distance calculations. It is used both for the planimetric and latitude-longitude projections.
Definition at line 42 of file gis/distance.c.
Referenced by Vect_line_geodesic_distance().
void G_begin_ellipsoid_polygon_area | ( | double | a, |
double | e2 | ||
) |
Begin area calculations.
This initializes the polygon area calculations for the ellipsoid with semi-major axis a (in meters) and ellipsoid eccentricity squared e2.
a | semi-major axis |
e2 | ellipsoid eccentricity squared |
Definition at line 66 of file area_poly1.c.
void G_begin_execute | ( | void(*)(void *) | func, |
void * | , | ||
void ** | , | ||
int | |||
) |
void G_begin_geodesic_distance | ( | double | a, |
double | e2 | ||
) |
Begin geodesic distance.
Initializes the distance calculations for the ellipsoid with semi-major axis a (in meters) and ellipsoid eccentricity squared e2. It is used only for the latitude-longitude projection.
Note: Must be called once to establish the ellipsoid.
a | semi-major axis in meters |
e2 | ellipsoid eccentricity |
int G_begin_geodesic_equation | ( | double | lon1, |
double | lat1, | ||
double | lon2, | ||
double | lat2 | ||
) |
Definition at line 38 of file geodesic.c.
int G_begin_polygon_area_calculations | ( | void | ) |
Begin polygon area calculations.
This initializes the polygon area calculation routines. It is used both for planimetric and latitude-longitude projections.
Definition at line 120 of file gis/area.c.
int G_begin_rhumbline_equation | ( | double | lon1, |
double | lat1, | ||
double | lon2, | ||
double | lat2 | ||
) |
Start rhumbline calculations.
Note: This function must be called before other rhumbline functions to initialize parameters.
[in] | lon1,lat1 | longitude, latitude of first point |
[in] | lon2,lat2 | longitude, latitude of second point |
Definition at line 58 of file rhumbline.c.
void G_begin_zone_area_on_ellipsoid | ( | double | a, |
double | e2, | ||
double | s | ||
) |
Begin area calculations for ellipsoid.
Initializes raster area calculations for an ellipsoid, where a is the semi-major axis of the ellipse (in meters), e2 is the ellipsoid eccentricity squared, and s is a scale factor to allow for calculations of part of the zone (s=1.0 is full zone, s=0.5 is half the zone, and s=360/ew_res is for a single grid cell).
Note: e2 must be positive. A negative value makes no sense, and zero implies a sphere.
a | semi-major axis |
e2 | ellipsoid eccentricity |
s | scale factor |
Definition at line 47 of file area_ellipse.c.
void G_begin_zone_area_on_sphere | ( | double | r, |
double | s | ||
) |
Initialize calculations for sphere.
Initializes raster area calculations for a sphere. The radius of the sphere is r and s is a scale factor to allow for calculations of a part of the zone (see G_begin_zone_area_on_ellipsoid()).
r | radius of sphere |
s | scale factor |
Definition at line 35 of file area_sphere.c.
void G_bresenham_line | ( | int | x0, |
int | y0, | ||
int | x1, | ||
int | y1, | ||
int(*)(int, int) | point | ||
) |
Bresenham line algorithm.
Draws a line from x1,y1 to x2,y2 using Bresenham's algorithm. A routine to plot points must be provided, as is defined as: point(x, y) plot a point at x,y.
This routine does not require a previous call to G_setup_plot() to function correctly, and is independent of all following routines.
x0,y0 | first point |
x1,y1 | end point |
point | pointer to point plotting function |
Definition at line 30 of file bres_line.c.
int G_bz2_compress | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz | ||
) |
Definition at line 85 of file cmprbzip.c.
References _, dst, err(), G_bz2_compress_bound(), G_calloc, G_fatal_error(), G_free(), G_warning(), NULL, and src.
int G_bz2_expand | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz | ||
) |
Definition at line 168 of file cmprbzip.c.
References _, dst, err(), G_fatal_error(), G_warning(), NULL, and src.
int G_check_compressor | ( | int | number | ) |
Definition at line 140 of file compress.c.
Referenced by Rast__open_old().
int G_check_input_output_name | ( | const char * | input, |
const char * | output, | ||
int | error | ||
) |
Check input and output file names.
Check: 1) output is legal map name, 2) if can find input map, and 3) if input was found in current mapset, check if input != output.
input | input map name |
output | output map name |
error | error type: G_FATAL_EXIT, G_FATAL_PRINT, G_FATAL_RETURN |
Definition at line 71 of file legal_name.c.
int G_check_overwrite | ( | int | argc, |
char ** | argv | ||
) |
Check for overwrite mode.
Check variables OVERWRITE, GRASS_OVERWRITE and '–o' flag.
The parser G_parser() checks if the map already exists in current mapset, we can switch out the check and do it in the module after the parser.
argc | number of arguments |
argv | array of arguments |
Definition at line 34 of file overwrite.c.
References G_getenv_nofatal(), and G_setenv_nogisrc().
char* G_chop | ( | char * | line | ) |
Chop leading and trailing white spaces.
space, \f, \n, \r, \t, \v
Modified copy of G_squeeze() by RB in March 2000.
line | buffer to be worked on |
Definition at line 332 of file strings.c.
Referenced by check_create_export_opts(), check_create_import_opts(), check_mapset_in_layer_name(), dig_read_frmt_ascii(), G_str_to_color(), and read_coor().
void G_close_mail | ( | struct Popen * | ) |
Definition at line 65 of file pager.c.
References G_popen_close().
void G_close_option_file | ( | FILE * | fp | ) |
Close an input/output file returned by G_open_option_file(). If the file pointer is stdin, stdout, or stderr, nothing happens.
file | pointer |
void G_close_pager | ( | struct Popen * | pager | ) |
Definition at line 35 of file pager.c.
References G_popen_close().
const char* G_color_name | ( | int | n | ) |
Definition at line 35 of file named_colr.c.
char* G_color_rules_description_type | ( | void | ) |
Get color rules description for Option->descriptions.
The type of color rule including range is appended to the description
Definition at line 124 of file gis/color_rules.c.
References name.
Referenced by G_define_standard_option().
char* G_color_rules_descriptions | ( | void | ) |
Get color rules description for Option->descriptions.
Definition at line 79 of file gis/color_rules.c.
char* G_color_rules_options | ( | void | ) |
Get list of color rules for Option->options.
Definition at line 40 of file gis/color_rules.c.
References list, name, and NULL.
Referenced by G_define_standard_option().
int G_color_values | ( | const char * | name, |
float * | r, | ||
float * | g, | ||
float * | b | ||
) |
Definition at line 20 of file named_colr.c.
int G_compare_projections | ( | const struct Key_Value * | proj_info1, |
const struct Key_Value * | proj_units1, | ||
const struct Key_Value * | proj_info2, | ||
const struct Key_Value * | proj_units2 | ||
) |
Compare projections including units.
proj_info1 | projection info to compare |
proj_units1 | projection units to compare |
proj_info2 | projection info to compare |
proj_units2 | projection units to compare |
Definition at line 231 of file make_loc.c.
References G_find_key_value(), NULL, and TRUE.
int G_compress | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz, | ||
int | number | ||
) |
Definition at line 218 of file compress.c.
Referenced by G_write_compressed().
int G_compress_bound | ( | int | src_sz, |
int | number | ||
) |
Definition at line 202 of file compress.c.
Referenced by G_write_compressed().
char* G_compressor_name | ( | int | number | ) |
Definition at line 118 of file compress.c.
Referenced by Rast__open_old().
int G_compressor_number | ( | char * | name | ) |
Definition at line 100 of file compress.c.
References compressor, G_strcasecmp(), compressor_list::name, and name.
const char* G_config_path | ( | void | ) |
Get user's config path directory.
Returns a pointer to a string which is the full path name of the user's GRASS config directory in their home directory.
The path is not guaranteed to exist.
Definition at line 98 of file home.c.
References _, CONFIG_DIR, G_fatal_error(), G_home(), G_initialize_done(), G_is_initialized(), G_mkdir(), G_store(), GPATH_MAX, HOST_DIRSEP, and NULL.
char* G_convert_dirseps_from_host | ( | char * | path | ) |
Converts directory separator characters in a string from the native host character to the GRASS separator character (/)
path | String to be converted |
Definition at line 105 of file paths.c.
References GRASS_DIRSEP, and HOST_DIRSEP.
char* G_convert_dirseps_to_host | ( | char * | path | ) |
Converts directory separator characters in a string to the native host separator character (/ on Unix, \ on Windows)
path | String to be converted |
Definition at line 83 of file paths.c.
References GRASS_DIRSEP, and HOST_DIRSEP.
int G_copy_file | ( | const char * | infile, |
const char * | outfile | ||
) |
Copies one file to another.
Creates a copy of a file. The destination file will be overwritten if it already exists, so the calling module should check this first if it is important.
infile | String containing path to source file |
outfile | String containing path to destination file |
Definition at line 33 of file copy_file.c.
References G_warning(), and NULL.
Referenced by G_rename_file().
int G_counter_next | ( | struct Counter * | c | ) |
Definition at line 46 of file counter.c.
Referenced by G_tempfile_pid(), and G_tempfile_pid_basedir().
void G_create_alt_env | ( | void | ) |
void G_create_alt_search_path | ( | void | ) |
struct Key_Value* G_create_key_value | ( | void | ) |
Allocate and initialize Key_Value structure.
Definition at line 23 of file key_value1.c.
References G_malloc, and G_zero().
Referenced by GPJ_osr_to_grass().
double G_darea0_on_ellipsoid | ( | double | lat | ) |
Calculate integral for area between two latitudes.
This routine is part of the integral for the area between two latitudes.
lat | latitude |
Definition at line 63 of file area_ellipse.c.
References Radians, st, and x.
Referenced by G_area_for_zone_on_ellipsoid().
double G_darea0_on_sphere | ( | double | lat | ) |
Calculates integral for area between two latitudes.
lat | latitude |
Definition at line 47 of file area_sphere.c.
Referenced by G_area_for_zone_on_sphere().
const char* G_database_datum_name | ( | void | ) |
Get datum name for the current location.
Returns a pointer to the name of the map datum of the current database. If there is no map datum explicitly associated with the actual database, the standard map datum WGS84 is returned, on error a NULL pointer is returned.
Definition at line 186 of file proj3.c.
References name.
const char* G_database_ellipse_name | ( | void | ) |
const char* G_database_epsg_code | ( | void | ) |
const char* G_database_projection_name | ( | void | ) |
Query cartographic projection for the current location.
Returns a pointer to a string which is a printable name for projection code proj (as returned by G_projection). Returns NULL if proj is not a valid projection.
Definition at line 118 of file proj3.c.
References G_projection(), G_projection_name(), name, PROJECTION_LL, PROJECTION_UTM, and PROJECTION_XY.
Referenced by Vect_get_proj_name().
int G_database_unit | ( | void | ) |
Get units id for the current location.
Definition at line 66 of file proj3.c.
References G_projection(), G_projection_units(), name, and U_UNDEFINED.
Referenced by G_database_unit_name().
const char* G_database_unit_name | ( | int | plural | ) |
Get units (localized) name for the current location.
Returns a string describing the database grid units. It returns a plural form (eg. 'feet') if plural is non-zero. Otherwise it returns a singular form (eg. 'foot').
plural | plural form if non-zero |
Definition at line 53 of file proj3.c.
References FALSE, G_database_unit(), and G_get_units_name().
Referenced by G_get_units_name(), G_units(), and gsd_scalebar().
double G_database_units_to_meters_factor | ( | void | ) |
Conversion to meters.
Returns a factor which converts the grid unit to meters (by multiplication). If the database is not metric (eg. imagery) then 0.0 is returned.
Definition at line 146 of file proj3.c.
Referenced by N_init_geom_data_3d().
const char* G_date | ( | void | ) |
Current date and time.
Returns a pointer to a string which is the current date and time. The format is the same as that produced by the UNIX date
command.
Definition at line 26 of file date.c.
Referenced by Vect__init_head(), and Vect_hist_command().
const char* G_datum_description | ( | int | n | ) |
Definition at line 66 of file gis/datum.c.
References G_read_datum_table().
const char* G_datum_ellipsoid | ( | int | n | ) |
Definition at line 76 of file gis/datum.c.
References G_read_datum_table().
const char* G_datum_name | ( | int | n | ) |
Definition at line 56 of file gis/datum.c.
References G_read_datum_table().
int G_debug | ( | int | , |
const char * | , | ||
... | |||
) |
Referenced by add_coor(), alloc_statistics(), Cairo_Color(), Cairo_end_raster(), Cairo_Erase(), Cairo_Graph_close(), Cairo_Graph_set(), cairo_read_image(), Cairo_Set_window(), cairo_write_image(), check_create_import_opts(), close_band_files(), db__driver_begin_transaction(), db__driver_commit_transaction(), db_close_database_shutdown_driver(), db_d_init_error(), db_delete_table(), db_get_login_dump(), db_set_default_connection(), db_start_driver_open_database(), dig__read_head(), dig__write_head(), dig_add_node(), dig_area_add_isle(), dig_area_del_isle(), dig_cidx_free(), dig_cidx_init(), dig_cidx_sort(), dig_find_area_box(), dig_find_isle_box(), dig_find_node(), dig_free_plus(), dig_free_plus_areas(), dig_free_plus_isles(), dig_free_plus_lines(), dig_free_plus_nodes(), dig_init_plus(), dig_load_plus(), dig_node_add_updated(), dig_node_line_angle(), dig_Rd_P_area(), dig_Rd_P_isle(), dig_Rd_P_line(), dig_Rd_P_node(), dig_Rd_Plus_head(), dig_Rd_spidx(), dig_Rd_spidx_head(), dig_read_cidx(), dig_read_cidx_head(), dig_read_frmt_ascii(), dig_select_areas(), dig_select_isles(), dig_select_lines(), dig_select_nodes(), dig_spidx_add_area(), dig_spidx_add_isle(), dig_spidx_add_node(), dig_spidx_del_area(), dig_spidx_del_isle(), dig_spidx_del_node(), dig_spidx_init(), dig_Wr_P_line(), dig_Wr_P_node(), dig_Wr_Plus_head(), dig_Wr_spidx(), dig_Wr_spidx_head(), dig_write_cidx_head(), free_perimeters(), G__read_Cell_head(), G__temp_element_basedir(), G_find_raster(), G_find_raster2(), G_find_vector(), G_find_vector2(), G_get_available_mapsets(), G_get_projepsg(), G_has_vector_timestamp(), G_math_add_spvector(), G_math_alloc_spmatrix(), G_math_alloc_spvector(), G_option_to_separator(), G_str_to_color(), get_key_data(), GP_delete_site(), gp_delete_site(), GP_draw_site(), gp_free_site(), gp_get_last_site(), gp_get_prev_site(), gp_get_site(), GP_get_trans(), GP_get_zmode(), gp_init_site(), GP_select_surf(), gp_set_defaults(), GP_set_trans(), GP_set_zmode(), GP_site_exists(), GP_surf_is_selected(), GP_unselect_surf(), GP_unset_style_thematic(), GPJ__get_datum_params(), GPJ_init_transform(), GPJ_osr_to_grass(), gs_calc_normals(), GS_clear(), GS_default_draw_color(), gs_delete_surf(), GS_delete_surface(), GS_done_draw(), GS_draw_fringe(), GS_draw_surf(), GS_draw_wire(), gs_free_surf(), gs_get_att_src(), gs_get_att_typbuff(), gs_get_att_type(), GS_get_drawres(), GS_get_exag_guess(), GS_get_focus(), GS_get_modelposition1(), gs_get_prev_surface(), gs_get_surf(), GS_get_to(), GS_get_trans(), GS_get_zextents(), GS_global_exag(), gs_init_surf(), gs_malloc_lookup(), GS_moveto(), GS_new_surface(), gs_num_datah_reused(), GS_ready_draw(), gs_set_att_const(), GS_set_att_defaults(), gs_set_att_src(), gs_set_defaults(), GS_set_drawres(), GS_set_exag(), GS_set_focus(), GS_set_focus_center_map(), GS_set_global_exag(), GS_set_infocus(), GS_set_nofocus(), GS_set_trans(), GS_set_viewport(), GS_set_wire_color(), GS_surf_exists(), Gs_update_attrange(), gs_update_curmask(), gsd_surf(), gsd_wire_arrows(), gsd_wire_surf(), gsd_wire_surf_const(), gsd_wire_surf_map(), gsds_free_datah(), gv_delete_vect(), GV_delete_vector(), gv_get_prev_vect(), gv_get_vect(), gv_init_vect(), gv_set_defaults(), GV_set_trans(), GV_unset_style_thematic(), GV_vect_exists(), gvd_vect(), GVL_delete_vol(), gvl_delete_vol(), GVL_draw_wire(), gvl_file_free_datah(), gvl_free_vol(), GVL_get_dims(), gvl_get_last_vol(), gvl_get_new_vol(), gvl_get_prev_vol(), gvl_get_vol(), gvl_getall_vols(), gvl_init_vol(), GVL_isosurf_add(), GVL_isosurf_del(), gvl_isosurf_freemem(), GVL_isosurf_get_att(), gvl_isosurf_get_att_src(), GVL_isosurf_get_drawres(), GVL_isosurf_get_flags(), gvl_isosurf_get_isosurf(), gvl_isosurf_init(), GVL_isosurf_num_isosurfs(), gvl_isosurf_set_att_changed(), gvl_isosurf_set_att_const(), GVL_isosurf_set_att_const(), gvl_isosurf_set_att_src(), GVL_isosurf_set_drawres(), GVL_isosurf_set_flags(), GVL_isosurf_unset_att(), GVL_new_vol(), GVL_set_draw_wire(), GVL_set_focus_center_map(), GVL_set_trans(), GVL_slice_get_drawres(), GVL_slice_num_slices(), GVL_slice_set_drawres(), GVL_vol_exists(), gvld_vol(), gvld_wind3_box(), gvld_wire_vol(), I_cluster_exec_allocate(), I_cluster_sum2(), I_find_subgroup(), I_find_subgroup2(), I_find_subgroup_file(), I_find_subgroup_file2(), I_iclass_add_signature(), I_iclass_analysis(), I_iclass_free_statistics(), I_iclass_init_group(), I_iclass_init_signatures(), I_iclass_init_statistics(), IL_write_point_2d(), M_do_copy(), make_all_statistics(), N_alloc_gradient_field_2d(), N_alloc_gradient_field_3d(), N_calc_gradient_field_2d_stats(), N_calc_gradient_field_3d_stats(), N_compute_gradient_field_2d(), N_compute_gradient_field_3d(), N_copy_array_2d(), N_copy_array_3d(), N_copy_gradient_2d(), N_copy_gradient_3d(), N_copy_gradient_field_2d(), N_copy_gradient_field_3d(), N_copy_gradient_neighbours_2d(), N_copy_gradient_neighbours_3d(), N_copy_gradient_neighbours_x(), N_copy_gradient_neighbours_y(), N_copy_gradient_neighbours_z(), N_create_27star(), N_create_5star(), N_create_7star(), N_create_9star(), N_create_gradient_2d(), N_create_gradient_3d(), N_create_gradient_neighbours_2d(), N_create_gradient_neighbours_3d(), N_create_gradient_neighbours_x(), N_create_gradient_neighbours_y(), N_create_gradient_neighbours_z(), N_free_les(), N_get_geom_data_area_of_cell(), N_get_gradient_2d(), N_get_gradient_neighbours_2d(), N_init_geom_data_3d(), N_les_integrate_dirichlet_2d(), N_les_integrate_dirichlet_3d(), Nviz_get_exag(), Nviz_get_exag_height(), Nviz_get_viewpoint_position(), Nviz_look_here(), Nviz_set_rotation(), Nviz_set_viewpoint_persp(), Nviz_set_viewpoint_position(), Nviz_set_viewpoint_twist(), open_band_files(), P_Create_Aux2_Table(), P_Create_Aux4_Table(), perimeter_add_point(), pg_addedge(), PNG_Graph_set(), print_vol_fields(), Rast__create_window_mapping(), Rast_get_next_marked_d_cat(), Rast_read_fp_range(), Rast_sort_cats(), Rast_unset_window(), rbtree_traverse(), rbtree_traverse_backwd(), read_band_row(), read_coor(), seg_setup(), sort_intersection_list(), sub_Vectmem(), V1_close_nat(), V1_close_ogr(), V1_close_pg(), V1_delete_line_nat(), V1_delete_line_ogr(), V1_delete_line_pg(), V1_open_new_nat(), V1_open_new_ogr(), V1_open_new_pg(), V1_open_old_nat(), V1_open_old_ogr(), V1_open_old_pg(), V1_read_next_line_nat(), V1_read_next_line_pg(), V1_rewind_ogr(), V1_rewind_pg(), V2_close_ogr(), V2_close_pg(), V2_open_old_ogr(), V2_open_old_pg(), V2_rewind_ogr(), V2_rewind_pg(), Vect__execute_get_value_pg(), Vect__execute_pg(), Vect__insert_face_pg(), Vect__load_map_lines_pg(), Vect__load_map_nodes_pg(), Vect__load_plus_head(), Vect__open_cursor_next_line_pg(), Vect__read_head(), Vect_array_to_cat_list(), Vect_attach_isle(), Vect_attach_isles(), Vect_build_line_area(), Vect_build_ogr(), Vect_build_partial(), Vect_build_pg(), Vect_build_sidx_from_topo(), Vect_cat_list_to_array(), Vect_check_dblink(), Vect_cidx_dump(), Vect_cidx_get_field_index(), Vect_cidx_open(), Vect_cidx_save(), Vect_close(), Vect_coor_info(), Vect_copy(), Vect_find_area(), Vect_find_node(), Vect_get_area_centroid(), Vect_get_area_isle(), Vect_get_area_num_isles(), Vect_get_area_points(), Vect_get_area_points_geos(), Vect_get_dblink(), Vect_get_field(), Vect_get_field2(), Vect_get_field_by_name(), Vect_get_field_number(), Vect_get_finfo_dsn_name(), Vect_get_finfo_geometry_type(), Vect_get_finfo_layer_name(), Vect_get_isle_area(), Vect_get_isle_points(), Vect_get_isle_points_geos(), Vect_get_next_line_id(), Vect_get_proj_name(), Vect_graph_add_edge(), Vect_graph_build(), Vect_graph_init(), Vect_graph_set_node_costs(), Vect_hist_command(), Vect_hist_copy(), Vect_hist_rewind(), Vect_hist_write(), Vect_line_parallel2(), Vect_map_del_dblink(), Vect_net_get_node_cost(), Vect_open_fidx(), Vect_open_new(), Vect_open_tmp_new(), Vect_open_topo(), Vect_point_buffer2(), Vect_read_dblinks(), Vect_read_next_line(), Vect_rewind(), Vect_save_fidx(), Vect_save_sidx(), Vect_save_topo(), Vect_select_areas_by_polygon(), Vect_select_isles_by_box(), Vect_select_nodes_by_box(), Vect_set_thresh(), Vect_set_updated(), Vect_spatial_index_add_item(), Vect_spatial_index_del_item(), Vect_spatial_index_destroy(), Vect_spatial_index_init(), Vect_write_dblinks(), vector2perimeters(), Vedit_delete_area_centroid(), Vedit_delete_areas_cat(), and Vedit_get_min_distance().
int G_default_compressor | ( | void | ) |
Definition at line 126 of file compress.c.
struct Flag* G_define_flag | ( | void | ) |
Initializes a Flag struct.
Allocates memory for the Flag structure and returns a pointer to this memory.
Flags are always represented by single letters. A user "turns them on" at the command line using a minus sign followed by the character representing the flag.
Definition at line 157 of file parser.c.
References G_malloc, G_zero(), NULL, and st.
Referenced by G_define_standard_flag().
struct GModule* G_define_module | ( | void | ) |
struct Option* G_define_option | ( | void | ) |
Initializes an Option struct.
Allocates memory for the Option structure and returns a pointer to this memory.
Options are provided by user on command line using the standard format: key=value. Options identified as REQUIRED must be specified by user on command line. The option string can either specify a range of values (e.g. "10-100") or a list of acceptable values (e.g. "red,orange,yellow"). Unless the option string is NULL, user provided input will be evaluated against this string.
Definition at line 211 of file parser.c.
References G_malloc, G_zero(), Option::multiple, NO, Option::required, and st.
Referenced by G_define_standard_option(), M_define_option(), and N_define_standard_option().
struct Flag* G_define_standard_flag | ( | int | flag | ) |
Create standardised Flag structure.
This function will create a standardised Flag structure defined by parameter flag. A list of valid parameters below. It allocates memory for the Flag structure and returns a pointer to this memory.
If an invalid parameter was specified a empty Flag structure will be returned (not NULL).
flag | type of Flag struct to create specified by STD_FLG enum. |
Definition at line 997 of file parser_standard_options.c.
References _, Flag::description, G_define_flag(), G_FLG_V_TABLE, G_FLG_V_TOPO, Flag::key, and Flag::label.
struct Option* G_define_standard_option | ( | int | opt | ) |
Create standardised Option structure.
This function will create a standardised Option structure defined by parameter opt.
Valid parameters are defined by the STD_OPT enum in the file gis.h. A list of valid parameter values sorted to groups is below.
This function allocates memory for the Option structure and returns a pointer to this memory.
If an invalid parameter was specified a empty Option structure will be returned (not NULL).
Values also need to be added to general/g.parser/standard_option.c
opt | type of Option struct to create specified by STD_OPT enum |
Definition at line 140 of file parser_standard_options.c.
References _, Option::answer, DEFAULT_FG_COLOR, Option::description, Option::descriptions, G_asprintf(), G_color_rules_description_type(), G_color_rules_options(), G_define_option(), G_getenv_nofatal(), G_OPT_C, G_OPT_C_FORMAT, G_OPT_CN, G_OPT_DB_COLUMN, G_OPT_DB_COLUMNS, G_OPT_DB_DATABASE, G_OPT_DB_DRIVER, G_OPT_DB_KEYCOLUMN, G_OPT_DB_SCHEMA, G_OPT_DB_SQL, G_OPT_DB_TABLE, G_OPT_DB_WHERE, G_OPT_F_BIN_INPUT, G_OPT_F_FORMAT, G_OPT_F_INPUT, G_OPT_F_OUTPUT, G_OPT_F_SEP, G_OPT_I_GROUP, G_OPT_I_SUBGROUP, G_OPT_M_COLR, G_OPT_M_COORDS, G_OPT_M_DATATYPE, G_OPT_M_DBASE, G_OPT_M_DIR, G_OPT_M_LOCATION, G_OPT_M_MAPSET, G_OPT_M_NPROCS, G_OPT_M_NULL_VALUE, G_OPT_M_REGION, G_OPT_M_UNITS, G_OPT_MAP_INPUT, G_OPT_MAP_INPUTS, G_OPT_MAP_TYPE, G_OPT_MEMORYMB, G_OPT_R3_COMPRESSION, G_OPT_R3_INPUT, G_OPT_R3_INPUTS, G_OPT_R3_MAP, G_OPT_R3_MAPS, G_OPT_R3_OUTPUT, G_OPT_R3_PRECISION, G_OPT_R3_TILE_DIMENSION, G_OPT_R3_TYPE, G_OPT_R_BASE, G_OPT_R_BASENAME_INPUT, G_OPT_R_BASENAME_OUTPUT, G_OPT_R_COVER, G_OPT_R_ELEV, G_OPT_R_ELEVS, G_OPT_R_INPUT, G_OPT_R_INPUTS, G_OPT_R_INTERP_TYPE, G_OPT_R_MAP, G_OPT_R_MAPS, G_OPT_R_OUTPUT, G_OPT_R_OUTPUTS, G_OPT_R_TYPE, G_OPT_STDS_INPUT, G_OPT_STDS_INPUTS, G_OPT_STDS_OUTPUT, G_OPT_STDS_TYPE, G_OPT_STR3DS_INPUT, G_OPT_STR3DS_INPUTS, G_OPT_STR3DS_OUTPUT, G_OPT_STRDS_INPUT, G_OPT_STRDS_INPUTS, G_OPT_STRDS_OUTPUT, G_OPT_STRDS_OUTPUTS, G_OPT_STVDS_INPUT, G_OPT_STVDS_INPUTS, G_OPT_STVDS_OUTPUT, G_OPT_T_SAMPLE, G_OPT_T_TYPE, G_OPT_T_WHERE, G_OPT_V3_TYPE, G_OPT_V_CAT, G_OPT_V_CATS, G_OPT_V_FIELD, G_OPT_V_FIELD_ALL, G_OPT_V_ID, G_OPT_V_IDS, G_OPT_V_INPUT, G_OPT_V_INPUTS, G_OPT_V_MAP, G_OPT_V_MAPS, G_OPT_V_OUTPUT, G_OPT_V_TYPE, G_store(), Option::gisprompt, GV_KEY_COLUMN, Option::key, Option::key_desc, Option::label, Option::multiple, NO, Option::options, Option::required, Option::type, TYPE_DOUBLE, TYPE_INTEGER, TYPE_STRING, and YES.
void G_disable_interactive | ( | void | ) |
Disables the ability of the parser to operate interactively.
When a user calls a command with no arguments on the command line, the parser will enter its own standardized interactive session in which all flags and options are presented to the user for input. A call to G_disable_interactive() disables the parser's interactive prompting.
Definition at line 140 of file parser.c.
References st.
double G_distance | ( | double | e1, |
double | n1, | ||
double | e2, | ||
double | n2 | ||
) |
Returns distance in meters.
This routine computes the distance, in meters, from x1,y1 to x2,y2. If the projection is latitude-longitude, this distance is measured along the geodesic. Two routines perform geodesic distance calculations.
e1,n1 | east-north coordinates of first point |
e2,n2 | east-north coordinates of second point |
Definition at line 75 of file gis/distance.c.
References G_geodesic_distance(), PROJECTION_LL, and st.
Referenced by Vect_line_geodesic_distance().
double G_distance2_point_to_line | ( | double | x, |
double | y, | ||
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Definition at line 15 of file gis/line_dist.c.
double G_distance_between_line_segments | ( | double | ax1, |
double | ay1, | ||
double | ax2, | ||
double | ay2, | ||
double | bx1, | ||
double | by1, | ||
double | bx2, | ||
double | by2 | ||
) |
Returns distance between two line segments in meters.
ax1,ay1,ax2,ay2 | first segment |
bx1,by1,bx2,by2 | second segment |
Definition at line 91 of file gis/distance.c.
References G_intersect_line_segments(), and x.
double G_distance_point_to_line_segment | ( | double | xp, |
double | yp, | ||
double | x1, | ||
double | y1, | ||
double | x2, | ||
double | y2 | ||
) |
Returns distance between a point and line segment in meters.
xp,yp | point coordinates |
x1,y1 | segment point coordinates |
x2,y2 | segment point coordinates |
Definition at line 117 of file gis/distance.c.
void G_done_msg | ( | const char * | , |
... | |||
) |
char* G_double_to_basename_format | ( | double | number, |
size_t | ndigits, | ||
size_t | ndecimals | ||
) |
Convert a double to a string substituting the dot with underscore 12.3456 => '12_3456'.
number | the double number that will be convert to string |
ndigits | the number of integer digits in the output string |
ndecimals | the number of decimals in the output string |
Definition at line 76 of file basename.c.
References G_malloc, and GNAME_MAX.
Referenced by G_generate_basename().
double G_drand48 | ( | void | ) |
Generate a floating-point value in the range [0,1)
Definition at line 166 of file lrand48.c.
References r.
Referenced by G_math_rand().
const char* G_ellipsoid_description | ( | int | n | ) |
Get description for nth ellipsoid.
This function returns a pointer to the description text for the nth ellipsoid. If n is less than 0 or greater than the number of known ellipsoids, it returns a NULL pointer.
n | ellipsoid identificator |
Definition at line 182 of file get_ellipse.c.
References G_read_ellipsoid_table().
const char* G_ellipsoid_name | ( | int | n | ) |
Get ellipsoid name.
This function returns a pointer to the short name for the nth ellipsoid. If n is less than 0 or greater than the number of known ellipsoids, it returns a NULL pointer.
n | ellipsoid identificator |
Definition at line 132 of file get_ellipse.c.
References G_read_ellipsoid_table().
double G_ellipsoid_polygon_area | ( | const double * | lon, |
const double * | lat, | ||
int | n | ||
) |
Area of lat-long polygon.
Returns the area in square meters of the polygon described by the n pairs of lat,long vertices for latitude-longitude grids.
Note: This routine computes the area of a polygon on the ellipsoid. The sides of the polygon are rhumb lines and, in general, not geodesics. Each side is actually defined by a linear relationship between latitude and longitude, i.e., on a rectangular/equidistant cylindrical/Plate Carr{'e}e grid, the side would appear as a straight line. For two consecutive vertices of the polygon, (lat_1, long1) and (lat_2,long_2), the line joining them (i.e., the polygon's side) is defined by:
lat_2 - lat_1 lat = lat_1 + (long - long_1) * --------------- long_2 - long_1
where long_1 < long < long_2. The values of QbarA, etc., are determined by the integration of the Q function. Into www.integral-calculator.com, paste this expression :
sin(x)+ (2/3)e^2(sin(x))^3 + (3/5)e^4(sin(x))^5 + (4/7)e^6(sin(x))^7
and you'll get their values. (Last checked 30 Oct 2013).
This function correctly computes (within the limits of the series approximation) the area of a quadrilateral on the ellipsoid when two of its sides run along meridians and the other two sides run along parallels of latitude.
lon | array of longitudes |
lat | array of latitudes |
n | number of lat,lon pairs |
Definition at line 134 of file area_poly1.c.
Referenced by G_area_of_polygon().
void G_end_execute | ( | void ** | ) |
int G_expand | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz, | ||
int | number | ||
) |
Definition at line 233 of file compress.c.
Referenced by G_read_compressed().
int G_faprintf | ( | FILE * | stream, |
const char * | format, | ||
... | |||
) |
fprintf() version of G_aprintf(). See G_aprintf() for more details.
[in] | stream | file pointer |
[in] | format | string format |
[in] | ... | arguments for the format string |
void void void void G_fatal_error | ( | const char * | , |
... | |||
) |
Referenced by AS_option_to_algorithm(), Cairo_Graph_set(), cairo_read_xid(), cairo_write_bmp(), cairo_write_ppm(), cairo_write_xid(), check_create_import_opts(), clean_dir(), db_d_append_error(), db_set_default_connection(), dig__read_head(), dig_area_del_isle(), dig_fwrite(), dig_load_plus(), dig_node_line_angle(), dig_Rd_Plus_head(), dig_Rd_spidx_head(), dig_read_cidx_head(), dig_spidx_del_area(), dig_spidx_del_isle(), dig_spidx_del_node(), dig_Wr_spidx_head(), G__read_gisrc_path(), G_adjust_Cell_head(), G_adjust_Cell_head3(), G_adjust_window_ll(), G_bz2_compress(), G_bz2_expand(), G_config_path(), G_fseek(), G_getenv(), G_getenv2(), G_home(), G_list(), G_location_path(), G_ls2(), G_make_mapset(), G_mapset(), G_mapset_path(), G_open_option_file(), G_option_to_separator(), G_owner(), G_read_key_value_file(), G_set_omp_num_threads(), G_srand48_auto(), G_vector_norm_euclid(), G_vector_norm_maxval(), G_write_key_value_file(), G_write_projsrid(), G_write_projwkt(), G_write_zeros(), G_zstd_compress(), G_zstd_compress_bound(), G_zstd_expand(), GK_print_keys(), GPJ_init_transform(), I_sort_signatures_by_semantic_label(), I_SortSigSetBySemanticLabel(), IL_create_bitmask(), IL_write_point_2d(), IL_write_temp_2d(), M_do_list(), M_do_remove(), main(), N_compute_gradient_field_2d(), N_compute_gradient_field_3d(), N_compute_gradient_field_components_2d(), N_compute_gradient_field_components_3d(), N_copy_array_2d(), N_copy_array_3d(), NetA_betweenness_closeness(), NetA_flow(), NetA_initialise_varray(), NetA_min_cut(), NetA_strongly_connected_components(), NetA_weakly_connected_components(), pg_addedge(), port_init(), Rast3d_fatal_error_noargs(), Rast__check_fp_type(), Rast__check_null_bit(), Rast__null_bitstream_size(), Rast__open_null_write(), Rast__open_old(), Rast_close(), Rast_get_cellhd(), Rast_get_vrt(), Rast_map_is_fp(), Rast_map_type(), Rast_option_to_interp_type(), Rast_put_cellhd(), Rast_put_reclass(), Rast_quantize_fp_map(), Rast_read_histogram(), Rast_set_fp_type(), Rast_set_quant_rules(), Rast_unopen(), Rast_window_cols(), Rast_window_rows(), Rast_write_fp_range(), Rast_write_history(), Rast_write_quant(), Rast_write_range(), Rast_write_rstats(), read_image(), RTreeWriteBranch(), RTreeWriteNode(), seg_seek_fast(), seg_seek_slow(), V1_close_nat(), V1_close_ogr(), V1_close_pg(), V1_delete_line_ogr(), V1_delete_line_pg(), V1_open_new_ogr(), V1_open_old_ogr(), V1_rewind_ogr(), V1_rewind_pg(), V2__write_area_sfa(), V2_close_ogr(), V2_close_pg(), V2_open_old_ogr(), V2_open_old_pg(), V2_rewind_ogr(), V2_rewind_pg(), Vect__get_area_points(), Vect_build_line_area(), Vect_build_ogr(), Vect_build_partial(), Vect_build_sidx(), Vect_cat_set(), Vect_cats_set_constraint(), Vect_copy(), Vect_get_area_centroid(), Vect_get_area_isle(), Vect_get_area_num_isles(), Vect_get_isle_area(), Vect_get_isle_points(), Vect_graph_add_edge(), Vect_graph_build(), Vect_new_line_struct(), Vect_new_map_struct(), Vect_open_fidx(), Vect_overlay(), Vect_save_fidx(), Vect_save_frmt(), Vect_set_db_updated(), Vect_sfa_get_num_features(), Vect_spatial_index_del_item(), write_bmp(), write_image(), write_pgm(), and write_ppm().
jmp_buf* G_fatal_longjmp | ( | int | enable | ) |
Definition at line 66 of file gis/error.c.
char* G_file_name | ( | char * | path, |
const char * | element, | ||
const char * | name, | ||
const char * | mapset | ||
) |
Builds full path names to GIS data files.
If name is of the form "nnn@ppp" then path is set as if name had been "nnn" and mapset had been "ppp" (mapset parameter itself is ignored in this case).
Paths to files are currently in form: /path/to/location/mapset/element/name
path input buffer memory must be allocated by caller.
C:
Python:
[out] | path | allocated buffer to hold resultant full path to file |
element | database element (eg, "cell", "cellhd", "vector", etc) | |
name | name of file to build path to (fully qualified names allowed) | |
mapset | mapset name |
Definition at line 61 of file file_name.c.
Referenced by G_get_projepsg(), G_get_projinfo(), G_get_projunits(), G_has_vector_timestamp(), G_make_mapset_element(), G_mapset_permissions(), G_myname(), G_rename(), G_write_projsrid(), G_write_projwkt(), list_subgroups(), M__empty(), M_do_copy(), main(), Rast_map_is_fp(), Rast_map_type(), V1_close_nat(), Vect__get_element_path(), and Vect_copy().
char* G_file_name_basedir | ( | char * | path, |
const char * | element, | ||
const char * | name, | ||
const char * | mapset, | ||
const char * | basedir | ||
) |
Builds full path names to GIS data files in temporary directory (for internal use only)
By default the GRASS temporary directory is located at $LOCATION/$MAPSET/.tmp/$HOSTNAME/. If basedir is provided, the temporary directory is located at <basedir>/.tmp/$HOSTNAME/.
[out] | path | buffer to hold resultant full path to file |
element | database element (eg, "cell", "cellhd", "vector", etc) | |
name | name of file to build path to (fully qualified names allowed) | |
mapset | mapset name |
Definition at line 154 of file file_name.c.
char* G_file_name_misc | ( | char * | path, |
const char * | dir, | ||
const char * | element, | ||
const char * | name, | ||
const char * | mapset | ||
) |
Builds full path names to GIS misc data files.
Paths to misc files are currently in form: /path/to/location/mapset/dir/name/element
path input buffer memory must be allocated by caller.
C:
Python:
[out] | path | allocated buffer to hold resultant full path to file |
dir | misc directory (e.g., "cell_misc", "group") | |
element | database element (in this case – file to build path to e.g., "history", "REF") | |
name | name of object (raster, group; fully qualified names allowed e.g., "my_raster@PERMANENT") | |
mapset | mapset name |
Definition at line 101 of file file_name.c.
Referenced by Rast3d_filename(), Rast__check_fp_type(), and Rast__close_null().
char* G_file_name_tmp | ( | char * | path, |
const char * | element, | ||
const char * | name, | ||
const char * | mapset | ||
) |
Builds full path names to GIS data files in temporary directory (for internal use only)
By default temporary directory is located $LOCATION/$MAPSET/.tmp/$HOSTNAME. If GRASS_VECTOR_TMPDIR_MAPSET is set to "0", the temporary directory is located in TMPDIR (environmental variable defined by the user or GRASS initialization script if not given). Note that GRASS_VECTOR_TMPDIR_MAPSET variable is currently used only by vector library.
[out] | path | buffer to hold resultant full path to file |
element | database element (eg, "cell", "cellhd", "vector", etc) | |
name | name of file to build path to (fully qualified names allowed) | |
mapset | mapset name |
Definition at line 125 of file file_name.c.
References NULL.
Referenced by G_make_mapset_element_tmp(), and Vect__get_element_path().
int G_find_color_rule | ( | const char * | name | ) |
Check if color rule is defined.
name | color rule name |
Definition at line 246 of file gis/color_rules.c.
char* G_find_etc | ( | const char * | name | ) |
searches for a file from the etc search list in GRASS_ADDON_ETC returns the full path to where the file was found.
note: rejects all names that begin with "."
name | file name to look for |
Definition at line 62 of file find_etc.c.
const char* G_find_file | ( | const char * | element, |
char * | name, | ||
const char * | mapset | ||
) |
Searches for a file from the mapset search list or in a specified mapset.
Returns the mapset name where the file was found.
If the user specifies a fully qualified element (name@mapset) which exists, then G_find_file() modifies "name" by removing the "@mapset" part.
Rejects all names that begin with "."
If name is of the form nnn in ppp then only mapset ppp is searched.
element | database element (eg, "cell", "cellhd", "colr", etc) |
name | file name to look for |
mapset | mapset to search. if mapset is "" will search in mapset search list |
Definition at line 186 of file find_file.c.
Referenced by G_find_raster(), and G_find_vector().
const char* G_find_file2 | ( | const char * | element, |
const char * | name, | ||
const char * | mapset | ||
) |
Searches for a file from the mapset search list or in a specified mapset. (look but don't touch)
Returns the mapset name where the file was found.
Exactly the same as G_find_file() except that if name is in the form "<i>name@mapset</i>", and is found, G_find_file2() will not alter name by removing the "@<i>mapset</i>" part.
Rejects all names that begin with "."
element | database element (eg, "cell", "cellhd", "colr", etc) |
name | file name to look for |
mapset | mapset to search. if mapset is "" will search in mapset search list |
Definition at line 234 of file find_file.c.
Referenced by G_find_raster2(), G_find_vector2(), Gs_load_3dview(), I_find_group(), I_find_group2(), M_find(), V1_close_ogr(), and Vect_close().
const char* G_find_file2_misc | ( | const char * | dir, |
const char * | element, | ||
const char * | name, | ||
const char * | mapset | ||
) |
Searches for a misc file from the mapset search list or in a specified mapset. (look but don't touch)
Returns the mapset name where the misc file was found. Paths to misc files currently follow structure: mapset/dir/name/element
dir | file directory |
element | database element (eg, "cell", "cellhd", "colr", etc) |
name | file name to look for |
mapset | mapset to search. if mapset is "" will search in mapset search list |
Definition at line 257 of file find_file.c.
Referenced by G_find_raster3d(), G_has_raster3d_timestamp(), G_has_raster_timestamp(), I_find_group_file(), I_find_group_file2(), I_find_subgroup(), I_find_subgroup2(), I_find_subgroup_file(), I_find_subgroup_file2(), Rast_read_fp_range(), Rast_read_histogram(), and Rast_read_range().
const char* G_find_file_misc | ( | const char * | dir, |
const char * | element, | ||
char * | name, | ||
const char * | mapset | ||
) |
Searches for a misc file from the mapset search list or in a specified mapset.
Returns the mapset name where the misc file was found. Paths to misc files currently follow structure: mapset/dir/name/element
dir | file directory |
element | database element (eg, "cell", "cellhd", "colr", etc) |
name | file name to look for |
mapset | mapset to search. if mapset is "" will search in mapset search list |
Definition at line 208 of file find_file.c.
Referenced by Rast3d_mask_file_exists().
const char* G_find_key_value | ( | const char * | key, |
const struct Key_Value * | kv | ||
) |
Find given key (case sensitive)
key | key to be found |
kv | pointer to Key_value structure |
Definition at line 85 of file key_value1.c.
Referenced by G_compare_projections(), G_get_datumparams_from_projinfo(), G_get_projinfo(), GPJ__get_datum_params(), GPJ_osr_to_grass(), Rast__check_fp_type(), and Vect_close().
const char* G_find_raster | ( | char * | name, |
const char * | mapset | ||
) |
Find a raster map.
Looks for the raster map name in the database. The mapset parameter can either be the empty string "", which means search all the mapsets in the user's current mapset search path (see Mapset_Search_Path for more details about the search path) or it can be a specific mapset name, which means look for the raster map only in this one mapset (for example, in the current mapset). If found, the mapset where the raster map lives is returned. If not found, the NULL pointer is returned.
Note: If the user specifies a fully qualified raster map which exists, then G_find_raster() modifies name by removing the "@<i>mapset</i>".
For example, to find a raster map anywhere in the database:
To check that the raster map exists in the current mapset:
[in,out] | name | map name |
mapset | mapset name or "" |
Definition at line 55 of file find_rast.c.
References G_debug(), G_find_file(), and name.
Referenced by I_iclass_init_group(), Rast__check_for_auto_masking(), Rast__mask_info(), Rast_get_cellhd(), Rast_get_vrt(), and Rast_mask_is_present().
const char* G_find_raster2 | ( | const char * | name, |
const char * | mapset | ||
) |
Find a raster map (look but don't touch)
The same as G_find_raster() but doesn't remove the "@<i>mapset</i>" qualification from name, if present.
Returns NULL if the map wasn't found, or the mapset the raster was found in if it was.
name | map name |
mapset | mapset name or "" |
Definition at line 76 of file find_rast.c.
References G_debug(), G_find_file2(), and name.
Referenced by IL_create_bitmask(), M_do_remove(), M_do_rename(), Rast__check_fp_type(), Rast__open_null_write(), Rast__open_old(), Rast_get_vrt(), Rast_map_is_fp(), and Rast_map_type().
const char* G_find_raster3d | ( | const char * | name, |
const char * | mapset | ||
) |
Search for a 3D raster map in current search path or in a specified mapset.
Note: rejects all names that begin with '.'
name | map name |
mapset | mapset to search. ("" for search path) |
Definition at line 28 of file find_rast3d.c.
References G_find_file2_misc(), and name.
Referenced by M_do_remove(), and M_do_rename().
const char* G_find_vector | ( | char * | name, |
const char * | mapset | ||
) |
Finds a vector map.
Searches for a vector map from the mapset search list or in a specified mapset. Returns the mapset name where the vector map was found.
NOTES: If the user specifies a fully qualified vector map which exists, then G_find_vector() modifies name by removing the "@<i>mapset</i>" part.
Rejects all names that begin with "."
name | vector map name |
mapset | mapset name or "" for search path |
Definition at line 41 of file find_vect.c.
References G_debug(), G_find_file(), GV_DIRECTORY, and name.
const char* G_find_vector2 | ( | const char * | name, |
const char * | mapset | ||
) |
Find a vector map (look but don't touch)
The same as G_find_vector() but doesn't remove the "@<i>mapset</i>" qualification from name, if present.
Returns NULL if the map wasn't found, or the mapset the vector was found in if it was.
name | vector map name |
mapset | mapset name where to search |
Definition at line 62 of file find_vect.c.
References G_debug(), G_find_file2(), GV_DIRECTORY, and name.
Referenced by M_do_remove(), M_do_rename(), and Vect_copy().
FILE* G_fopen_append | ( | const char * | element, |
const char * | name | ||
) |
Open a database file for update (append mode)
The database file name under the element in the current mapset is opened for for writing. The UNIX fopen() routine, with "a" append mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file descriptor from the fopen() is returned.
element | database element name |
name | map file name |
Definition at line 278 of file gis/open.c.
FILE* G_fopen_append_misc | ( | const char * | dir, |
const char * | element, | ||
const char * | name | ||
) |
Definition at line 217 of file open_misc.c.
Referenced by I_fopen_group_file_append(), and I_fopen_subgroup_file_append().
FILE* G_fopen_modify | ( | const char * | element, |
const char * | name | ||
) |
Open a database file for update (r+ mode)
The database file name under the element in the current mapset is opened for for writing. The UNIX fopen() routine, with "r+" append mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file descriptor from the fopen() is returned.
element | database element name |
name | map file name |
Definition at line 306 of file gis/open.c.
Referenced by V1_open_new_nat(), and V1_open_old_nat().
FILE* G_fopen_modify_misc | ( | const char * | dir, |
const char * | element, | ||
const char * | name | ||
) |
Definition at line 230 of file open_misc.c.
FILE* G_fopen_new | ( | const char * | element, |
const char * | name | ||
) |
Open a new database file.
The database file name under the element in the current mapset is created and opened for writing (but not reading). The UNIX fopen() routine, with "w" write mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file is positioned at the end of the file and the file descriptor from the fopen() is returned.
element | database element name |
name | map file name |
Definition at line 219 of file gis/open.c.
Referenced by G_put_3dview(), I_put_group(), Rast__quant_export(), Rast_put_cellhd(), Rast_write_history(), V1_open_new_nat(), Vect__write_head(), Vect_save_frmt(), Vect_save_topo(), and Vect_write_dblinks().
FILE* G_fopen_new_misc | ( | const char * | dir, |
const char * | element, | ||
const char * | name | ||
) |
open a new database misc file
The database file element under dir/name in the current mapset is created and opened for writing (but not reading). The UNIX fopen( ) routine, with "w" write mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file is positioned at the end of the file and the file descriptor from the fopen( ) is returned.
element | |
name |
Definition at line 178 of file open_misc.c.
Referenced by I_fopen_group_file_new(), I_fopen_signature_file_new(), I_fopen_sigset_file_new(), I_fopen_subgroup_file_new(), Rast3d_write_cats(), Rast3d_write_history(), Rast__quant_export(), and Rast_write_range().
FILE* G_fopen_old | ( | const char * | element, |
const char * | name, | ||
const char * | mapset | ||
) |
Open a database file for reading.
The database file name under the element in the specified mapset is opened for reading (but not for writing). The UNIX fopen() routine, with "r" read mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file descriptor from the fopen() is returned.
element | database element name |
name | map file name |
mapset | mapset name containing map name |
Definition at line 251 of file gis/open.c.
Referenced by I_get_group(), Rast__quant_import(), Rast_get_cell_title(), Rast_get_cellhd(), Rast_read_history(), V1_open_old_nat(), Vect__read_head(), Vect_cidx_open(), Vect_close(), Vect_open_fidx(), and Vect_open_topo().
FILE* G_fopen_old_misc | ( | const char * | dir, |
const char * | element, | ||
const char * | name, | ||
const char * | mapset | ||
) |
open a database misc file for reading
The database file element under dir/name in the specified mapset is opened for reading (but not for writing). The UNIX fopen( ) routine, with "r" read mode, is used to open the file. If the file does not exist, the NULL pointer is returned. Otherwise the file descriptor from the fopen( ) is returned.
element | |
name | |
mapset |
Definition at line 205 of file open_misc.c.
Referenced by fopen_group_file_old(), fopen_subgroup_file_old(), I_fopen_signature_file_old(), I_fopen_sigset_file_old(), Rast3d_read_history(), Rast_get_vrt(), Rast_is_reclassed_to(), Rast_read_histogram(), and Rast_read_range().
void G_format_easting | ( | double | east, |
char * | buf, | ||
int | projection | ||
) |
Easting to ASCII.
Converts the double representation of the east coordinate to its ASCII representation (into buf).
east | easting | |
[out] | buf | buffer to hold formatted string |
projection | projection code, or -1 to force full precision FP |
Definition at line 49 of file wind_format.c.
References G_lon_format(), and PROJECTION_LL.
Referenced by G__write_Cell_head().
void G_format_northing | ( | double | north, |
char * | buf, | ||
int | projection | ||
) |
Northing to ASCII.
Converts the double representation of the north coordinate to its ASCII representation (into buf).
north | northing | |
[out] | buf | buffer to hold formatted string |
projection | projection code, or -1 to force full precision FP |
Definition at line 29 of file wind_format.c.
References G_lat_format(), and PROJECTION_LL.
Referenced by G__write_Cell_head().
void G_format_resolution | ( | double | res, |
char * | buf, | ||
int | projection | ||
) |
Resolution to ASCII.
Converts the double representation of the resolution to its ASCII representation (into buf).
resolution | resolution value | |
[out] | buf | buffer to hold formatted string |
projection | projection code, or -1 to force full precision FP |
Definition at line 69 of file wind_format.c.
References G_llres_format(), and PROJECTION_LL.
Referenced by G__write_Cell_head(), and G__write_Cell_head3().
int G_format_timestamp | ( | const struct TimeStamp * | ts, |
char * | buf | ||
) |
Create text string from TimeStamp structure.
Fills string *buf with info from TimeStamp structure *ts in a pretty way. The TimeStamp struct is defined in gis.h and populated with e.g. G_read_raster_timestamp().
ts | TimeStamp structure containing time info |
buf | string to receive formatted timestamp |
Definition at line 183 of file timestamp.c.
struct Key_Value* G_fread_key_value | ( | FILE * | fd | ) |
Read key/values pairs from file.
Allocated memory must be freed G_free_key_value().
fd | file to read key/values from |
Definition at line 49 of file key_value2.c.
Referenced by G_read_key_value_file(), and Vect_close().
void G_free | ( | void * | buf | ) |
Free allocated memory.
[in,out] | buf | buffer holding original data |
Definition at line 150 of file gis/alloc.c.
References free().
Referenced by cairo_write_ppm(), close_band_files(), db_CatValArray_free(), db_d_append_error(), destroy_si_struct(), dig_cidx_free(), dig_file_free(), dig_free_area(), dig_free_isle(), dig_free_line(), dig_free_node(), dig_free_plus_areas(), dig_free_plus_isles(), dig_free_plus_lines(), dig_free_plus_nodes(), free_datum_list(), free_ellps_list(), free_fontcap(), free_perimeters(), free_slice_buff(), free_vol_buff(), free_volfile_buffs(), G__read_Cell_head(), G_bz2_compress(), G_free_fmatrix(), G_free_fvector(), G_free_ilist(), G_free_imatrix(), G_free_ivector(), G_free_key_value(), G_free_list(), G_free_ls_filter(), G_free_matrix(), G_free_tokens(), G_free_vector(), G_get_available_mapsets(), G_init_ilist(), G_list(), G_ls(), G_ls_regex_filter(), G_lz4_compress(), G_math_free_spmatrix(), G_math_free_spvector(), G_math_solver_sparse_gs(), G_math_solver_sparse_jacobi(), G_matrix_free(), G_matrix_LU_solve(), G_read_compressed(), G_vector_free(), G_write_compressed(), G_zlib_compress(), G_zstd_compress(), gk_free_key(), gk_make_linear_framesfromkeys(), GPJ_free_datum(), GPJ_free_datum_transform(), GPJ_free_ellps(), GPJ_init_transform(), GPJ_osr_to_grass(), GPJ_set_csv_loc(), gs_init_normbuff(), gs_malloc_lookup(), gs_set_att_src(), GS_write_ppm(), GS_write_tif(), gv_free_vectmem(), gvd_vect(), GVL_isosurf_del(), gvl_isosurf_freemem(), Gvl_unload_colors_data(), I_free(), I_free_double2(), I_free_double3(), I_free_int2(), I_free_signatures_list(), I_iclass_free_statistics(), I_sc_free_cats(), kdtree_destroy(), N_free_geom_data(), N_free_gradient_2d(), N_free_gradient_3d(), N_free_gradient_field_2d(), N_free_gradient_field_3d(), N_free_gradient_neighbours_2d(), N_free_gradient_neighbours_3d(), N_free_gradient_neighbours_x(), N_free_gradient_neighbours_y(), N_free_gradient_neighbours_z(), N_free_les(), N_les_integrate_dirichlet_2d(), NetA_timetable_result_release(), Nviz_destroy_render_window(), Nviz_draw_all_site(), Nviz_draw_all_vol(), Nviz_get_exag(), path_free(), pg_destroy_struct(), Rast__close_null(), Rast__color_free_fp_lookup(), Rast__color_free_lookup(), Rast__create_window_mapping(), Rast_clear_history(), Rast_close_gdal_link(), Rast_close_gdal_write_link(), Rast_close_vrt(), Rast_command_history(), Rast_format_history(), Rast_fpreclass_reset(), Rast_free_cats(), Rast_free_histogram(), Rast_free_history(), Rast_free_reclass(), Rast_get_vrt_row(), Rast_quant_free(), Rast_set_d_cat(), Rast_set_history(), Segment_close(), Segment_release(), set_proj_share(), tgis_free_map_list(), tgis_init_map_list(), V1_close_ogr(), V1_close_pg(), Vect__close_cursor_pg(), Vect__free_cache(), Vect__free_offset(), Vect__insert_face_pg(), Vect_build_ogr(), Vect_build_pg(), Vect_close(), Vect_destroy_boxlist(), Vect_destroy_cat_list(), Vect_destroy_cats_struct(), Vect_destroy_field_info(), Vect_destroy_line_struct(), Vect_destroy_list(), Vect_destroy_map_struct(), Vect_get_finfo_geometry_type(), Vect_new_varray(), Vect_set_comment(), Vect_set_date(), Vect_set_map_date(), Vect_set_map_name(), Vect_set_organization(), Vect_set_person(), and write_pgm().
void G_free_ilist | ( | struct ilist * | list | ) |
Free allocated memory of an integer list.
list | The pointer to an integer list |
Definition at line 27 of file ilist.c.
References G_free().
Referenced by Rast_close_vrt().
void G_free_key_value | ( | struct Key_Value * | kv | ) |
Free allocated Key_Value structure.
[in] | kv | Key_Value structure to be freed |
Definition at line 104 of file key_value1.c.
References G_free(), Key_Value::key, Key_Value::nalloc, Key_Value::nitems, and Key_Value::value.
Referenced by G_get_projinfo(), GPJ_get_datum_params(), and Rast__check_fp_type().
void G_free_list | ( | char ** | list | ) |
Free list.
list | char* array to be freed |
Definition at line 248 of file gis/list.c.
References G_free().
void G_free_ls_filter | ( | void * | regex | ) |
Definition at line 190 of file ls_filter.c.
References G_free().
void G_free_tokens | ( | char ** | tokens | ) |
Free memory allocated to tokens.
Note: G_free_tokens() must be called when finished with tokens to release memory.
[out] | tokens |
Definition at line 198 of file gis/token.c.
References G_free(), and NULL.
Referenced by check_create_export_opts(), check_create_import_opts(), V1_close_ogr(), and Vect__open_cursor_next_line_pg().
void G_fseek | ( | FILE * | fp, |
off_t | offset, | ||
int | whence | ||
) |
Change the file position of the stream.
The value of whence must be one of the constants ‘SEEK_SET’, ‘SEEK_CUR’, or ‘SEEK_END’, to indicate whether the offset is relative to the beginning of the file, the current file position, or the end of the file, respectively.
fp | file descriptor |
offset | offset |
whence |
Definition at line 50 of file gis/seek.c.
References _, and G_fatal_error().
Referenced by dfread_header(), dfwrite_header(), dig_fseek(), G__read_Cell_head(), IL_write_temp_2d(), new_dspf(), open_stream(), AMI_STREAM< T >::seek(), AMI_STREAM< T >::stream_len(), Vect_hist_copy(), and Vect_open_fidx().
off_t G_ftell | ( | FILE * | fp | ) |
Get the current file position of the stream.
fp | file descriptor |
Definition at line 29 of file gis/seek.c.
Referenced by dfwrite_header(), dig_ftell(), AMI_STREAM< T >::read_item(), AMI_STREAM< T >::stream_len(), Vect_hist_copy(), and AMI_STREAM< T >::write_item().
char* G_fully_qualified_name | ( | const char * | name, |
const char * | mapset | ||
) |
Get fully qualified element name.
Returns a fully qualified name for GIS element name in mapset. Currently this string is in the form name@mapset, but the programmer should pretend not to know this and always call this routine to get the fully qualified name.
String is allocated by G_store().
name | element name |
mapset | mapset name |
Definition at line 101 of file nme_in_mps.c.
References G_store(), GMAPSET_MAX, GNAME_MAX, and name.
Referenced by M_do_copy(), Rast__check_fp_type(), Rast__open_old(), Rast__quant_import(), Rast_map_is_fp(), Rast_mask_name(), Rast_quantize_fp_map(), Rast_read_fp_range(), and Rast_read_range().
int G_fwrite_key_value | ( | FILE * | fd, |
const struct Key_Value * | kv | ||
) |
Write key/value pairs to file.
[in,out] | fd | file to write to |
kv | pointer Key_Value structure |
Definition at line 25 of file key_value2.c.
References err(), Key_Value::key, Key_Value::nitems, and Key_Value::value.
Referenced by G_write_key_value_file().
char* G_generate_basename | ( | const char * | basename, |
double | number, | ||
size_t | ndigits, | ||
size_t | ndecimals | ||
) |
Generate the format string.
basename | String with the basename |
digits | Number of digits number |
decimals | Number of decimal number |
filler | String used to fill, default is 0 |
Definition at line 162 of file basename.c.
References G_double_to_basename_format(), G_get_basename_separator(), and G_malloc.
double G_geodesic_distance | ( | double | lon1, |
double | lat1, | ||
double | lon2, | ||
double | lat2 | ||
) |
Calculates geodesic distance.
Calculates the geodesic distance from lon1,lat1 to lon2,lat2 in meters.
Note: The calculation of the geodesic distance is fairly costly.
lon1,lat1 | longitude,latitude of first point |
lon2,lat2 | longitude,latitude of second point |
Definition at line 195 of file geodist.c.
References G_geodesic_distance_lon_to_lon(), G_set_geodesic_distance_lat1(), and G_set_geodesic_distance_lat2().
Referenced by G_distance().
double G_geodesic_distance_lon_to_lon | ( | double | lon1, |
double | lon2 | ||
) |
Calculates geodesic distance.
Calculates the geodesic distance from lon1,lat1 to lon2,lat2 in meters where lat1 was the latitude passed to G_set_geodesic_distance_latl() and lat2 was the latitude passed to G_set_geodesic_distance_lat2().
lon1 | first longitude |
lon2 | second longitude |
Definition at line 121 of file geodist.c.
Referenced by G_geodesic_distance().
double G_geodesic_lat_from_lon | ( | double | lon | ) |
Definition at line 78 of file geodesic.c.
int G_get_3dview | ( | const char * | fname, |
const char * | mapset, | ||
struct G_3dview * | View | ||
) |
Gets a 3D View.
If reading an old format, the window boundaries are not checked against the current window since boundaries weren't saved.
[in] | fname | |
[in] | mapset | |
[in,out] | View |
Definition at line 243 of file view.c.
Referenced by Gs_load_3dview().
Sets default for v based on w.
[in,out] | v | |
[in] | w |
Definition at line 58 of file view.c.
References G_3dview::ambient, G_3dview::bg_col, G_3dview::colorgrid, Cell_head::cols, Cell_head::compressed, G_3dview::display_type, G_3dview::doavg, G_3dview::dozero, Cell_head::east, Cell_head::ew_res, G_3dview::exag, Cell_head::format, G_3dview::fov, G_3dview::fringe, G_3dview::from_to, G_3dview::grid_col, G_3dview::lightcol, G_3dview::lightpos, G_3dview::lightson, G_3dview::mesh_freq, Cell_head::north, Cell_head::ns_res, G_3dview::other_col, G_3dview::poly_freq, Cell_head::proj, Cell_head::rows, G_3dview::shading, G_3dview::shine, Cell_head::south, strcpy, G_3dview::surfonly, G_3dview::twist, G_3dview::vwin, Cell_head::west, and Cell_head::zone.
Referenced by Gs_save_3dview().
char** G_get_available_mapsets | ( | void | ) |
Get list of available mapsets for current location.
List is updated by each call to this function.
Definition at line 147 of file mapset_nme.c.
References G_calloc, G_debug(), G_free(), G_location_path(), G_realloc, G_stat(), G_store(), GPATH_MAX, NULL, and st.
char* G_get_basename_separator | ( | void | ) |
Return the environmental basename variable or the default value.
return pointer to basename separator
Definition at line 109 of file basename.c.
References GBASENAME_SEP, and NULL.
Referenced by G_generate_basename(), and G_join_basename_strings().
int G_get_datum_by_name | ( | const char * | name | ) |
Definition at line 43 of file gis/datum.c.
References G_read_datum_table().
int G_get_datumparams_from_projinfo | ( | const struct Key_Value * | projinfo, |
char * | datumname, | ||
char * | params | ||
) |
Definition at line 107 of file gis/datum.c.
References G_find_key_value(), and NULL.
void G_get_default_window | ( | struct Cell_head * | window | ) |
Get the default region.
Reads the default region for the location into region. 3D values are set to defaults if not available in WIND file.
An error message is printed and exit() is called if there is a problem reading the default region.
[out] | window | pointer to Cell_head |
Definition at line 95 of file get_window.c.
Referenced by G_make_mapset().
void G_get_element_window | ( | struct Cell_head * | window, |
const char * | element, | ||
const char * | name, | ||
const char * | mapset | ||
) |
Get region for selected element (raster, vector, window, etc.)
G_fatal_error() is called on error
[out] | window | pointer to Cell_head |
element | element type | |
name | element name | |
mapset | mapset name |
Definition at line 110 of file get_window.c.
int G_get_ellipsoid_by_name | ( | const char * | name, |
double * | a, | ||
double * | e2 | ||
) |
Get ellipsoid parameters by name.
This routine returns the semi-major axis a (in meters) and eccentricity squared e2 for the named ellipsoid.
name | ellipsoid name | |
[out] | a | semi-major axis |
[out] | e2 | eccentricity squared |
Definition at line 104 of file get_ellipse.c.
int G_get_ellipsoid_parameters | ( | double * | a, |
double * | e2 | ||
) |
get ellipsoid parameters
This routine returns the semi-major axis a (in meters) and the eccentricity squared e2 for the ellipsoid associated with the database. If there is no ellipsoid explicitly associated with the database, it returns the values for the WGS 84 ellipsoid.
[out] | a | semi-major axis |
[out] | e2 | eccentricity squared |
Definition at line 66 of file get_ellipse.c.
const char* G_get_env_name | ( | int | n | ) |
Get variable name for index n.
For example:
n | index of variable |
int G_get_gisrc_mode | ( | void | ) |
const char* G_get_mapset_name | ( | int | n | ) |
Get name of the n'th mapset from the current mapset search path.
The first call will initialize the list.
n | mapset index |
Definition at line 44 of file mapset_nme.c.
References G__get_list_of_mapsets(), NULL, and st.
size_t G_get_num_decimals | ( | const char * | str | ) |
Get number of decimals from a string.
str | String to analyse |
Definition at line 54 of file basename.c.
References NULL.
int G_get_overwrite | ( | void | ) |
Get overwrite value.
Definition at line 957 of file parser.c.
References st.
Referenced by V1_open_new_ogr().
struct Key_Value* G_get_projepsg | ( | void | ) |
Gets EPSG information for the current location.
DEPRECATED: Use G_get_projsrid() instead.
Note: Allocated Key_Value structure should be freed by G_free_key_value().
Definition at line 102 of file get_projinfo.c.
References EPSG_FILE, G_debug(), G_file_name(), G_location(), G_projection(), G_read_key_value_file(), GPATH_MAX, NULL, PERMANENT, and PROJECTION_XY.
Referenced by G_get_projinfo().
struct Key_Value* G_get_projinfo | ( | void | ) |
Gets projection information for location.
Note: Allocated Key_Value structure should be freed by G_free_key_value().
Prints a warning if no projection information available.
Definition at line 61 of file get_projinfo.c.
References _, G_file_name(), G_find_key_value(), G_free_key_value(), G_get_projepsg(), G_location(), G_projection(), G_read_key_value_file(), G_set_key_value(), G_warning(), GPATH_MAX, NULL, PERMANENT, PROJECTION_FILE, and PROJECTION_XY.
Referenced by GPJ_get_datum_params().
char* G_get_projsrid | ( | void | ) |
Get srid (spatial reference id) for the current location.
Typically an srid will be of the form authority NAME:CODE, e.g. EPSG:4326
This srid is passed to proj_create() using PROJ or OSRSetFromUserInput() using GDAL. Therefore various other forms of srid are possible, e.g. in OSRSetFromUserInput():
Definition at line 237 of file get_projinfo.c.
struct Key_Value* G_get_projunits | ( | void | ) |
Gets units information for location.
Note: Allocated Key_Value structure should be freed by G_free_key_value().
Prints a warning if no units information available.
Definition at line 32 of file get_projinfo.c.
References _, G_file_name(), G_location(), G_projection(), G_read_key_value_file(), G_warning(), GPATH_MAX, NULL, PERMANENT, PROJECTION_XY, and UNIT_FILE.
char* G_get_projwkt | ( | void | ) |
Get WKT information for the current location.
Definition at line 127 of file get_projinfo.c.
void G_get_set_window | ( | struct Cell_head * | window | ) |
Get the current working window (region)
The current working window values are returned in the structure window
.
Previous calls to G_set_window() affects values returned by this function. Previous calls to G_put_window() affects values returned by this function only if the current working window is not initialized.
[out] | window | pointer to window structure to be set |
Definition at line 35 of file gis/set_window.c.
Referenced by G_setup_plot(), GS_get_to_real(), GS_set_focus_real(), I_iclass_analysis(), and N_init_geom_data_3d().
int G_get_spheroid_by_name | ( | const char * | name, |
double * | a, | ||
double * | e2, | ||
double * | f | ||
) |
Get spheroid parameters by name.
This function returns the semi-major axis a (in meters), the eccentricity squared e2 and the inverse flattening f for the named ellipsoid.
name | spheroid name | |
[out] | a | semi-major axis |
[out] | e2 | eccentricity squared |
[out] | f | inverse flattening |
Definition at line 153 of file get_ellipse.c.
Copy TimeStamp into [two] Datetimes structs.
Use to copy the TimeStamp information into Datetimes, as the members of struct TimeStamp shouldn't be accessed directly.
ts | source TimeStamp structure | |
[out] | dt1 | first DateTime struct to be filled |
[out] | dt2 | second DateTime struct to be filled |
[out] | count | return code |
Definition at line 260 of file timestamp.c.
const char* G_get_units_name | ( | int | units, |
int | plural, | ||
int | square | ||
) |
Get localized units name.
Units codes (gis.h):
units | units code |
plural | plural form if true |
square | area units if true |
Definition at line 204 of file units.c.
References _, G_database_unit_name(), G_get_units_name(), G_units(), NULL, U_ACRES, U_DAYS, U_DEGREES, U_FEET, U_HECTARES, U_HOURS, U_KILOMETERS, U_METERS, U_MILES, U_MINUTES, U_MONTHS, U_SECONDS, U_UNKNOWN, U_USFEET, and U_YEARS.
Referenced by G_database_unit_name(), G_get_units_name(), Rast3d_get_vertical_unit(), and Rast3d_print_header().
void G_get_window | ( | struct Cell_head * | window | ) |
Get the current region.
Reads the region as stored in the WIND file in the user's current mapset into region.
3D values are set to defaults if not available in WIND file. An error message is printed and exit() is called if there is a problem reading the region.
Note: GRASS applications that read or write raster maps should not use this routine since its use implies that the active module region will not be used. Programs that read or write raster map data (or vector data) can query the active module region using Rast_window_rows() and Rast_window_cols().
[out] | window | pointer to Cell_head |
Definition at line 47 of file get_window.c.
Referenced by G__init_window(), and P_set_dim().
const char* G_getenv | ( | const char * | name | ) |
Get environment variable.
G_fatal_error() is called when variable is not found.
name | variable name |
Definition at line 360 of file env.c.
References _, G_fatal_error(), G_getenv_nofatal(), name, and NULL.
Referenced by G_gisbase(), G_gisdbase(), and G_location().
const char* G_getenv2 | ( | const char * | name, |
int | loc | ||
) |
Get variable from specific place.
Locations:
G_fatal_error() is called when variable is not found.
name | variable name |
loc | location (G_VAR_GISRC, G_VAR_MAPSET) |
Definition at line 386 of file env.c.
References _, G_fatal_error(), G_getenv_nofatal2(), name, and NULL.
const char* G_getenv_nofatal | ( | const char * | name | ) |
Get environment variable.
name | variable name |
Definition at line 405 of file env.c.
References name.
Referenced by G__mapset(), G_check_overwrite(), G_define_standard_option(), and G_getenv().
const char* G_getenv_nofatal2 | ( | const char * | name, |
int | loc | ||
) |
Get environment variable from specific place.
name | variable name |
loc | location (G_VAR_GISRC, G_VAR_MAPSET) |
Definition at line 424 of file env.c.
References name.
Referenced by db_get_connection(), db_get_default_database_name(), db_get_default_driver_name(), db_get_default_group_name(), db_get_default_schema_name(), G_getenv2(), tgis_get_connection(), tgis_get_database_name(), and tgis_get_driver_name().
int G_getl | ( | char * | buf, |
int | n, | ||
FILE * | fd | ||
) |
Gets a line of text from a file.
This routine runs fgets() to fetch a line of text from a file (advancing file pointer) and removes trailing newline.
buf | string buffer to receive read data |
n | maximum number of bytes to read |
fd | file descriptor structure |
Definition at line 33 of file getl.c.
References G_getl2().
Referenced by G__read_Cell_head(), G_matrix_read(), G_myname(), Rast__read_history(), and Rast_get_cell_title().
int G_getl2 | ( | char * | buf, |
int | n, | ||
FILE * | fd | ||
) |
Gets a line of text from a file of any pedigree.
This routine supports text files created on various platforms (UNIX, MacOS9, DOS), i.e. \n (\012)
, \r (\015)
, and \r\n (\015\012)
style newlines.
Reads in at most n-1 characters from stream (the last spot is reserved for the end-of-string NUL) and stores them into the buffer pointed to by buf. Reading stops after an EOF or a newline. New line is not stored in the buffer. At least n bytes must be allocated for the string buffer.
buf | string buffer to receive read data, at least n bytes must be allocated |
n | maximum number of bytes to read |
fd | file descriptor structure |
Definition at line 60 of file getl.c.
References NULL.
Referenced by dig_read_frmt_ascii(), G_getl(), I_get_group_title(), Rast_get_vrt(), read_coor(), Vect__read_head(), and Vect_read_ascii_head().
const char* G_gisbase | ( | void | ) |
Get full path name of the top level module directory.
Returns the full path name of the top level directory for GRASS programs. This directory will have subdirectories which will contain modules and files required for the running of the system. Some of these directories are:
bin commands run by the user etc modules and data files used by GRASS commands
The use of G_gisbase() to find these subdirectories enables GRASS modules to be written independently of where the GRASS system is actually installed on the machine. For example, to run the module sroff in the GRASS etc directory:
Definition at line 39 of file gisbase.c.
References G_getenv().
Referenced by GPJ_osr_to_grass(), GPJ_set_csv_loc(), and parse_fontcap().
const char* G_gisdbase | ( | void | ) |
Get name of top level database directory.
Returns the full UNIX path name of the directory which holds the database locations.
Definition at line 26 of file gisdbase.c.
References G_getenv().
Referenced by G__location_path(), G__mapset_path(), G_make_mapset(), G_write_projsrid(), G_write_projwkt(), and Vect_hist_command().
int G_has_raster3d_timestamp | ( | const char * | name, |
const char * | mapset | ||
) |
Check if timestamp for 3D raster map exists.
name | map name |
mapset | mapset name |
Definition at line 576 of file timestamp.c.
References G_find_file2_misc(), GRID3, and name.
int G_has_raster_timestamp | ( | const char * | name, |
const char * | mapset | ||
) |
Check if timestamp for raster map exists.
name | map name |
mapset | mapset name |
Definition at line 356 of file timestamp.c.
References G_find_file2_misc(), name, and RAST_MISC.
int G_has_vector_timestamp | ( | const char * | name, |
const char * | layer, | ||
const char * | mapset | ||
) |
Check if timestamp for vector map exists.
name | map name |
layer | The layer names, in case of NULL, layer one is assumed |
mapset | mapset name |
Definition at line 422 of file timestamp.c.
References G_debug(), G_file_name(), GNAME_MAX, GPATH_MAX, GV_DIRECTORY, GV_TIMESTAMP_ELEMENT, name, NULL, and R_OK.
const char* G_home | ( | void | ) |
Get user's home directory.
Returns a pointer to a string which is the full path name of the user's home directory.
Calls G_fatal_error() on failure.
Definition at line 32 of file home.c.
References _, G__home(), G_fatal_error(), and NULL.
Referenced by G_config_path().
void G_ilist_add | ( | struct ilist * | list, |
int | val | ||
) |
Add item to ilist.
This function adds an integer to the list but does not check for duplicates. In case reallocation fails, G_fatal_error() will be invoked by the allocation function.
list | The ilist pointer |
val | The value to attach |
Definition at line 78 of file ilist.c.
References G_realloc.
Referenced by Rast_get_vrt().
void void void G_important_message | ( | const char * | , |
... | |||
) |
Referenced by GPJ_init_transform().
int G_info_format | ( | void | ) |
Get current message format.
Maybe set to either "standard" or "gui" (normally GRASS takes care)
Definition at line 537 of file gis/error.c.
References G_init_logging().
void G_init_all | ( | void | ) |
Initialize environment.
Definition at line 174 of file gisinit.c.
References G__check_gisinit(), G__get_list_of_mapsets(), G__home(), G__init_window(), G__machine_name(), G_init_debug(), G_init_env(), G_init_locale(), G_init_logging(), G_init_tempfile(), G_read_datum_table(), G_read_ellipsoid_table(), G_verbose(), and G_whoami().
void G_init_debug | ( | void | ) |
Initiate debugging.
Definition at line 27 of file debug.c.
References G_is_initialized().
Referenced by G_debug(), and G_init_all().
void G_init_env | ( | void | ) |
void G_init_ilist | ( | struct ilist * | list | ) |
Init an integer list and free allocated memory.
list | The pointer to an integer list |
Definition at line 58 of file ilist.c.
References G_free(), and NULL.
Referenced by G_new_ilist(), and RTreeSearch2().
void G_init_logging | ( | void | ) |
Definition at line 355 of file gis/error.c.
Referenced by G_info_format(), and G_init_all().
void G_init_tempfile | ( | void | ) |
Initialize environment for creating tempfiles.
Definition at line 29 of file tempfile.c.
References G_is_initialized().
Referenced by G_init_all(), G_tempfile_pid(), and G_tempfile_pid_basedir().
void G_init_timestamp | ( | struct TimeStamp * | ts | ) |
Initialize timestamp structure.
ts | pointer to TimeStamp structure |
Definition at line 95 of file timestamp.c.
void G_initialize_done | ( | int * | p | ) |
Definition at line 77 of file counter.c.
Referenced by G__init_window(), G_config_path(), G_set_verbose(), G_verbose(), and Rast__init_window().
int G_insert_commas | ( | char * | buf | ) |
Inserts commas into a number string.
Examples:
Note: Does not work with negative numbers.
[in,out] | buf | string |
Definition at line 36 of file commas.c.
References strcpy.
int G_intersect_line_segments | ( | double | ax1, |
double | ay1, | ||
double | ax2, | ||
double | ay2, | ||
double | bx1, | ||
double | by1, | ||
double | bx2, | ||
double | by2, | ||
double * | ra, | ||
double * | rb, | ||
double * | x, | ||
double * | y | ||
) |
Definition at line 84 of file gis/intersect.c.
Referenced by G_distance_between_line_segments().
int G_is_absolute_path | ( | const char * | path | ) |
Checks if a specified path looks like an absolute path on the host system.
path | String containing path to check |
Definition at line 62 of file paths.c.
References G_is_dirsep().
Referenced by COM_Set_font().
int G_is_dirsep | ( | char | c | ) |
Checks if a specified character is a valid directory separator character on the host system.
c | Character to check |
Definition at line 45 of file paths.c.
Referenced by G_is_absolute_path(), and G_parser().
int G_is_gisbase | ( | const char * | path | ) |
int G_is_initialized | ( | int * | p | ) |
Definition at line 60 of file counter.c.
Referenced by G__init_window(), G_config_path(), G_init_debug(), G_init_tempfile(), G_set_verbose(), G_verbose(), Rast__init(), Rast__init_window(), and Rast_create_gdal_link().
void int G_is_little_endian | ( | void | ) |
int G_is_location | ( | const char * | path | ) |
int G_is_mapset | ( | const char * | path | ) |
int G_is_mapset_in_search_path | ( | const char * | mapset | ) |
Check if given mapset is in search path.
mapset | mapset name |
Definition at line 217 of file mapset_nme.c.
References st.
Referenced by G_add_mapset_to_search_path().
int G_is_units_type_spatial | ( | int | units | ) |
int G_is_units_type_temporal | ( | int | units | ) |
char* G_join_basename_strings | ( | const char ** | strings, |
size_t | len | ||
) |
join an array of strings using the basename separator
strings | is an array of strings |
len | is the length of the array |
Definition at line 126 of file basename.c.
References G_get_basename_separator(), G_malloc, and strcpy.
void G_lat_format | ( | double | lat, |
char * | buf | ||
) |
Definition at line 40 of file ll_format.c.
Referenced by G_adjust_window_ll(), and G_format_northing().
const char* G_lat_format_string | ( | void | ) |
Definition at line 50 of file ll_format.c.
void G_lat_parts | ( | double | lat, |
int * | d, | ||
int * | m, | ||
double * | s, | ||
char * | h | ||
) |
Definition at line 116 of file ll_format.c.
int G_lat_scan | ( | const char * | buf, |
double * | lat | ||
) |
Definition at line 45 of file ll_scan.c.
Referenced by G_adjust_window_ll().
int G_legal_filename | ( | const char * | s | ) |
Check for legal database file name.
Legal file names will not begin with '.' or NULL and must not contain the characters, ' ' (space), '/', '"'. '\'' (single quote), '@', ',', '=', '*', and all other non-alphanumeric characters within.
The function prints a warning on error.
s | file name to check |
Definition at line 34 of file legal_name.c.
Referenced by G_make_mapset().
int G_limit_east | ( | double * | , |
int | |||
) |
int G_limit_north | ( | double * | north, |
int | proj | ||
) |
Limit north (y) coordinate.
If the projection has absolute limits (like lat/lon), then this routine modifies the input coordinate to be within the limit.
[in,out] | north | north coordinate |
[in] | proj | projection id |
Definition at line 71 of file wind_limits.c.
References PROJECTION_LL.
int G_limit_south | ( | double * | south, |
int | proj | ||
) |
Limit south (y) coordinate.
If the projection has absolute limits (like lat/lon), then this routine modifies the input coordinate to be within the limit.
[in] | south | south coordinate |
[in] | proj | projection id |
Definition at line 100 of file wind_limits.c.
References PROJECTION_LL.
int G_limit_west | ( | double * | , |
int | |||
) |
char** G_list | ( | int | element, |
const char * | gisbase, | ||
const char * | location, | ||
const char * | mapset | ||
) |
List specified type of elements. Application must release the allocated memory.
element | element type (G_ELEMENT_RASTER, G_ELEMENT_VECTOR, G_ELEMENT_REGION ) |
gisbase | path to GISBASE |
location | location name |
mapset | mapset name |
Definition at line 173 of file gis/list.c.
References _, count, G_calloc, G_ELEMENT_GROUP, G_ELEMENT_RASTER, G_ELEMENT_REGION, G_ELEMENT_VECTOR, G_fatal_error(), G_free(), G_malloc, list, NULL, and strcpy.
void G_list_color_rules | ( | FILE * | out | ) |
Print color rules.
out | file where to print |
Definition at line 175 of file gis/color_rules.c.
void G_list_color_rules_description_type | ( | FILE * | out, |
char * | name | ||
) |
Print color rules with description and type.
The type of color rule including range is appended to the description. If a color rule name is given, color info is printed only for this rule.
name | optional color rule name, or NULL |
out | file where to print |
Definition at line 198 of file gis/color_rules.c.
void G_list_element | ( | const char * | element, |
const char * | desc, | ||
const char * | mapset, | ||
int(*)(const char *, const char *, char *) | lister | ||
) |
General purpose list function.
Will list files from all mapsets in the mapset list for a specified database element.
Note: output is to stdout piped thru the more utility
Given file name, and mapset, lister() should copy a string into 'buf' when called with name == "", should set buf to general title for mapset list.
element | database element (eg, "cell", "cellhd", etc.) |
desc | description for element (if NULL, element is used) |
mapset | mapset to be listed "" to list all mapsets in mapset search list "." will list current mapset |
lister | if given will call this routine to get a list title. NULL if no titles desired. |
Definition at line 51 of file gis/list.c.
Referenced by M_do_list().
void G_llres_format | ( | double | res, |
char * | buf | ||
) |
Definition at line 70 of file ll_format.c.
Referenced by G_adjust_window_ll(), and G_format_resolution().
const char* G_llres_format_string | ( | void | ) |
Definition at line 81 of file ll_format.c.
int G_llres_scan | ( | const char * | buf, |
double * | res | ||
) |
Definition at line 55 of file ll_scan.c.
Referenced by G_adjust_window_ll(), and G_scan_resolution().
const char* G_location | ( | void | ) |
Get current location name.
Returns the name of the current database location. This routine should be used by modules that need to display the current location to the user. See Locations for an explanation of locations.
Definition at line 32 of file location.c.
References G_getenv().
Referenced by G__location_path(), G__mapset_path(), G_get_projepsg(), G_get_projinfo(), G_get_projunits(), G_make_mapset(), I_location_info(), and Vect_hist_command().
char* G_location_path | ( | void | ) |
Get current location UNIX-like path.
Allocated buffer should be freed by G_free(). See G__location_path().
Returns the full UNIX path name of the current database location. For example, if the user is working in location spearfish in the /home/user/grassdata database directory, this routine will return a string which looks like /home/user/grassdata/spearfish.
This function also checks if location path is readable by the current user. It calls G_fatal_error() on failure.
Definition at line 54 of file location.c.
References _, G__location_path(), and G_fatal_error().
Referenced by db_set_default_connection(), and G_get_available_mapsets().
void G_lon_format | ( | double | lon, |
char * | buf | ||
) |
Definition at line 55 of file ll_format.c.
Referenced by G_adjust_window_ll(), and G_format_easting().
const char* G_lon_format_string | ( | void | ) |
Definition at line 65 of file ll_format.c.
void G_lon_parts | ( | double | lon, |
int * | d, | ||
int * | m, | ||
double * | s, | ||
char * | h | ||
) |
Definition at line 132 of file ll_format.c.
int G_lon_scan | ( | const char * | buf, |
double * | lon | ||
) |
Definition at line 50 of file ll_scan.c.
Referenced by G_adjust_window_ll().
int G_lookup_key_value_from_file | ( | const char * | file, |
const char * | key, | ||
char | value[], | ||
int | n | ||
) |
Look up for key in file.
[in] | file | filename |
[in] | key | key to be found in file |
[out] | value | value for key |
[in] | n | number of characters to be copied |
Definition at line 48 of file key_value4.c.
Referenced by GPJ_osr_to_grass().
long G_lrand48 | ( | void | ) |
void G_ls | ( | const char * | dir, |
FILE * | stream | ||
) |
Prints a directory listing to a stream, in prettified column format.
A replacement for system("ls -C"). Lists the contents of the directory specified to the given stream, e.g. stderr. Tries to determine an appropriate column width to keep the number of lines used to a minimum and look pretty on the screen.
dir | Directory to list |
stream | Stream to print listing to |
Definition at line 137 of file ls.c.
References G_free(), G_ls2(), and G_ls_format().
char** G_ls2 | ( | const char * | dir, |
int * | num_files | ||
) |
Stores a sorted directory listing in an array.
The filenames in the specified directory are stored in an array of strings, then sorted alphabetically. Each filename has space allocated using G_store(), which can be freed using G_free() if necessary. The same goes for the array itself.
dir | Directory to list |
num_files | Pointer to an integer in which the total number of files listed will be stored |
Definition at line 94 of file ls.c.
References _, G_fatal_error(), G_realloc, G_store(), NULL, and st.
Referenced by G_ls(), and list_subgroups().
void G_ls_format | ( | char ** | list, |
int | num_items, | ||
int | perline, | ||
FILE * | stream | ||
) |
Prints a listing of items to a stream, in prettified column format.
Lists the contents of the array passed to the given stream, e.g. stderr. Prints the number of items specified by "perline" to each line, unless perline is given as 0 in which case the function tries to determine an appropriate column width to keep the number of lines used to a minimum and look pretty on the screen.
list | Array of strings containing items to be printed |
num_items | Number of items in the array |
perline | Number of items to print per line, 0 for autodetect |
stream | Stream to print listing to |
Definition at line 165 of file ls.c.
References max, and screen_width.
Referenced by G_ls().
void* G_ls_glob_filter | ( | const char * | pat, |
int | exclude, | ||
int | ignorecase | ||
) |
Definition at line 171 of file ls_filter.c.
void* G_ls_regex_filter | ( | const char * | pat, |
int | exclude, | ||
int | extended, | ||
int | ignorecase | ||
) |
Definition at line 151 of file ls_filter.c.
References G_free(), G_malloc, G_set_ls_exclude_filter(), and NULL.
int G_lstat | ( | const char * | file_name, |
struct stat * | buf | ||
) |
Get file status.
Returns information about the specified file.
file_name | file name, in the case of a symbolic link, the link itself is stat-ed, not the file that it refers to |
stat | pointer to structure filled with file information |
Definition at line 145 of file paths.c.
Referenced by G_recursive_copy(), G_recursive_remove(), and list_subgroups().
int G_lz4_compress | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz | ||
) |
Definition at line 78 of file cmprlz4.c.
References _, dst, err(), G_calloc, G_free(), G_lz4_compress_bound(), G_warning(), LZ4_compress_default(), NULL, and src.
int G_lz4_expand | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz | ||
) |
Definition at line 146 of file cmprlz4.c.
References _, dst, err(), G_warning(), LZ4_decompress_safe(), NULL, and src.
int G_make_location | ( | const char * | location_name, |
struct Cell_head * | wind, | ||
const struct Key_Value * | proj_info, | ||
const struct Key_Value * | proj_units | ||
) |
Create a new location.
This function creates a new location in the current database, initializes the projection, default window and current window.
location_name | Name of the new location. Should not include the full path, the location will be created within the current database. |
wind | default window setting for the new location. All fields should be set in this structure, and care should be taken to ensure that the proj/zone fields match the definition in the proj_info parameter(see G_set_cellhd_from_projinfo()). |
proj_info | projection definition suitable to write to the PROJ_INFO file, or NULL for PROJECTION_XY. |
proj_units | projection units suitable to write to the PROJ_UNITS file, or NULL. |
Definition at line 53 of file make_loc.c.
int G_make_location_crs | ( | const char * | location_name, |
struct Cell_head * | wind, | ||
const struct Key_Value * | proj_info, | ||
const struct Key_Value * | proj_units, | ||
const char * | proj_srid, | ||
const char * | proj_wkt | ||
) |
Create a new location.
This function creates a new location in the current database, initializes the projection, default window and current window, and sets WKT, srid, and EPSG code if present
location_name | Name of the new location. Should not include the full path, the location will be created within the current database. |
wind | default window setting for the new location. All fields should be set in this structure, and care should be taken to ensure that the proj/zone fields match the definition in the proj_info parameter(see G_set_cellhd_from_projinfo()). |
proj_info | projection definition suitable to write to the PROJ_INFO file, or NULL for PROJECTION_XY. |
proj_units | projection units suitable to write to the PROJ_UNITS file, or NULL. |
proj_epsg | EPSG code suitable to write to the PROJ_EPSG file, or NULL. |
proj_wkt | WKT definition suitable to write to the PROJ_WKT file, or NULL. |
proj_srid | Spatial reference ID suitable to write to the PROJ_SRID file, or NULL. |
Definition at line 185 of file make_loc.c.
int G_make_location_epsg | ( | const char * | location_name, |
struct Cell_head * | wind, | ||
const struct Key_Value * | proj_info, | ||
const struct Key_Value * | proj_units, | ||
const struct Key_Value * | proj_epsg | ||
) |
Create a new location.
This function creates a new location in the current database, initializes the projection, default window and current window, and sets the EPSG code if present
location_name | Name of the new location. Should not include the full path, the location will be created within the current database. |
wind | default window setting for the new location. All fields should be set in this structure, and care should be taken to ensure that the proj/zone fields match the definition in the proj_info parameter(see G_set_cellhd_from_projinfo()). |
proj_info | projection definition suitable to write to the PROJ_INFO file, or NULL for PROJECTION_XY. |
proj_units | projection units suitable to write to the PROJ_UNITS file, or NULL. |
proj_epsg | EPSG code suitable to write to the PROJ_EPSG file, or NULL. |
Definition at line 126 of file make_loc.c.
int G_make_mapset | ( | const char * | gisdbase_name, |
const char * | location_name, | ||
const char * | mapset_name | ||
) |
Create a new mapset.
This function creates a new mapset in the given location, initializes default window and the current window.
Calls G_fatal_error() if location doesn't exist.
gisdbase_name | full path of GISDBASE to create mapset in (NULL for the current GISDBASE) |
location_name | name of location to create mapset in (NULL for the current location) |
mapset_name | Name of the new mapset. Should not include the full path, the mapset will be created within the specified database and location. |
Definition at line 43 of file make_mapset.c.
References _, G_create_alt_env(), G_fatal_error(), G_get_default_window(), G_gisdbase(), G_legal_filename(), G_location(), G_mkdir(), G_put_element_window(), G_setenv_nogisrc(), G_switch_env(), GPATH_MAX, and NULL.
int G_make_mapset_dir_object | ( | const char * | type, |
const char * | name | ||
) |
Create directory for an object of a given type.
Creates the specified element directory in the current mapset. It will check for the existence of the element and do nothing if it is found so this routine can be called even if the element already exists to ensure that it exists.
Any failure to create it, including the case when it exists (i.e., was created by another process after the existence test) is considered a failure because two processes should not attempt to create two objects of the same name (and type).
This function is for objects which are directories (the function does not create files).
Calls G_fatal_error() on failure.
type | object type (e.g., vector ) |
name | object name (e.g., bridges ) |
Definition at line 108 of file mapset_msc.c.
Referenced by G__make_mapset_element_misc(), Rast3d_make_mapset_map_directory(), and Vect_copy().
int G_make_mapset_element | ( | const char * | p_element | ) |
Create element in the current mapset.
Make the specified element in the current mapset will check for the existence of the element and do nothing if it is found so this routine can be called even if the element already exists.
Calls G_fatal_error() on failure.
p_element | element to be created in mapset |
Definition at line 44 of file mapset_msc.c.
References G_file_name(), G_mapset(), GPATH_MAX, and NULL.
int G_make_mapset_element_tmp | ( | const char * | p_element | ) |
Create element in the temporary directory.
See G_file_name_tmp() for details.
p_element | element to be created in mapset (e.g., elevation ) |
Definition at line 131 of file mapset_msc.c.
References G_file_name_tmp(), G_mapset(), GPATH_MAX, and NULL.
int G_make_mapset_object_group | ( | const char * | type | ) |
Create directory for group of elements of a given type.
Creates the specified element directory in the current mapset. It will check for the existence of the element and do nothing if it is found so this routine can be called even if the element already exists to ensure that it exists.
If creation fails, but the directory exists after the failure, the function reports success. Therefore, two processes creating a directory in this way can work in parallel.
Calls G_fatal_error() on failure.
type | object type (e.g., cell ) |
Definition at line 74 of file mapset_msc.c.
Referenced by db_set_default_connection(), G__temp_element_basedir(), M_do_copy(), and Rast__quant_export().
int G_make_mapset_object_group_basedir | ( | const char * | type, |
const char * | basedir | ||
) |
Create directory for type of objects in the temporary directory.
See G_file_name_basedir() for details.
type | object type (e.g., cell ) |
Definition at line 175 of file mapset_msc.c.
Referenced by G__temp_element_basedir().
int G_make_mapset_object_group_tmp | ( | const char * | type | ) |
Create directory for type of objects in the temporary directory.
See G_file_name_tmp() for details.
type | object type (e.g., cell ) |
Definition at line 153 of file mapset_msc.c.
const char* G_mapset | ( | void | ) |
Get current mapset name.
Returns the name of the current mapset in the current location. This routine is often used when accessing files in the current mapset. See Mapsets for an explanation of mapsets.
G_fatal_error() is called on error.
Definition at line 33 of file gis/mapset.c.
References _, G__mapset(), and G_fatal_error().
Referenced by check_mapset_in_layer_name(), db_set_default_connection(), fopen_group_file_old(), fopen_subgroup_file_old(), G_make_mapset_element(), G_make_mapset_element_tmp(), G_rename(), Gs_save_3dview(), I_find_group(), I_find_group_file(), I_find_subgroup(), I_find_subgroup_file(), I_fopen_group_file_append(), I_fopen_group_file_new(), I_fopen_signature_file_old(), I_fopen_sigset_file_old(), I_fopen_subgroup_file_append(), I_fopen_subgroup_file_new(), I_get_control_points(), I_get_group(), I_list_subgroups(), I_location_info(), I_put_control_points(), M__empty(), M_do_copy(), M_do_remove(), M_do_rename(), main(), Rast3d_mask_file_exists(), Rast__check_for_auto_masking(), Rast__close_null(), Rast__mask_info(), Rast__open_null_write(), Rast__quant_export(), Rast__quant_import(), Rast_mask_is_present(), Rast_mask_name(), Rast_mask_status(), Rast_remove_colors(), Rast_write_range(), V1_close_ogr(), Vect_close(), Vect_copy(), Vect_hist_command(), Vect_remove_colors(), Vect_save_fidx(), and Vect_set_db_updated().
char* G_mapset_path | ( | void | ) |
Get current mapset UNIX-like path.
Allocated buffer should be freed by G_free(). See G__mapset_path().
Returns the full UNIX path name of the current mapset. For example, if the user is working in mapset user1, location spearfish in the /home/user/grassdata database directory, this routine will return a string which looks like /home/user/grassdata/spearfish/user1.
This function also checks if mapset path is readable by the current user. It calls G_fatal_error() on failure.
Definition at line 73 of file gis/mapset.c.
References _, G__mapset_path(), and G_fatal_error().
int G_mapset_permissions | ( | const char * | mapset | ) |
Check for user mapset permission.
mapset | mapset name |
Definition at line 291 of file mapset_msc.c.
References G_file_name(), G_stat(), and GPATH_MAX.
int G_mapset_permissions2 | ( | const char * | gisdbase, |
const char * | location, | ||
const char * | mapset | ||
) |
Check for user mapset permission.
gisdbase | full path to GISDBASE |
location | location name |
mapset | mapset name |
Definition at line 320 of file mapset_msc.c.
double G_meridional_radius_of_curvature | ( | double | lon, |
double | a, | ||
double | e2 | ||
) |
void G_message | ( | const char * | , |
... | |||
) |
double G_meters_to_units_factor | ( | int | units | ) |
Units conversion from meters to units.
Units codes (gis.h):
Returns a factor which converts meters to units (by multiplication).
units | units code |
Definition at line 38 of file units.c.
References U_FEET, U_KILOMETERS, U_METERS, U_MILES, and U_USFEET.
double G_meters_to_units_factor_sq | ( | int | units | ) |
Units conversion from square meters to square units.
Units codes (gis.h):
Returns a factor which converts square meters to square units (by multiplication).
units | units code |
Definition at line 88 of file units.c.
References U_ACRES, U_FEET, U_HECTARES, U_KILOMETERS, U_METERS, U_MILES, and U_USFEET.
int G_mkdir | ( | const char * | path | ) |
Creates a new directory.
Creates a new directory with permissions 0777 (on Unix) or default permissions(?) on Windows.
path | String containing path of directory to be created |
Definition at line 27 of file paths.c.
Referenced by G_config_path(), G_make_mapset(), G_recursive_copy(), and V1_close_nat().
int G_mkstemp | ( | char * | template, |
int | flags, | ||
int | mode | ||
) |
Returns a file descriptor.
This routine opens the file and returns a descriptor.
The last two take the arguments "flags" and "mode". "flags" should be O_WRONLY or O_RDWR, plus any other desired flags (e.g. O_APPEND). "mode" is the file mode (0666 would be typical).
The functions does not use the PID, although the caller can do so.
In theory, up to 26^5 (= ~12 million) filenames will be attempted until it finds one which doesn't exist.
Definition at line 128 of file mkstemp.c.
Referenced by ami_single_temp_name().
FILE* G_mkstemp_fp | ( | char * | template, |
int | flags, | ||
int | mode | ||
) |
Returns a file descriptor.
This routine opens the file and returns a FILE*.
The last two take the arguments "flags" and "mode". "flags" should be O_WRONLY or O_RDWR, plus any other desired flags (e.g. O_APPEND). "mode" is the file mode (0666 would be typical).
The functions does not use the PID, although the caller can do so.
In theory, up to 26^5 (= ~12 million) filenames will be attempted until it finds one which doesn't exist.
char* G_mktemp | ( | char * | template | ) |
Opens a temporary file.
This routine opens the file.
The last two take the arguments "flags" and "mode". "flags" should be O_WRONLY or O_RDWR, plus any other desired flags (e.g. O_APPEND). "mode" is the file mode (0666 would be typical).
The functions does not use the PID, although the caller can do so.
In theory, up to 26^5 (= ~12 million) filenames will be attempted until it finds one which doesn't exist.
Note: G_mktemp() as such it is prone to race conditions (some other process may create that file after G_mktemp() returns).
long G_mrand48 | ( | void | ) |
char* G_myname | ( | void | ) |
Returns location title.
Returns a one line title for the database location. This title is read from the file MYNAME in the PERMANENT mapset. See also Permanent_Mapset for a discussion of the PERMANENT mapset.
Note: This name is the first line in the file $GISDBASE/$LOCATION_NAME/PERMANENT/MYNAME
Definition at line 31 of file myname.c.
References _, G_file_name(), G_getl(), G_store(), GNAME_MAX, GPATH_MAX, name, and strcpy.
int G_name_is_fully_qualified | ( | const char * | fullname, |
char * | name, | ||
char * | mapset | ||
) |
Check if map name is fully qualified (map @ mapset)
Returns a fully qualified name for the file name in mapset. Currently this string is in the form name@mapset, but the programmer should pretend not to know this and always call this routine to get the fully qualified name.
Note:
fullname | full map name | |
[out] | name | map name |
[out] | mapset | mapset name |
Definition at line 36 of file nme_in_mps.c.
References name.
Referenced by G_rename(), G_unqualified_name(), M_do_remove(), Rast__quant_export(), Rast__quant_import(), Rast_remove_colors(), Vect_copy(), and Vect_remove_colors().
struct ilist* G_new_ilist | ( | void | ) |
Return a new integer list.
G_fatal_error() will be invoked by the allocation function.
Definition at line 43 of file ilist.c.
References G_init_ilist(), G_malloc, l, and NULL.
Referenced by Rast_get_vrt().
void G_newlines_to_spaces | ( | char * | s | ) |
Definition at line 3 of file nl_to_spaces.c.
Referenced by Rast_set_cats_title(), and Rast_set_d_cat().
int G_no_compress | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz | ||
) |
Definition at line 155 of file compress.c.
int G_no_expand | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz | ||
) |
Definition at line 176 of file compress.c.
int G_num_standard_colors | ( | void | ) |
Get number of named colors (RGB triplets)
Definition at line 54 of file color_str.c.
int G_number_of_tokens | ( | char ** | tokens | ) |
Return number of tokens.
tokens |
Definition at line 179 of file gis/token.c.
References NULL.
Referenced by G_set_keywords(), and Vect__open_cursor_next_line_pg().
FILE* G_open_mail | ( | struct Popen * | ) |
Definition at line 45 of file pager.c.
References G_popen_clear(), G_popen_write(), G_whoami(), and NULL.
int G_open_new | ( | const char * | element, |
const char * | name | ||
) |
Open a new database file.
Creates name in the current mapset and opens it for write only.
The database file name under the element in the current mapset is created and opened for writing (but not reading). The UNIX open() routine is used to open the file. If the file does not exist, -1 is returned. Otherwise the file is positioned at the end of the file and the file descriptor from the open() is returned.
element | database element name |
name | map file name |
Definition at line 149 of file gis/open.c.
int G_open_new_misc | ( | const char * | dir, |
const char * | element, | ||
const char * | name | ||
) |
open a new database misc file
The database file element under dir/name in the current mapset is created and opened for writing (but not reading). The UNIX open( ) routine is used to open the file. If the file does not exist, -1 is returned. Otherwise the file is positioned at the end of the file and the file descriptor from the open( ) is returned.
element | |
name |
Definition at line 111 of file open_misc.c.
Referenced by Rast_write_fp_range(), and Rast_write_rstats().
int G_open_old | ( | const char * | element, |
const char * | name, | ||
const char * | mapset | ||
) |
Open a database file for reading.
The database file name under the element in the specified mapset is opened for reading (but not for writing). The UNIX open() routine is used to open the file. If the file does not exist, -1 is returned. Otherwise the file descriptor from the open() is returned.
element | database element name |
name | map file name |
mapset | mapset containing map name |
Definition at line 170 of file gis/open.c.
Referenced by Rast__open_old().
int G_open_old_misc | ( | const char * | dir, |
const char * | element, | ||
const char * | name, | ||
const char * | mapset | ||
) |
open a database misc file for reading
The database file element under dir/name in the specified mapset is opened for reading (but not for writing). The UNIX open( ) routine is used to open the file. If the file does not exist, -1 is returned. Otherwise the file descriptor from the open( ) is returned.
element | |
name | |
mapset |
Definition at line 132 of file open_misc.c.
Referenced by Rast3d_open_cell_old_no_header(), Rast3d_read_range(), and Rast_read_fp_range().
FILE* G_open_option_file | ( | const struct Option * | option | ) |
Get an input/output file pointer from the option. If the file name is omitted or '-', it returns either stdin or stdout based on the gisprompt.
Calls G_fatal_error() on error. File pointer can be later closed by G_close_option_file().
option | pointer to a file option |
Definition at line 1919 of file parser.c.
References _, Option::answer, G_fatal_error(), Option::gisprompt, Option::key, Option::multiple, and NULL.
FILE* G_open_pager | ( | struct Popen * | pager | ) |
Definition at line 13 of file pager.c.
References G_popen_clear(), G_popen_write(), and NULL.
int G_open_update | ( | const char * | element, |
const char * | name | ||
) |
Open a database file for update.
The database file name under the element in the current mapset is opened for reading and writing. The UNIX open() routine is used to open the file. If the file does not exist, -1 is returned. Otherwise the file is positioned at the end of the file and the file descriptor from the open() is returned.
element | database element name |
name | map file name |
Definition at line 191 of file gis/open.c.
int G_open_update_misc | ( | const char * | dir, |
const char * | element, | ||
const char * | name | ||
) |
open a database misc file for update
The database file element under dir/name in the current mapset is opened for reading and writing. The UNIX open( ) routine is used to open the file. If the file does not exist, -1 is returned. Otherwise the file is positioned at the end of the file and the file descriptor from the open( ) is returned.
element | |
name |
Definition at line 152 of file open_misc.c.
void G_option_collective | ( | void * | first, |
... | |||
) |
Sets the options to be collective.
If any option is present, all the other options must also be present all or nothing from a set.
The last item of the list must be NULL.
first | first given option |
Definition at line 380 of file parser_dependencies.c.
void G_option_excludes | ( | void * | first, |
... | |||
) |
Exclude selected options.
If the first option is present, none of the other options may also (should?) be present.
The last item of the list must be NULL.
first | first given option |
Definition at line 349 of file parser_dependencies.c.
void G_option_exclusive | ( | void * | first, |
... | |||
) |
Sets the options to be mutually exclusive.
When running the module, at most one option from a set can be provided.
The last item of the list must be NULL.
first | first given option |
Definition at line 214 of file parser_dependencies.c.
void G_option_required | ( | void * | first, |
... | |||
) |
Sets the options to be required.
At least one option from a set must be given.
The last item of the list must be NULL.
first | first given option |
Definition at line 242 of file parser_dependencies.c.
void G_option_requires | ( | void * | first, |
... | |||
) |
Define a list of options from which at least one option is required if first option is present.
If the first option is present, at least one of the other options must also be present.
The last item of the list must be NULL.
If you want all options to be provided use G_option_requires_all() function. If you want more than one option to be present but not all, call this function multiple times.
first | first given option |
Definition at line 278 of file parser_dependencies.c.
void G_option_requires_all | ( | void * | first, |
... | |||
) |
Define additionally required options for an option.
If the first option is present, all the other options must also be present.
The last item of the list must be NULL.
If it is enough if only one option from a set is present, use G_option_requires() function.
first | first given option |
Definition at line 318 of file parser_dependencies.c.
void G_option_rule | ( | int | type, |
int | nopts, | ||
void ** | opts | ||
) |
Set generic option rule.
Supported rule types:
type | rule type |
nopts | number of options in the array |
opts | array of options |
Definition at line 77 of file parser_dependencies.c.
char* G_option_to_separator | ( | const struct Option * | option | ) |
Get separator string from the option.
Calls G_fatal_error() on error. Allocated string can be later freed by G_free().
option | pointer to separator option |
Definition at line 1857 of file parser.c.
References _, Option::answer, G_debug(), G_fatal_error(), G_store(), Option::gisprompt, Option::key, and NULL.
const char* G_original_program_name | ( | void | ) |
Return original path of the executed program.
This function returns the name of the program as set by the call to G_gisinit().
Unlike G_program_name() which returns name of the module this function return original path which was used to execute the program. For standard GRASS modules, it will be the same as the result from G_program_name() function.
Definition at line 46 of file progrm_nme.c.
int G_owner | ( | const char * | path | ) |
int G_parser | ( | int | argc, |
char ** | argv | ||
) |
Parse command line.
The command line parameters argv and the number of parameters argc from the main() routine are passed directly to G_parser(). G_parser() accepts the command line input entered by the user, and parses this input according to the input options and/or flags that were defined by the programmer.
Note: The only functions which can legitimately be called before G_parser() are:
The usual order a module calls functions is:
argc | number of arguments |
argv | argument list |
Definition at line 321 of file parser.c.
References _, err(), FALSE, G_basename(), G_is_dirsep(), G_store(), G_verbose_std(), G_warning(), Option::key, NULL, Option::required, and st.
void G_percent | ( | long | n, |
long | d, | ||
int | s | ||
) |
Print percent complete messages.
This routine prints a percentage complete message to stderr. The percentage complete is (n/d)*100, and these are printed only for each s percentage. This is perhaps best explained by example:
This example code will print completion messages at 10% increments; i.e., 0%, 10%, 20%, 30%, etc., up to 100%. Each message does not appear on a new line, but rather erases the previous message.
Note that to prevent the illusion of the module stalling, the G_percent() call is placed before the time consuming part of the for loop, and an additional call is generally needed after the loop to "finish it off" at 100%.
n | current element |
d | total number of elements |
s | increment size |
Definition at line 61 of file percent.c.
Referenced by NetA_betweenness_closeness().
void G_percent_reset | ( | void | ) |
Reset G_percent() to 0%; do not add newline.
Definition at line 117 of file percent.c.
References st.
Referenced by NetA_betweenness_closeness().
double G_planimetric_polygon_area | ( | const double * | x, |
const double * | y, | ||
int | n | ||
) |
Calculates planimetric polygon area.
x | array of x values |
y | array of y values |
n | number of x,y pairs |
Definition at line 25 of file area_poly2.c.
Referenced by G_area_of_polygon().
int G_plot_area | ( | double *const * | xs, |
double *const * | ys, | ||
int * | rpnts, | ||
int | rings | ||
) |
Plot multiple polygons.
Like G_plot_polygon(), except it takes a set of polygons, each with npts[i] vertices, where the number of polygons is specified with the rings argument. It is especially useful for plotting vector areas with interior islands.
xs | pointer to pointer for X's |
ys | pointer to pointer for Y's |
rpnts | array of ints w/ num points per ring |
rings | number of rings |
void G_plot_fx | ( | double(*)(double) | f, |
double | east1, | ||
double | east2 | ||
) |
Plot f(east1) to f(east2)
The function f(east) is plotted from east1 to east2. The function f(east) must return the map northing coordinate associated with east.
f | plotting function |
east1 | easting (first point) |
east2 | easting (second point) |
Definition at line 782 of file plot.c.
References G_plot_line(), and st.
void G_plot_line | ( | double | east1, |
double | north1, | ||
double | east2, | ||
double | north2 | ||
) |
Plot line between latlon coordinates (fastline)
A line from east1,north1 to east2,north2 is plotted in output x,y coordinates (e.g. pixels for graphics.) This routine handles global wrap-around for latitude-longitude databases.
east1,north1 | first point (start line node) |
east2,north2 | second point (end line node) |
Definition at line 209 of file plot.c.
Referenced by G_plot_fx().
void G_plot_line2 | ( | double | east1, |
double | north1, | ||
double | east2, | ||
double | north2 | ||
) |
Plot line between latlon coordinates (slowline)
A line from east1,north1 to east2,north2 is plotted in output x,y coordinates (e.g. pixels for graphics.) This routine handles global wrap-around for latitude-longitude databases.
east1,north1 | first point (start line node) |
east2,north2 | second point (end line node) |
void G_plot_point | ( | double | east, |
double | north | ||
) |
Plot point.
east | easting |
north | northing |
Definition at line 190 of file plot.c.
References G_plot_where_xy(), st, and x.
int G_plot_polygon | ( | const double * | x, |
const double * | y, | ||
int | n | ||
) |
Plot filled polygon with n vertices.
The polygon, described by the n vertices east,north, is plotted in the output x,y space as a filled polygon.
x | coordinates of vertices |
y | coordinates of vertices |
n | number of vertices |
void G_plot_where_en | ( | int | x, |
int | y, | ||
double * | east, | ||
double * | north | ||
) |
void G_plot_where_xy | ( | double | east, |
double | north, | ||
int * | x, | ||
int * | y | ||
) |
Converts east,north to x,y.
The map coordinates east,north are converted to pixel coordinates x,y.
east | easting |
north | nothing |
x | x coordinate |
y | y coordinate |
Definition at line 160 of file plot.c.
References x.
Referenced by G_plot_point().
int G_point_in_region | ( | double | easting, |
double | northing | ||
) |
int G_point_in_window | ( | double | easting, |
double | northing, | ||
const struct Cell_head * | window | ||
) |
Returns TRUE if coordinate is within the given map region.
Use instead of G_point_in_region() when used in a loop (it's more efficient to only fetch the window once) or for checking if a point is in another region (e.g. contained with a raster map's bounds).
easting | |
northing | |
window |
int G_pole_in_polygon | ( | const double * | x, |
const double * | y, | ||
int | n | ||
) |
Check if pole is in polygon.
For latitude-longitude coordinates, this routine determines if the polygon defined by the n coordinate vertices x,y contains one of the poles.
Note: Use this routine only if the projection is PROJECTION_LL.
x | array of x coordinates |
y | array of y coordinates |
n | number of coordinates |
Definition at line 35 of file pole_in_poly.c.
void G_popen_clear | ( | struct Popen * | state | ) |
Definition at line 56 of file popen.c.
Referenced by G_open_mail(), and G_open_pager().
void G_popen_close | ( | struct Popen * | state | ) |
Definition at line 72 of file popen.c.
References G_wait(), and state.
Referenced by G_close_mail(), and G_close_pager().
FILE* G_popen_read | ( | struct Popen * | state, |
const char * | program, | ||
const char ** | args | ||
) |
FILE* G_popen_write | ( | struct Popen * | state, |
const char * | program, | ||
const char ** | args | ||
) |
Definition at line 62 of file popen.c.
Referenced by G_open_mail(), and G_open_pager().
const char* G_program_name | ( | void | ) |
Return module name.
Routine returns the name of the module as set by the call to G_gisinit().
Definition at line 28 of file progrm_nme.c.
References name.
void G_progress | ( | long | n, |
int | s | ||
) |
Print progress info messages.
Use G_percent() when number of elements is defined.
This routine prints a progress info message to stderr. The value n is printed only for each s. This is perhaps best explained by example:
This example code will print progress in messages at 1000 increments; i.e., 1000, 2000, 3000, 4000, etc., up to number of features for given vector map. Each message does not appear on a new line, but rather erases the previous message.
n | current element |
s | increment size |
int G_projection | ( | void | ) |
Query cartographic projection.
This routine returns a code indicating the projection for the active region. The current values are (see gis.h)
Others may be added in the future.
Definition at line 32 of file proj1.c.
Referenced by G_database_projection_name(), G_database_unit(), G_get_projepsg(), G_get_projinfo(), G_get_projunits(), G_shortest_way(), and Rast__check_for_auto_masking().
const char* G_projection_name | ( | int | n | ) |
Get projection name.
n | projection code |
Definition at line 55 of file proj2.c.
References _, NULL, PROJECTION_LL, PROJECTION_OTHER, PROJECTION_UTM, and PROJECTION_XY.
Referenced by G_database_projection_name(), Rast__open_old(), and Vect_get_proj_name().
int G_projection_units | ( | int | n | ) |
Get projection units code (for internal use only)
n | projection code |
Supported units (see gis.h):
Definition at line 32 of file proj2.c.
References PROJECTION_LL, PROJECTION_UTM, PROJECTION_XY, U_DEGREES, U_METERS, U_UNDEFINED, and U_UNKNOWN.
Referenced by G_database_unit().
Saves info to a 3d.view file in the current mapset.
The address of a window (struct Cell_head *) may be passed, or if NULL is passed, the Cell_head structure inside the G_3dview struct will be used. e.g., if you called G_get_3dview_defaults with the Cell_head you want saved, the G_3dview returned already contains the new Cell_head. But if you're using all the keywords, so didn't need defaults, pass this routine the address of a Cell_head.
User should call G_get_3dview_defaults before filling a G_3dview struct to be written if not using all of the optional keywords.
These keywords are constant in all 3d.view files:
PGM_ID
cell keywords:
north
south
east
west
rows
cols
required keywords:
TO_EASTING
TO_NORTHING
TO_HEIGHT
FROM_EASTING
FROM_NORTHING
FROM_HEIGHT
Z_EXAG
FIELD_VIEW
optional keywords: (defaults provided when reading)
TWIST
MESH_FREQ
POLY_RES
DOAVG
DISPLAY_TYPE
DOZERO
COLORGRID
SHADING
FRINGE
BG_COL
GRID_COL
OTHER_COL
LIGHTS_ON
LIGHTPOS
LIGHTCOL
LIGHTAMBIENT
SHINE
SURFACEONLY
[in] | fname | file name |
[in] | View | |
[in] | Win |
Definition at line 163 of file view.c.
References _, G_fopen_new(), G_warning(), and NULL.
Referenced by Gs_save_3dview().
int G_put_element_window | ( | const struct Cell_head * | window, |
const char * | dir, | ||
const char * | name | ||
) |
Write the region.
Writes the region file (WIND) in the user's current mapset from region.
Warning: Since this routine actually changes the region, it should only be called by modules which the user knows will change the region. It is probably fair to say that only the g.region
should call this routine.
[in,out] | window | pointer to Cell_head |
dir | directory name | |
name | file name |
Definition at line 74 of file put_window.c.
Referenced by G_make_mapset().
int G_put_window | ( | const struct Cell_head * | window | ) |
Writes the region (window)
Writes the region file (WIND) in the user's current mapset or when environmental variable WIND_OVERRIDE
is set, it writes the region to file specified by WIND_OVERRIDE
variable.
When WIND_OVERRIDE
is set the current process and child processes are affected. Otherwise the whole GRASS session is affected.
WIND_OVERRIDE
is not set, this routine actually changes the region. So in this case it should only be called by modules which the user knows will change the region. It is probably fair to say that only the g.region
should call this routine unless WIND_OVERRIDE
is set.This function does not adjust the window
before setting the region so you should call G_adjust_Cell_head() before calling this function.
[in,out] | window | pointer to Cell_head |
Definition at line 46 of file put_window.c.
void G_putenv | ( | const char * | name, |
const char * | value | ||
) |
double G_radius_of_conformal_tangent_sphere | ( | double | lon, |
double | a, | ||
double | e2 | ||
) |
int int G_rasprintf | ( | char ** | , |
size_t * | , | ||
const char * | , | ||
... | |||
) |
char* G_rc_path | ( | const char * | element, |
const char * | item | ||
) |
Returns path to element and item.
Either element or item can be NULL, but not both. If element is NULL, then the file is assumed to live at the top level. If file is NULL, then it is assumed the caller is not interested in the file. If the element or rc dir do not exist, they are created. However, the file is never checked for.
[in] | element | |
[in] | item |
Definition at line 288 of file user_config.c.
int G_read_compressed | ( | int | fd, |
int | rbytes, | ||
unsigned char * | dst, | ||
int | nbytes, | ||
int | number | ||
) |
Definition at line 244 of file compress.c.
References _, b, dst, err(), G_calloc, G_COMPRESSED_NO, G_COMPRESSED_YES, G_expand(), G_free(), G_warning(), and NULL.
void G_read_datum_table | ( | void | ) |
Definition at line 141 of file gis/datum.c.
References file, and GPATH_MAX.
Referenced by G_datum_description(), G_datum_ellipsoid(), G_datum_name(), G_get_datum_by_name(), and G_init_all().
int G_read_ellipsoid_table | ( | int | fatal | ) |
Read ellipsoid table.
fatal | non-zero value for G_fatal_error(), otherwise G_warning() is used |
Definition at line 246 of file get_ellipse.c.
References file, and GPATH_MAX.
Referenced by G_ellipsoid_description(), G_ellipsoid_name(), and G_init_all().
struct Key_Value* G_read_key_value_file | ( | const char * | file | ) |
Read key/values pairs from file.
Allocated memory must be freed G_free_key_value(). Call G_fatal_error() when unable to read key/value items from the file.
[in] | file | filename for reading |
Definition at line 55 of file key_value3.c.
References _, file, G_fatal_error(), and G_fread_key_value().
Referenced by G_get_projepsg(), G_get_projinfo(), G_get_projunits(), and Rast__check_fp_type().
int G_read_raster3d_timestamp | ( | const char * | name, |
const char * | mapset, | ||
struct TimeStamp * | ts | ||
) |
Read timestamp from 3D raster map.
name | map name | |
mapset | mapset name | |
[out] | ts | TimeStamp struct to populate |
Definition at line 594 of file timestamp.c.
int G_read_raster_timestamp | ( | const char * | name, |
const char * | mapset, | ||
struct TimeStamp * | ts | ||
) |
Read timestamp from raster map.
name | map name | |
mapset | mapset the map lives in | |
[out] | ts | TimeStamp struct to populate |
Definition at line 374 of file timestamp.c.
int G_read_vector_timestamp | ( | const char * | name, |
const char * | layer, | ||
const char * | mapset, | ||
struct TimeStamp * | ts | ||
) |
Read timestamp from vector map.
name | map name | |
layer | The layer names, in case of NULL, layer one is assumed | |
mapset | mapset name | |
[out] | ts | TimeStamp struct to populate |
Definition at line 458 of file timestamp.c.
char* G_recreate_command | ( | void | ) |
Creates command to run non-interactive.
Creates a command-line that runs the current command completely non-interactive.
Definition at line 838 of file parser.c.
References FALSE, and recreate_command().
Referenced by Rast_command_history(), and Vect_hist_command().
int G_recursive_copy | ( | const char * | src, |
const char * | dst | ||
) |
Copy recursively source directory to destination directory.
RULE:
This rule is designed according to general/manage/lib/copy.sh.
POSSIBLE CASES:
* if src is a file: * if dst does not exist: * copy src to dst RULE 1 * if dst is a file: * delete dst and copy src to dst RULE 2 * if dst is a directory: * try recursive_copy(src, dst/src) RULE 3 * if src is a directory: * if dst does not exist: * copy src to dst RULE 1 * if dst is a file: * delete dst and copy src to dst RULE 2 * if dst is a directory: * try RULE 4 * for i in `ls src` * do * recursive_copy(src/$i, dst/$i) * done *
src | source directory |
dst | destination directory |
Definition at line 70 of file copy_dir.c.
References dst, G_lstat(), G_mkdir(), G_recursive_copy(), GPATH_MAX, and src.
Referenced by G_recursive_copy(), M_do_copy(), and V1_close_nat().
int G_recursive_remove | ( | const char * | path | ) |
Recursively remove all files in given directory.
Equivalent to rm -rf path.
path | path to the directory which should be removed |
Definition at line 113 of file remove.c.
References G_lstat(), G_recursive_remove(), GPATH_MAX, and NULL.
Referenced by G_recursive_remove().
int G_remove | ( | const char * | element, |
const char * | name | ||
) |
Remove a database file.
The file or directory name under the database element directory in the current mapset is removed.
If name is a directory, everything within the directory is removed as well.
element | element name |
name | file name |
Definition at line 44 of file remove.c.
Referenced by G_remove_vector_timestamp(), M_do_copy(), M_do_remove(), M_do_rename(), Rast__quant_export(), Rast_remove_colors(), and Vect_remove_colors().
void G_remove_commas | ( | char * | buf | ) |
void G_remove_error_handler | ( | void(*)(void *) | func, |
void * | closure | ||
) |
Remove existing error handler.
func | handler to be remove |
closure | pointer to closure data |
Definition at line 85 of file gis/handler.c.
Referenced by db_unset_error_handler_driver().
int G_remove_misc | ( | const char * | dir, |
const char * | element, | ||
const char * | name | ||
) |
Remove a database misc file.
The file or directory name under the database element directory in the current mapset is removed.
If name is a directory, everything within the directory is removed as well.
element | element name |
name | file name |
Definition at line 65 of file remove.c.
Referenced by G_remove_raster3d_timestamp(), G_remove_raster_timestamp(), Rast3d_remove_color(), Rast__quant_export(), Rast__remove_fp_range(), Rast_remove_histogram(), Rast_write_fp_range(), Rast_write_range(), and Rast_write_rstats().
int G_remove_raster3d_timestamp | ( | const char * | name | ) |
Remove timestamp from 3D raster map.
Only timestamp files in current mapset can be removed.
name | map name |
Definition at line 627 of file timestamp.c.
References G_remove_misc(), GRID3, and name.
int G_remove_raster_timestamp | ( | const char * | name | ) |
Remove timestamp from raster map.
Only timestamp files in current mapset can be removed.
name | map name |
Definition at line 407 of file timestamp.c.
References G_remove_misc(), name, and RAST_MISC.
int G_remove_vector_timestamp | ( | const char * | name, |
const char * | layer | ||
) |
Remove timestamp from vector map.
Only timestamp files in current mapset can be removed.
name | map name |
layer | The layer names, in case of NULL, layer one is assumed |
Definition at line 553 of file timestamp.c.
References G_remove(), GNAME_MAX, GPATH_MAX, GV_DIRECTORY, GV_TIMESTAMP_ELEMENT, and name.
int G_rename | ( | const char * | element, |
const char * | oldname, | ||
const char * | newname | ||
) |
Rename a database file.
The file or directory oldname under the database element directory in the current mapset is renamed to newname.
element | element name |
oldname | current name |
newname | new name |
Definition at line 69 of file rename.c.
References G_file_name(), G_mapset(), G_name_is_fully_qualified(), G_rename_file(), GMAPSET_MAX, GNAME_MAX, and GPATH_MAX.
Referenced by M_do_rename().
int G_rename_file | ( | const char * | oldname, |
const char * | newname | ||
) |
Rename a file or a directory in the filesystem.
The file or directory oldname is renamed to newname.
oldname | current name |
newname | new name |
Definition at line 31 of file rename.c.
References G_copy_file().
Referenced by G_rename(), and PS_Graph_close().
void G_reset_mapsets | ( | void | ) |
double G_rhumbline_lat_from_lon | ( | double | lon | ) |
int G_rle_compress | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz | ||
) |
int G_rle_expand | ( | unsigned char * | src, |
int | src_sz, | ||
unsigned char * | dst, | ||
int | dst_sz | ||
) |
void G_rotate_around_point | ( | double | X0, |
double | Y0, | ||
double * | X1, | ||
double * | Y1, | ||
double | angle | ||
) |
Rotate point (double version)
Given a point, angle, and origin, rotate the point around the origin by the given angle. Coordinates and results are double prec floating point.
X0 | X component of origin (center of circle) | |
Y0 | Y component of origin (center of circle) | |
[out] | X1 | X component of point to be rotated (variable is modified!) |
[out] | Y1 | Y component of point to be rotated (variable is modified!) |
angle | in degrees, measured CCW from east |
Definition at line 33 of file rotate.c.
Referenced by G_rotate_around_point_int().
void G_rotate_around_point_int | ( | int | X0, |
int | Y0, | ||
int * | X1, | ||
int * | Y1, | ||
double | angle | ||
) |
Rotate point (int version)
Given a point, angle, and origin, rotate the point around the origin by the given angle. Coordinates are given in integer and results are rounded back to integer.
X0 | X component of origin (center of circle) | |
Y0 | Y component of origin (center of circle) | |
[out] | X1 | X component of point to be rotated (variable is modified!) |
[out] | Y1 | Y component of point to be rotated (variable is modified!) |
angle | in degrees, measured CCW from east |
Definition at line 60 of file rotate.c.
References G_rotate_around_point(), and x.
int G_saprintf | ( | char * | str, |
const char * | format, | ||
... | |||
) |
sprintf() version of G_aprintf(). See G_aprintf() for more details.
[in] | str | string buffer |
[in] | format | string format |
[in] | ... | arguments for the format string |
int G_scan_easting | ( | const char * | buf, |
double * | easting, | ||
int | projection | ||
) |
ASCII easting to double.
Converts the ASCII "easting" coordinate string in buf to its double representation (into easting).
Supported projection codes (see gis.h):
buf | buffer containing string easting | |
[out] | easting | easting |
projection | projection code |
Definition at line 69 of file wind_scan.c.
References PROJECTION_LL.
int G_scan_northing | ( | const char * | buf, |
double * | northing, | ||
int | projection | ||
) |
ASCII northing to double.
Converts the ASCII "northing" coordinate string in buf to its double representation (into northing).
Supported projection codes (see gis.h):
buf | buffer hold string northing | |
[out] | northing | northing |
projection | projection code |
Definition at line 38 of file wind_scan.c.
References PROJECTION_LL.
int G_scan_resolution | ( | const char * | buf, |
double * | res, | ||
int | projection | ||
) |
ASCII resolution to double.
Converts the ASCII "resolution" string in buf to its double representation (into resolution).
Supported projection codes (see gis.h):
buf | buffer containing string resolution | |
[out] | resolution | resolution value |
projection | projection code |
Definition at line 100 of file wind_scan.c.
References G_llres_scan(), and PROJECTION_LL.
int G_scan_timestamp | ( | struct TimeStamp * | ts, |
const char * | buf | ||
) |
Fill a TimeStamp structure from a datetime string.
Populate a TimeStamp structure (defined in gis.h) from a text string. Checks to make sure text string is in valid GRASS datetime format.
ts | TimeStamp structure to be populated |
buf | string containing formatted time info |
Definition at line 217 of file timestamp.c.
void G_set_distance_to_line_tolerance | ( | double | t | ) |
Definition at line 8 of file gis/line_dist.c.
void G_set_error_routine | ( | int(*)(const char *, int) | error_routine | ) |
Establishes error_routine as the routine that will handle the printing of subsequent error messages.
error_routine | routine will be called like this: error_routine(msg, fatal) |
Definition at line 260 of file gis/error.c.
void G_set_geodesic_distance_lat1 | ( | double | lat1 | ) |
Sets geodesic distance lat1.
Set the first latitude.
Note: Must be called first.
lat1 | first latitude |
Definition at line 69 of file geodist.c.
Referenced by G_geodesic_distance().
void G_set_geodesic_distance_lat2 | ( | double | lat2 | ) |
Sets geodesic distance lat2.
Set the second latitude.
Note: Must be called second.
lat2 | second latitidue |
Definition at line 83 of file geodist.c.
Referenced by G_geodesic_distance().
void G_set_gisrc_mode | ( | int | mode | ) |
void G_set_key_value | ( | const char * | key, |
const char * | value, | ||
struct Key_Value * | kv | ||
) |
Set value for given key.
key | key to be set up | |
value | value for given key | |
[in,out] | kv | Key_value structure to be modified |
Definition at line 39 of file key_value1.c.
Referenced by G_get_projinfo(), and GPJ_osr_to_grass().
void G_set_keywords | ( | const char * | keywords | ) |
Set keywords from the string.
keywords | keywords separated by commas |
Definition at line 882 of file parser.c.
References G_number_of_tokens(), G_tokenize(), and st.
void G_set_ls_exclude_filter | ( | int(*)(const char *, void *) | , |
void * | |||
) |
Referenced by G_ls_regex_filter().
void G_set_ls_filter | ( | int(*)(const char *, void *) | , |
void * | |||
) |
int G_set_omp_num_threads | ( | struct Option * | opt | ) |
Set the number of threads for OpenMP The intended usage is at the beginning of a C tool when parameters are processed, namely the G_OPT_M_NPROCS standard option.
opt | A nprocs Option struct to specify the number of threads |
Definition at line 19 of file omp_threads.c.
References _, Option::answer, G_fatal_error(), G_verbose_message(), G_warning(), Option::key, and NULL.
void G_set_percent_routine | ( | int(*)(int) | percent_routine | ) |
void G_set_program_name | ( | const char * | s | ) |
Set program name.
Program name set to name (name will be returned by G_program_name*())
Extension like .exe or .py is stripped from program name.
s | program name |
Definition at line 61 of file progrm_nme.c.