GRASS Programmer's Manual  6.5.svn(2014)-r66266
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
build.c File Reference

Vector library - Building topology. More...

#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <grass/glocale.h>
#include <grass/gis.h>
#include <grass/Vect.h>
Include dependency graph for build.c:

Go to the source code of this file.

Functions

int Vect_build (struct Map_info *Map)
 Build topology for vector map. More...
 
int Vect_get_built (struct Map_info *Map)
 Return current highest built level (part) More...
 
int Vect_build_partial (struct Map_info *Map, int build)
 Build partial topology for vector map. More...
 
int Vect_save_topo (struct Map_info *Map)
 Save topology file for vector map. More...
 
int Vect_topo_dump (struct Map_info *Map, FILE *out)
 Dump topology to file. More...
 
int Vect_save_spatial_index (struct Map_info *Map)
 Save spatial index file. More...
 
int Vect_spatial_index_dump (struct Map_info *Map, FILE *out)
 Dump spatial index to file. More...
 

Detailed Description

Vector library - Building topology.

Higher level functions for reading/writing/manipulating vectors.

(C) 2001-2008 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.
Date
2001-2008

Definition in file build.c.

Function Documentation

int Vect_build ( struct Map_info *  Map)

Build topology for vector map.

Parameters
Mapvector map
Returns
1 on success
0 on error

Definition at line 53 of file build.c.

References Vect_build_partial().

Referenced by wxdisplay.DisplayDriver::CloseMap(), G_sites_close(), and wxdisplay.DisplayDriver::OpenMap().

int Vect_build_partial ( struct Map_info *  Map,
int  build 
)

Build partial topology for vector map.

Should only be used in special cases of vector processing.

This functions optionally builds only some parts of topology. Highest level is specified by build parameter which may be:

  • GV_BUILD_NONE - nothing is build;
  • GV_BUILD_BASE - basic topology, nodes, spatial index;
  • GV_BUILD_AREAS - build areas and islands, but islands are not attached to areas;
  • GV_BUILD_ATTACH_ISLES - attach islands to areas;
  • GV_BUILD_CENTROIDS - assign centroids to areas;
  • GV_BUILD_ALL - top level, the same as GV_BUILD_CENTROIDS.

If functions is called with build lower than current value of the Map, the level is downgraded to requested value.

All calls to Vect_write_line(), Vect_rewrite_line(), Vect_delete_line() respect the last value of build used in this function.

Values lower than GV_BUILD_ALL are supported only by GV_FORMAT_NATIVE, other formats ignore build and build always GV_BUILD_ALL

Note that the functions has effect only if requested level is higher than current level, to rebuild part of topology, call first downgrade and then upgrade, for example:

Vect_build() Vect_build_partial(,GV_BUILD_BASE,) Vect_build_partial(,GV_BUILD_AREAS,)

Parameters
Mapvector map
buildhighest level of build
Returns
1 on success, 0 on error

Definition at line 107 of file build.c.

References dig_cidx_free(), dig_cidx_init(), dig_cidx_sort(), G_debug(), G_message(), G_verbose_message(), Vect_area_alive(), Vect_get_area_centroid(), Vect_get_name(), Vect_get_num_areas(), and Vect_get_num_lines().

Referenced by wxdisplay.DisplayDriver::CloseMap(), and Vect_build().

int Vect_get_built ( struct Map_info *  Map)

Return current highest built level (part)

Parameters
Mapvector map
Returns
current highest built level

Definition at line 66 of file build.c.

int Vect_save_spatial_index ( struct Map_info *  Map)

Save spatial index file.

Parameters
Mapvector map
Returns
1 on success
0 on error

Definition at line 390 of file build.c.

References buf, dig__byte_order_out(), dig_file_init(), dig_init_portable(), dig_write_spidx(), fclose(), G__file_name(), G_debug(), G_warning(), NULL, and sprintf().

int Vect_save_topo ( struct Map_info *  Map)

Save topology file for vector map.

Parameters
Mapvector map
Returns
1 on success, 0 on error

Definition at line 239 of file build.c.

References buf, dig__byte_order_out(), dig_file_init(), dig_init_portable(), dig_write_plus_file(), fclose(), G__file_name(), G_debug(), G_warning(), NULL, and sprintf().

Referenced by Vect_close().

int Vect_spatial_index_dump ( struct Map_info *  Map,
FILE *  out 
)

Dump spatial index to file.

Parameters
Mapvector map
outfile for output (stdout/stderr for example)
Returns
1 on success
0 on error

Definition at line 433 of file build.c.

References dig_dump_spidx(), and Vect_build_sidx_from_topo().

int Vect_topo_dump ( struct Map_info *  Map,
FILE *  out 
)

Dump topology to file.

Parameters
Mapvector map
outfile for output (stdout/stderr for example)
Returns
1 on success
0 on error

Definition at line 282 of file build.c.

References tools::box, NULL, and Vect_box_copy().