GRASS GIS 8 Programmer's Manual
8.5.0dev(2024)-38f5cf43d1
|
Vector library - header manipulation. More...
#include <stdlib.h>
#include <string.h>
#include <grass/vector.h>
#include <grass/glocale.h>
#include "local_proto.h"
Go to the source code of this file.
Functions | |
int | Vect_print_header (struct Map_info *Map) |
Print vector map header to stdout. More... | |
int | Vect_read_header (struct Map_info *Map) |
Read vector map header from map head file. More... | |
int | Vect_write_header (struct Map_info *Map) |
Write vector map header to map head file. More... | |
int | Vect__write_head (struct Map_info *Map) |
Writes head information to text file (GV_HEAD_ELEMENT) More... | |
int | Vect__read_head (struct Map_info *Map) |
Reads head information from text file (GV_HEAD_ELEMENT) - for internal use only. More... | |
const char * | Vect_get_name (struct Map_info *Map) |
Get name of vector map. More... | |
const char * | Vect_get_mapset (struct Map_info *Map) |
Get name of mapset where vector map lives. More... | |
const char * | Vect_get_full_name (struct Map_info *Map) |
Get fully qualified name of vector map. More... | |
int | Vect_is_3d (struct Map_info *Map) |
Check if vector map is 3D. More... | |
int | Vect_set_organization (struct Map_info *Map, const char *str) |
Set organization string in map header. More... | |
const char * | Vect_get_organization (struct Map_info *Map) |
Get organization string from map header. More... | |
int | Vect_set_date (struct Map_info *Map, const char *str) |
Set date of digitization in map header. More... | |
const char * | Vect_get_date (struct Map_info *Map) |
Get date of digitization from map header. More... | |
int | Vect_set_person (struct Map_info *Map, const char *str) |
Set name of user who digitized the map in map header. More... | |
const char * | Vect_get_person (struct Map_info *Map) |
Get user name string who digitized the map from map header. More... | |
int | Vect_set_map_name (struct Map_info *Map, const char *str) |
Set map name in map header. More... | |
const char * | Vect_get_map_name (struct Map_info *Map) |
Get map name from map header. More... | |
int | Vect_set_map_date (struct Map_info *Map, const char *str) |
Set date when the source map was originally produced in map header. More... | |
const char * | Vect_get_map_date (struct Map_info *Map) |
Get date when the source map was originally produced from map header. More... | |
int | Vect_set_scale (struct Map_info *Map, int scale) |
Set map scale in map header. More... | |
int | Vect_get_scale (struct Map_info *Map) |
Get map scale from map header. More... | |
int | Vect_set_comment (struct Map_info *Map, const char *str) |
Set comment or other info string in map header. More... | |
const char * | Vect_get_comment (struct Map_info *Map) |
Get comment or other info string from map header. More... | |
int | Vect_set_zone (struct Map_info *Map, int zone) |
Set projection zone in map header. More... | |
int | Vect_get_zone (struct Map_info *Map UNUSED) |
Get projection zone from map header. More... | |
int | Vect_set_proj (struct Map_info *Map, int proj) |
Set projection in map header. More... | |
int | Vect_get_proj (struct Map_info *Map) |
Get projection from map header. More... | |
const char * | Vect_get_proj_name (struct Map_info *Map) |
Query cartographic projection name of pointer to Map_info structure. More... | |
int | Vect_set_thresh (struct Map_info *Map, double thresh) |
Set threshold used for digitization in map header. More... | |
double | Vect_get_thresh (struct Map_info *Map) |
Get threshold used for digitization from map header. More... | |
Vector library - header manipulation.
Higher level functions for reading/writing/manipulating vectors.
(C) 2001-2010 by the GRASS Development Team
This program is free software under the GNU General Public License (>=v2). Read the file COPYING that comes with GRASS for details.
Definition in file vector/Vlib/header.c.
int Vect__read_head | ( | struct Map_info * | Map | ) |
Reads head information from text file (GV_HEAD_ELEMENT) - for internal use only.
Map | pointer to Map_info structure |
Definition at line 118 of file vector/Vlib/header.c.
References _, G_debug(), G_fopen_old(), G_getl2(), G_warning(), GPATH_MAX, GV_HEAD_ELEMENT, Map_info::mapset, Map_info::name, NULL, Vect__get_path(), Vect__init_head(), Vect_get_full_name(), Vect_set_comment(), Vect_set_date(), Vect_set_map_date(), Vect_set_map_name(), Vect_set_organization(), Vect_set_person(), Vect_set_proj(), Vect_set_scale(), Vect_set_thresh(), and Vect_set_zone().
Referenced by Vect_read_header().
int Vect__write_head | ( | struct Map_info * | Map | ) |
Writes head information to text file (GV_HEAD_ELEMENT)
Map | pointer to Map_info structure |
Definition at line 79 of file vector/Vlib/header.c.
References _, G_fopen_new(), G_warning(), GPATH_MAX, GV_HEAD_ELEMENT, NULL, Vect__get_path(), Vect_get_comment(), Vect_get_date(), Vect_get_full_name(), Vect_get_map_date(), Vect_get_map_name(), Vect_get_organization(), Vect_get_person(), Vect_get_proj(), Vect_get_scale(), Vect_get_thresh(), and Vect_get_zone().
Referenced by V1_close_nat(), V1_close_ogr(), V1_close_pg(), and Vect_write_header().
const char* Vect_get_comment | ( | struct Map_info * | Map | ) |
Get comment or other info string from map header.
Map | pointer to Map_info structure |
Definition at line 453 of file vector/Vlib/header.c.
References dig_head::comment, and Map_info::head.
Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().
const char* Vect_get_date | ( | struct Map_info * | Map | ) |
Get date of digitization from map header.
Map | pointer to Map_info structure |
Definition at line 314 of file vector/Vlib/header.c.
References dig_head::date, and Map_info::head.
Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().
const char* Vect_get_full_name | ( | struct Map_info * | Map | ) |
Get fully qualified name of vector map.
Allocated string should be freed by G_free().
Map | pointer to Map_info structure |
Definition at line 221 of file vector/Vlib/header.c.
References Format_info_ogr::dsn, Map_info::fInfo, Map_info::format, G_malloc, GV_FORMAT_OGR_DIRECT, Format_info_ogr::layer_name, Map_info::mapset, Map_info::name, and Format_info::ogr.
Referenced by V1_open_old_nat(), V2_open_old_ogr(), V2_open_old_pg(), Vect__read_head(), Vect__write_head(), Vect_build_partial(), Vect_build_sidx_from_topo(), Vect_cidx_open(), Vect_get_finfo_dsn_name(), Vect_get_finfo_layer_name(), Vect_open_fidx(), and Vect_sfa_get_num_features().
const char* Vect_get_map_date | ( | struct Map_info * | Map | ) |
Get date when the source map was originally produced from map header.
Map | pointer to Map_info structure |
Definition at line 398 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::source_date.
Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().
const char* Vect_get_map_name | ( | struct Map_info * | Map | ) |
Get map name from map header.
Map | pointer to Map_info structure |
Definition at line 370 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::map_name.
Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().
const char* Vect_get_mapset | ( | struct Map_info * | Map | ) |
Get name of mapset where vector map lives.
Map | pointer to Map_info structure |
Definition at line 204 of file vector/Vlib/header.c.
References Map_info::mapset.
const char* Vect_get_name | ( | struct Map_info * | Map | ) |
Get name of vector map.
Map | pointer to Map_info structure |
Definition at line 192 of file vector/Vlib/header.c.
References Map_info::name.
Referenced by Vect_close(), Vect_save_sidx(), and Vect_write_dblinks().
const char* Vect_get_organization | ( | struct Map_info * | Map | ) |
Get organization string from map header.
Map | pointer to Map_info structure |
Definition at line 283 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::organization.
Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().
const char* Vect_get_person | ( | struct Map_info * | Map | ) |
Get user name string who digitized the map from map header.
Map | pointer to Map_info structure |
Definition at line 342 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::user_name.
Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().
int Vect_get_proj | ( | struct Map_info * | Map | ) |
Get projection from map header.
Map | pointer to Map_info structure |
Definition at line 519 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::proj.
Referenced by Vect__write_head(), and Vect_get_proj_name().
const char* Vect_get_proj_name | ( | struct Map_info * | Map | ) |
Query cartographic projection name of pointer to Map_info structure.
Returns a pointer to a string which is a printable name for projection code proj (as returned by Vect_get_proj()).
Map | pointer to Map_info structure |
Definition at line 536 of file vector/Vlib/header.c.
References _, G_database_projection_name(), G_debug(), G_projection_name(), G_store(), name, PROJECTION_LL, PROJECTION_OTHER, PROJECTION_UTM, PROJECTION_XY, strcpy, and Vect_get_proj().
int Vect_get_scale | ( | struct Map_info * | Map | ) |
Get map scale from map header.
Map | pointer to Map_info structure |
Definition at line 425 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::orig_scale.
Referenced by Vect__write_head(), Vect_copy_head_data(), Vect_print_header(), and Vect_write_ascii_head().
double Vect_get_thresh | ( | struct Map_info * | Map | ) |
Get threshold used for digitization from map header.
Map | pointer to Map_info structure |
Definition at line 585 of file vector/Vlib/header.c.
References dig_head::digit_thresh, and Map_info::head.
Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().
int Vect_get_zone | ( | struct Map_info *Map | UNUSED | ) |
Get projection zone from map header.
Map | pointer to Map_info structure (unused, returns the zone for the active region) |
Definition at line 481 of file vector/Vlib/header.c.
References G_zone().
Referenced by Vect__write_head().
int Vect_is_3d | ( | struct Map_info * | Map | ) |
Check if vector map is 3D.
Check vector map header.
Map | pointer to Map_info structure |
Definition at line 255 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::with_z.
Referenced by Vect_close(), Vect_get_area_box(), and Vect_get_isle_box().
int Vect_print_header | ( | struct Map_info * | Map | ) |
Print vector map header to stdout.
Map | pointer to Map_info structure |
Definition at line 33 of file vector/Vlib/header.c.
References Vect_get_map_date(), Vect_get_map_name(), Vect_get_organization(), and Vect_get_scale().
int Vect_read_header | ( | struct Map_info * | Map | ) |
Read vector map header from map head file.
Map | pointrt to Map_info structure |
Definition at line 51 of file vector/Vlib/header.c.
References Vect__read_head().
int Vect_set_comment | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set comment or other info string in map header.
Map | pointer to Map_info structure |
str | comment or other info string |
Definition at line 438 of file vector/Vlib/header.c.
References dig_head::comment, G_free(), G_store(), and Map_info::head.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_date | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set date of digitization in map header.
Map | pointer to Map_info structure |
str | date given as string |
Definition at line 299 of file vector/Vlib/header.c.
References dig_head::date, G_free(), G_store(), and Map_info::head.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_map_date | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set date when the source map was originally produced in map header.
Map | pointer to Map_info structure |
str | date given as a string |
Definition at line 383 of file vector/Vlib/header.c.
References G_free(), G_store(), Map_info::head, and dig_head::source_date.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_map_name | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set map name in map header.
Map | pointer to Map_info structure |
str | map name to be set |
Definition at line 355 of file vector/Vlib/header.c.
References G_free(), G_store(), Map_info::head, and dig_head::map_name.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_organization | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set organization string in map header.
Map | pointer to Map_info structure |
str | organization name |
Definition at line 268 of file vector/Vlib/header.c.
References G_free(), G_store(), Map_info::head, and dig_head::organization.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_person | ( | struct Map_info * | Map, |
const char * | str | ||
) |
Set name of user who digitized the map in map header.
Map | pointer to Map_info structure |
str | user name |
Definition at line 327 of file vector/Vlib/header.c.
References G_free(), G_store(), Map_info::head, and dig_head::user_name.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_proj | ( | struct Map_info * | Map, |
int | proj | ||
) |
Set projection in map header.
Supported projections:
Map | pointer to Map_info structure |
proj | projection code |
Definition at line 503 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::proj.
Referenced by Vect__init_head(), and Vect__read_head().
int Vect_set_scale | ( | struct Map_info * | Map, |
int | scale | ||
) |
Set map scale in map header.
Map | pointer to Map_info structure |
scale | map scale |
Definition at line 411 of file vector/Vlib/header.c.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_thresh | ( | struct Map_info * | Map, |
double | thresh | ||
) |
Set threshold used for digitization in map header.
Map | pointer to Map_info structure |
thresh | threshold used for digitization |
Definition at line 571 of file vector/Vlib/header.c.
References dig_head::digit_thresh, G_debug(), and Map_info::head.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_set_zone | ( | struct Map_info * | Map, |
int | zone | ||
) |
Set projection zone in map header.
Map | pointer to Map_info structure |
zone | projection zone |
Definition at line 466 of file vector/Vlib/header.c.
References Map_info::head, and dig_head::plani_zone.
Referenced by Vect__init_head(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().
int Vect_write_header | ( | struct Map_info * | Map | ) |
Write vector map header to map head file.
Map | pointer to Map_info structure |
Definition at line 64 of file vector/Vlib/header.c.
References Vect__write_head().