DATASERV (kgeom) functions


LIBRARY ROUTINE

kgeom_read_primitive - read a geometry primitive

LIBRARY CALL

kgeom_primitive *
kgeom_read_primitive(kgeom_object *object)

INPUT

OUTPUT

none

RETURN VALUE

new primitive with primitive data from file

DESCRIPTION

This routine will read a given primitive and all associated data from the file indicated by the provided object. A new primitive will be constructed for this.

In general, the kgeom_write_object() function should be used instead of this function. This function has been made public to provide complete flexibility for reading a geometry object. It should only be used when you wish to read a geometry object primitive-by-primitive.

If you wish to use this function to read in a primitive at a time, you should follow this sequence to reading the object:

object = kgeom_read_header("filename");

If this has returned a valid object, then the object itself can be read. The next call will read in all the specific information

kgeom_start_reading_object(object);

At this point, you can start reading in individual primitives using the kgeom_read_primitive() function. The file to be read from is determined from the open fid inside the object. This function will return NULL if there are no more primitives to read.

After all primitives have been read, finish with the following calls :

kgeom_finish_reading_object(object);

kgeom_done_reading(object);

The object presentation is used to determine how much data is present in the primitive. The call to kgeom_start_reading_object() should have initialized these fields appropriately. The primitive will not be added to the object, so you are free to destroy it or add it to a different object if you choose.

ADDITIONAL INFORMATION

none

EXAMPLES

none

SIDE EFFECTS

none

RESTRICTIONS

none

MODIFICATION

none

FILES

$DATASERV/objects/library/kgeom/src/prim_read.c

SEE ALSO

kgeom(3)

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.