write_nat.c File Reference

Vector library - write vector feature (native format). More...

#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <grass/gis.h>
#include <grass/Vect.h>
#include <grass/glocale.h>

Include dependency graph for write_nat.c:

Go to the source code of this file.

Functions

long V1__rewrite_line_nat (struct Map_info *Map, long offset, int type, struct line_pnts *points, struct line_cats *cats)
 Rewrites feature at the given offset.
long V1_write_line_nat (struct Map_info *Map, int type, struct line_pnts *points, struct line_cats *cats)
 Writes feature to 'coor' file.
long V2_write_line_nat (struct Map_info *Map, int type, struct line_pnts *points, struct line_cats *cats)
 Writes feature to 'coor' file (topology level).
long V1_rewrite_line_nat (struct Map_info *Map, long offset, int type, struct line_pnts *points, struct line_cats *cats)
 Rewrites feature at the given offset.
int V2_rewrite_line_nat (struct Map_info *Map, int line, int type, struct line_pnts *points, struct line_cats *cats)
 Rewrites feature (topology level).
int V1_delete_line_nat (struct Map_info *Map, long offset)
 Deletes feature at the given offset.
int V2_delete_line_nat (struct Map_info *Map, int line)
 Deletes feature (topology level).
int V1_restore_line_nat (struct Map_info *Map, long offset)
 Restores feature at the given offset.
int V2_restore_line_nat (struct Map_info *Map, int line, long offset)
 Restores feature (topology level).


Detailed Description

Vector library - write vector feature (native format).

Higher level functions for reading/writing/manipulating vectors.

Operations:

(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.

V*_restore_line() by Martin Landa <landa.martin gmail.com> (2008)

Date:
2001

Definition in file write_nat.c.


Function Documentation

long V1__rewrite_line_nat ( struct Map_info *  Map,
long  offset,
int  type,
struct line_pnts *  points,
struct line_cats *  cats 
)

Rewrites feature at the given offset.

Parameters:
Map pointer to vector map
offset feature offset
type feature type
points feature geometry
cats feature categories
Returns:
feature offset

-1 on error

Definition at line 485 of file write_nat.c.

References dig__fwrite_port_C(), dig__fwrite_port_D(), dig__fwrite_port_I(), dig__fwrite_port_S(), dig_fflush(), dig_fseek(), dig_set_cur_port(), and dig_type_to_store().

Referenced by V1_rewrite_line_nat(), and V1_write_line_nat().

int V1_delete_line_nat ( struct Map_info *  Map,
long  offset 
)

Deletes feature at the given offset.

Parameters:
Map pointer to vector map
offset feature offset
Returns:
0 on success

-1 on error

Definition at line 582 of file write_nat.c.

References dig__fread_port_C(), dig__fwrite_port_C(), dig_fflush(), dig_fseek(), and dig_set_cur_port().

Referenced by V1_rewrite_line_nat(), and V2_delete_line_nat().

int V1_restore_line_nat ( struct Map_info *  Map,
long  offset 
)

Restores feature at the given offset.

Parameters:
Map pointer to vector map
offset feature offset
Returns:
0 on success

-1 on error

Definition at line 821 of file write_nat.c.

References dig__fread_port_C(), dig__fwrite_port_C(), dig_fflush(), dig_fseek(), and dig_set_cur_port().

Referenced by V2_restore_line_nat().

long V1_rewrite_line_nat ( struct Map_info *  Map,
long  offset,
int  type,
struct line_pnts *  points,
struct line_cats *  cats 
)

Rewrites feature at the given offset.

If the number of points or cats differs from the original one or the type is changed: GV_POINTS -> GV_LINES or GV_LINES -> GV_POINTS, the old one is deleted and the new is appended to the end of the file.

Old feature is deleted (marked as dead), new feature written.

Parameters:
Map pointer to vector map
offset feature offset
type feature type
points feature geometry
cats feature categories
Returns:
feature offset (rewriten feature)

-1 on error

Definition at line 397 of file write_nat.c.

References dig_fseek(), dig_ftell(), V1__rewrite_line_nat(), V1_delete_line_nat(), V1_read_line_nat(), Vect_new_cats_struct(), and Vect_new_line_struct().

long V1_write_line_nat ( struct Map_info *  Map,
int  type,
struct line_pnts *  points,
struct line_cats *  cats 
)

Writes feature to 'coor' file.

Parameters:
Map pointer to vector map
type feature type
points feature geometry
cats feature categories
Returns:
feature offset into file

-1 on error

Definition at line 314 of file write_nat.c.

References dig_fseek(), dig_ftell(), and V1__rewrite_line_nat().

Referenced by V2_write_line_nat().

int V2_delete_line_nat ( struct Map_info *  Map,
int  line 
)

Deletes feature (topology level).

Parameters:
pointer to vector map
line feature id
Returns:
0 on success

-1 on error

Definition at line 622 of file write_nat.c.

References dig_angle_next_line(), dig_cidx_del_cat(), dig_del_area(), dig_del_isle(), dig_del_line(), V1_delete_line_nat(), V2_read_line_nat(), Vect_attach_centroids(), Vect_attach_isles(), Vect_box_copy(), Vect_box_extend(), Vect_build_line_area(), Vect_get_area_box(), Vect_get_isle_box(), and Vect_new_cats_struct().

Referenced by V2_rewrite_line_nat().

int V2_restore_line_nat ( struct Map_info *  Map,
int  line,
long  offset 
)

Restores feature (topology level).

Parameters:
Map pointer to vector map
line feature id
offset feature offset
Returns:
0 on success

-1 on error

Definition at line 864 of file write_nat.c.

References dig_cidx_add_cat(), dig_line_box(), dig_line_set_box(), dig_restore_line(), V1_read_line_nat(), V1_restore_line_nat(), Vect_box_extend(), Vect_new_cats_struct(), and Vect_new_line_struct().

int V2_rewrite_line_nat ( struct Map_info *  Map,
int  line,
int  type,
struct line_pnts *  points,
struct line_cats *  cats 
)

Rewrites feature (topology level).

Old feature is deleted (marked as dead), new feature written.

Parameters:
Map pointer to vector map
line feature id
type feature type
points feature geometry
cats feature category
Returns:
new feature id

-1 on error

Definition at line 457 of file write_nat.c.

References V2_delete_line_nat(), and V2_write_line_nat().

long V2_write_line_nat ( struct Map_info *  Map,
int  type,
struct line_pnts *  points,
struct line_cats *  cats 
)

Writes feature to 'coor' file (topology level).

Parameters:
Map pointer to vector map
type feature type
points feature geometry
cats feature categories
Returns:
new feature id

-1 on error

Definition at line 340 of file write_nat.c.

References dig_add_line(), dig_line_box(), dig_line_set_box(), V1_write_line_nat(), Vect_box_copy(), and Vect_box_extend().

Referenced by V2_rewrite_line_nat().


Generated on Thu Jul 16 13:21:33 2009 for GRASS Programmer's Manual by  doxygen 1.5.6