GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
vector/Vlib/header.c File Reference
#include <stdlib.h>
#include <string.h>
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/glocale.h>
Include dependency graph for vector/Vlib/header.c:

Go to the source code of this file.

Functions

int Vect_print_header (struct Map_info *Map)
 Print vector map header. 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. More...
 
int Vect__read_head (struct Map_info *Map)
 Reads head information from text file (GRASS_VECT_HEAD_ELEMENT). More...
 
const char * Vect_get_name (struct Map_info *Map)
 Get map name. More...
 
const char * Vect_get_mapset (struct Map_info *Map)
 Get mapset name. More...
 
const char * Vect_get_full_name (struct Map_info *Map)
 Get full map name. More...
 
int Vect_is_3d (struct Map_info *Map)
 Check if vector map is 3D (with z) 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 string in map header. More...
 
const char * Vect_get_date (struct Map_info *Map)
 Get date of digitization string from map header. More...
 
int Vect_set_person (struct Map_info *Map, const char *str)
 Set user name string 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 string in map header. More...
 
const char * Vect_get_map_name (struct Map_info *Map)
 Get map name string in map header. More...
 
int Vect_set_map_date (struct Map_info *Map, const char *str)
 Set date string when the source map was originally produced in map header. More...
 
const char * Vect_get_map_date (struct Map_info *Map)
 Get date string when the source map was originally produced in 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)
 Get projection zone from 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 vector map. 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...
 

Function Documentation

int Vect__read_head ( struct Map_info *  Map)

Reads head information from text file (GRASS_VECT_HEAD_ELEMENT).

Parameters
Mapvector map
Returns
GRASS_OK - success
GRASS_ERR - error

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

References buff, fclose(), G_debug(), G_fopen_old(), G_getl2(), G_index(), G_warning(), NULL, sprintf(), 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_scale(), Vect_set_thresh(), and Vect_set_zone().

Referenced by Vect__open_old(), and Vect_read_header().

int Vect__write_head ( struct Map_info *  Map)

Writes head information to text file.

Parameters
Mapvector map
Returns
GRASS_OK - success
GRASS_ERR - error

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

References buf, fclose(), G_fopen_new(), G_warning(), NULL, sprintf(), 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_scale(), Vect_get_thresh(), and Vect_get_zone().

Referenced by V1_close_nat(), V1_close_ogr(), V1_open_new_nat(), and Vect_write_header().

const char* Vect_get_comment ( struct Map_info *  Map)

Get comment or other info string from map header.

Parameters
Mapvector map
Returns
comment or other info string

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

Referenced by G_site_get_head(), Vect__write_head(), and Vect_copy_head_data().

const char* Vect_get_date ( struct Map_info *  Map)

Get date of digitization string from map header.

SUGGESTION: this should be coupled to DateTime functions to support time series

Parameters
Mapvector map
Returns
date of digitization string

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

Referenced by Vect__write_head(), and Vect_copy_head_data().

const char* Vect_get_full_name ( struct Map_info *  Map)
const char* Vect_get_map_date ( struct Map_info *  Map)

Get date string when the source map was originally produced in map header.

Parameters
Mapvector map
Returns
date when the source map was originally produced string

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

Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_print_header().

const char* Vect_get_map_name ( struct Map_info *  Map)

Get map name string in map header.

Parameters
Mapvector map
Returns
map name string

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

Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_print_header().

const char* Vect_get_mapset ( struct Map_info *  Map)

Get mapset name.

Parameters
Mapvector map
Returns
poiter to mapset name

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

Referenced by wxdigit.IVDigit::OpenBackgroundMap().

const char* Vect_get_name ( struct Map_info *  Map)

Get map name.

Parameters
Mapvector map
Returns
poiter to map name

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

Referenced by G_site_get_head(), wxdigit.IVDigit::OpenBackgroundMap(), and Vect_build_partial().

const char* Vect_get_organization ( struct Map_info *  Map)

Get organization string from map header.

Parameters
Mapvector map
Returns
organization string

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

Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_print_header().

const char* Vect_get_person ( struct Map_info *  Map)

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

Parameters
Mapvector map
Returns
user name string

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

Referenced by Vect__write_head(), and Vect_copy_head_data().

int Vect_get_proj ( struct Map_info *  Map)

Get projection from map header.

Parameters
Mapvector map
Returns
PROJECTION_XY 0 - x,y (Raw imagery),
PROJECTION_UTM 1 - UTM Universal Transverse Mercator,
PROJECTION_SP 2 - State Plane (in feet),
PROJECTION_LL 3 - Latitude-Longitude

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

Referenced by Vect_get_proj_name().

const char* Vect_get_proj_name ( struct Map_info *  Map)

Query cartographic projection name of vector map.

Returns a pointer to a string which is a printable name for projection code proj (as returned by Vect_get_proj()). Returns NULL if proj is not a valid projection.

Parameters
Mapvector map
Returns
pointer to projection name

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

References G__projection_name(), G_store(), n, render::name, and Vect_get_proj().

int Vect_get_scale ( struct Map_info *  Map)

Get map scale from map header.

Parameters
Mapvector map
Returns
map scale

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

Referenced by Vect__write_head(), Vect_copy_head_data(), and Vect_print_header().

double Vect_get_thresh ( struct Map_info *  Map)

Get threshold used for digitization from map header.

Parameters
Mapvector map
Returns
threshold used for digitization

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

References G_debug().

Referenced by Vect__write_head(), and Vect_copy_head_data().

int Vect_get_zone ( struct Map_info *  Map)

Get projection zone from map header.

Parameters
Mapvector map
Returns
projection zone

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

Referenced by Vect__write_head(), and Vect_copy_head_data().

int Vect_is_3d ( struct Map_info *  Map)
int Vect_print_header ( struct Map_info *  Map)

Print vector map header.

Parameters
Mapvector map
Returns
0 on success

Definition at line 37 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
Mapvector map
Returns
0 on success

Definition at line 56 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
Mapvector map
strcomment or other info string
Returns
0 on success

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

References G_free(), and G_store().

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

int Vect_set_date ( struct Map_info *  Map,
const char *  str 
)

Set date of digitization string in map header.

SUGGESTION: this should be coupled to DateTime functions to support time series

Parameters
Mapvector map
strdata string
Returns
0 on success

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

References G_free(), and G_store().

Referenced by G_site_put_head(), Vect__init_head(), Vect__read_head(), and Vect_copy_head_data().

int Vect_set_map_date ( struct Map_info *  Map,
const char *  str 
)

Set date string when the source map was originally produced in map header.

Parameters
Mapvector map
strdate when the source map was originally produced string
Returns
0 on success

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

References G_free(), and G_store().

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

int Vect_set_map_name ( struct Map_info *  Map,
const char *  str 
)

Set map name string in map header.

Parameters
Mapvector map
strmap name string
Returns
0 on success

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

References G_free(), and G_store().

Referenced by G_site_put_head(), Vect__init_head(), Vect__read_head(), and Vect_copy_head_data().

int Vect_set_organization ( struct Map_info *  Map,
const char *  str 
)

Set organization string in map header.

Parameters
Mapvector map
strorganization name
Returns
0

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

References G_free(), and G_store().

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

int Vect_set_person ( struct Map_info *  Map,
const char *  str 
)

Set user name string who digitized the map in map header.

Parameters
Mapvector map
struser name string
Returns
0 on success

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

References G_free(), and G_store().

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

int Vect_set_scale ( struct Map_info *  Map,
int  scale 
)

Set map scale in map header.

Parameters
Mapvector map
mapscale
Returns
0 on success

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

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

int Vect_set_thresh ( struct Map_info *  Map,
double  thresh 
)

Set threshold used for digitization in map header.

Parameters
Mapvector map
threshthreshold used for digitization
Returns
0 on success

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

References G_debug().

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

int Vect_set_zone ( struct Map_info *  Map,
int  zone 
)

Set projection zone in map header.

Parameters
Mapvector map
zoneprojection zone
Returns
0 on success

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

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

int Vect_write_header ( struct Map_info *  Map)

Write vector map header to map head file.

Parameters
Mapvector map
Returns
0 on success

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

References Vect__write_head().