Navigation: Up, Table of Contents, Bibliography, Index, Title Page

Definition

An object of the class CGAL_Geomview_stream is a stream in which geometric objects can be inserted and where geometric objects can be extracted from. The constructor starts geomview either on the local either on a remote machine.

#include <CGAL/IO/Geomview_stream.h>

Creation

CGAL_Geomview_stream G ( CGAL_Bbox_3 bbox = CGAL_Bbox_3(0,0,0, 1,1,1),
const char *machine = NULL,
const char *login = NULL);
Introduces a geomview stream G with a camera that sees the bounding box. If machine and login are non-null, geomview is started on the remote machine.

Operations

Output Operators for CGAL Kernel Classes

At the moment not all classes of the CGAL kernel have output operators. 2D objects are embedded in the xy-plane.

template <class R>
CGAL_Geomview_stream&
CGAL_Geomview_stream& G << CGAL_Point_2<R> p
Inserts the point p into the stream G.
template <class R>
CGAL_Geomview_stream&
CGAL_Geomview_stream& G << CGAL_Point_3<R> p
Inserts the point p into the stream G.
template <class R>
CGAL_Geomview_stream&
CGAL_Geomview_stream& G << CGAL_Segment_2<R> s
Inserts the segment s into the stream G.
template <class R>
CGAL_Geomview_stream&
CGAL_Geomview_stream& G << CGAL_Segment_3<R> s
Inserts the segment s into the stream G.
template <class R>
CGAL_Geomview_stream&
CGAL_Geomview_stream& G << CGAL_Triangle_2<R> t
Inserts the triangle t into the stream G.
template <class R>
CGAL_Geomview_stream&
CGAL_Geomview_stream& G << CGAL_Triangle_3<R> t
Inserts the triangle t into the stream G.
template <class R>
CGAL_Geomview_stream&
CGAL_Geomview_stream& G << CGAL_Tetrahedron_3<R> t
Inserts the tetrahedron t into the stream G.
CGAL_Geomview_stream&
G << CGAL_Bbox_2 b
Inserts the bounding box b into the stream G.
CGAL_Geomview_stream&
G << CGAL_Bbox_3 b
Inserts the bounding box b into the stream G.

Input Operators for CGAL Kernel Classes

At the moment input is only provided for points. The user has to select a point on the pick plane with the right mouse button. The pick plane can be moved anywhere with the left mouse button, before a point is entered.

template <class R>
CGAL_Geomview_stream&
CGAL_Geomview_stream& G >> CGAL_Point_3<R>& p
Extracts the point p from the stream G. The point is echoed.

IO Operators for CGAL Basic Library Classes

At the moment input is only provided for points. The user has to select a point on the pickplane with the right mouse button. The pickplane can be moved anywhere with the left mouse button, before a point is entered.

template <class R>
CGAL_Geomview_stream&
CGAL_Geomview_stream& G >> CGAL_Point_3<R>& p
Extracts the point p from the stream G. The point is echoed.

Output Operators for CGAL Basic Library Classes

template <class Traits, class HDS>
CGAL_Geomview_stream&
CGAL_Geomview_stream &G << CGAL_Polyhedron_3<Traits,HDS> P
Inserts the polyhedron P into the stream G.

Colors

geomview distinguishes between edge and face colors. The edge color is at the same time the color of vertices.

CGAL_Geomview_stream&
G << CGAL_Color c Makes c the color of vertices, edges and faces in subsequent IO operations.
CGAL_Color G.set_bg_color ( CGAL_Color c)
Changes the background color. Returns the old value.
CGAL_Color G.set_vertex_color ( CGAL_Color c)
Changes the vertex color. Returns the old value.
CGAL_Color G.set_edge_color ( CGAL_Color c)
Changes the edge color. Returns the old value.
CGAL_Color G.set_face_color ( CGAL_Color c)
Changes the face color. Returns the old value.

Miscellaneous

void G.clear () Deletes all objects.
void G.look_recenter () Positions the camera in a way that all objects can be seen.
int G.get_line_width ()
Returns the line width.
int G.set_line_width ( int w)
Sets the line width to w. Returns the previous value.
double G.get_vertex_radius ()
Returns the radius of vertices.
double G.set_vertex_radius ( double r)
Sets the radius of vertices to d. Returns the previous value.
bool G.set_trace ( bool b)
Sets tracing on. The data that are sent to geomview are also sent to cerr. Returns the previous value. By default tracing is off.
bool G.get_trace () Returns true iff tracing is on.


begin of advanced section

Advanced and Developers Features

The following functions are helpful if you develop your own insert and extract functions. The following functions allow to pass a string from geomview and to read data sent back by geomview.

CGAL_Geomview_stream&
G << const char* s Inserts string s into the stream.
CGAL_Geomview_stream&
G >> char* s Extracts a string s from the stream.
Precondition: You have to allocate enough memory.
CGAL_Geomview_stream&
G << int i Inserts integer i into the stream. Puts whitespace around if the stream is in ascii mode.
CGAL_Geomview_stream&
G << double d Inserts double d into the stream. Puts whitespace around if the stream is in ascii mode.
bool G.in_binary_mode ()
Returns true iff G is in binary mode.
bool G.in_ascii_mode () Returns true iff G is in binary mode.
void G.set_binary_mode ()
void G.set_ascii_mode ()

For convenience we offer the manipulators ascii and binary that can be inserted in the stream.

CGAL_Geomview_stream&
G << ascii Sets the stream in ascii mode.
CGAL_Geomview_stream&
G << binary Sets the stream in binary mode.


end of advanced section

Implementation

The constructor forks a process and establishes two pipes between the processes. The forked process is then overlaid with geomview. The file descriptors stdin and stdout of geomview are hooked on the two pipes.

All insert operators construct expressions in gcl, the geomview comand language, which is a subset of LISP. These expressions are sent to geomview via the pipe. The extract operators notify interest for a certain kind of events. When such an event happens geomview sends a description of the event in gcl and the extract operator has to parse this expression.

In order to implement further insert and extract operators you should take a look at the implementation [Fab97] and at the geomview manual [Phi96].


Navigation: Up, Table of Contents, Bibliography, Index, Title Page
The CGAL Project. 22 January 1999.