GRASS GIS 7 Programmer's Manual  7.5.svn(2018)-r72255
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
vector/Vlib/header.c File Reference

Vector library - header manipulation. More...

#include <stdlib.h>
#include <string.h>
#include <grass/vector.h>
#include <grass/glocale.h>
#include "local_proto.h"
Include dependency graph for vector/Vlib/header.c:

Go to the source code of this file.

Functions

int Vect_print_header (const 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 (const struct Map_info *Map)
 Write vector map header to map head file. More...
 
int Vect__write_head (const 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 (const struct Map_info *Map)
 Get name of vector map. More...
 
const char * Vect_get_mapset (const struct Map_info *Map)
 Get name of mapset where vector map lives. More...
 
const char * Vect_get_full_name (const struct Map_info *Map)
 Get fully qualified name of vector map. More...
 
int Vect_is_3d (const 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 (const 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 (const 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 (const 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 (const 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 (const 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 (const 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 (const 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 (const struct Map_info *Map)
 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 (const struct Map_info *Map)
 Get projection from map header. More...
 
const char * Vect_get_proj_name (const 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 (const struct Map_info *Map)
 Get threshold used for digitization from map header. More...
 

Detailed Description

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.

Author
Original author CERL, probably Dave Gerdes or Mike Higgins.
Update to GRASS 5.7 Radim Blazek and David D. Gray.
Update to GRASS 7 (OGR support) by Martin Landa <landa.martin gmail.com>

Definition in file vector/Vlib/header.c.

Function Documentation

int Vect__read_head ( struct Map_info Map)
int Vect__write_head ( const struct Map_info Map)
const char* Vect_get_comment ( const struct Map_info Map)

Get comment or other info string from map header.

Parameters
Mappointer to Map_info structure
Returns
comment or other info string

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 ( const struct Map_info Map)

Get date of digitization from map header.

Parameters
Mappointer to Map_info structure
Returns
date of digitization string

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 ( const struct Map_info Map)
const char* Vect_get_map_date ( const struct Map_info Map)

Get date when the source map was originally produced from map header.

Parameters
Mappointer to Map_info structure
Returns
string containing a date

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 ( const struct Map_info Map)

Get map name from map header.

Parameters
Mappointer to Map_info structure
Returns
string containing map name

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 ( const struct Map_info Map)

Get name of mapset where vector map lives.

Parameters
Mappointer to Map_info structure
Returns
string containing mapset name

Definition at line 202 of file vector/Vlib/header.c.

References Map_info::mapset.

const char* Vect_get_name ( const struct Map_info Map)

Get name of vector map.

Parameters
Mappointer to Map_info structure
Returns
string containing name

Definition at line 190 of file vector/Vlib/header.c.

References Map_info::name.

Referenced by Vect__open_old(), Vect_cidx_save(), Vect_close(), Vect_copy_tables(), Vect_delete_line(), Vect_read_ascii(), Vect_restore_line(), Vect_rewrite_line(), Vect_save_sidx(), Vect_write_dblinks(), and Vect_write_line().

const char* Vect_get_organization ( const struct Map_info Map)

Get organization string from map header.

Parameters
Mappointer to Map_info structure
Returns
string containing organization name

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 ( const struct Map_info Map)

Get user name string who digitized the map from map header.

Parameters
Mappointer to Map_info structure
Returns
string containing user name

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 ( const struct Map_info Map)

Get projection from map header.

Parameters
Mappointer to Map_info structure
Returns
PROJECTION_XY 0 - x,y (Raw imagery),
PROJECTION_UTM 1 - UTM Universal Transverse Mercator,
PROJECTION_LL 3 - Latitude-Longitude

Definition at line 514 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 ( const 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()).

Parameters
Mappointer to Map_info structure
Returns
allocated string containing projection name
NULL if proj is not a valid projection

Definition at line 531 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, and Vect_get_proj().

int Vect_get_scale ( const struct Map_info Map)

Get map scale from map header.

Parameters
Mappointer to Map_info structure
Returns
map scale

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 ( const struct Map_info Map)

Get threshold used for digitization from map header.

Parameters
Mappointer to Map_info structure
Returns
threshold used for digitization

Definition at line 578 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 ( const struct Map_info Map)

Get projection zone from map header.

Parameters
Mappointer to Map_info structure
Returns
projection zone

Definition at line 480 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::plani_zone.

Referenced by Vect__open_old(), Vect__write_head(), Vect_copy_head_data(), and Vect_write_ascii_head().

int Vect_is_3d ( const struct Map_info Map)

Check if vector map is 3D.

Check vector map header.

Parameters
Mappointer to Map_info structure
Returns
TRUE vector map is 3D
FALSE vector map is not 3D

Definition at line 255 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::with_z.

Referenced by Gp_load_sites(), Gv_load_vect(), IL_vector_input_data_2d(), Vect_close(), Vect_get_area_box(), Vect_get_isle_box(), Vect_get_line_box(), Vect_read_ascii(), Vect_read_line_to_wkb(), Vect_remove_duplicates(), Vect_write_ascii(), Vedit_move_lines(), and Vedit_move_vertex().

int Vect_print_header ( const struct Map_info Map)

Print vector map header to stdout.

Parameters
Mappointer to Map_info structure
Returns
0 on success

Definition at line 32 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.

Parameters
Mappointrt to Map_info structure
Returns
0

Definition at line 50 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.

Parameters
Mappointer to Map_info structure
strcomment or other info string
Returns
0

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.

Todo:
This should be coupled to DateTime functions to support time series
Parameters
Mappointer to Map_info structure
strdate given as string
Returns
0

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.

Parameters
Mappointer to Map_info structure
strdate given as a string
Returns
0

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.

Parameters
Mappointer to Map_info structure
strmap name to be set
Returns
0

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.

Parameters
Mappointer to Map_info structure
strorganization name
Returns
0

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.

Parameters
Mappointer to Map_info structure
struser name
Returns
0

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:

  • PROJECTION_XY 0 - x,y (Raw imagery),
  • PROJECTION_UTM 1 - UTM Universal Transverse Mercator,
  • PROJECTION_LL 3 - Latitude-Longitude
Parameters
Mappointer to Map_info structure
projprojection code
Returns
0

Definition at line 498 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::proj.

Referenced by Vect__init_head(), Vect__open_old(), and Vect__read_head().

int Vect_set_scale ( struct Map_info Map,
int  scale 
)

Set map scale in map header.

Parameters
Mappointer to Map_info structure
scalemap scale
Returns
0

Definition at line 411 of file vector/Vlib/header.c.

References Map_info::head, and dig_head::orig_scale.

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.

Parameters
Mappointer to Map_info structure
threshthreshold used for digitization
Returns
0

Definition at line 564 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.

Parameters
Mappointer to Map_info structure
zoneprojection zone
Returns
0

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__open_old(), Vect__read_head(), Vect_copy_head_data(), and Vect_read_ascii_head().

int Vect_write_header ( const struct Map_info Map)

Write vector map header to map head file.

Parameters
Mappointer to Map_info structure
Returns
0

Definition at line 63 of file vector/Vlib/header.c.

References Vect__write_head().