\( \newcommand{\E}{\mathrm{E}} \) \( \newcommand{\A}{\mathrm{A}} \) \( \newcommand{\R}{\mathrm{R}} \) \( \newcommand{\N}{\mathrm{N}} \) \( \newcommand{\Q}{\mathrm{Q}} \) \( \newcommand{\Z}{\mathrm{Z}} \) \( \def\ccSum #1#2#3{ \sum_{#1}^{#2}{#3} } \def\ccProd #1#2#3{ \sum_{#1}^{#2}{#3} }\)
CGAL 4.8.1 - Geomview
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
CGAL::Geomview_stream Class Reference

#include <CGAL/IO/Geomview_stream.h>

Definition

An object of the class 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.

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 command 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 and at the Geomview manual.

Examples:
Geomview/gv_terrain.cpp.

Public Member Functions

template<class InputIterator >
void draw_triangles (InputIterator begin, InputIterator end)
 [begin;end) is an iterator range with value type Triangle_3<R>. More...
 
Color set_bg_color (const Color &c)
 Changes the background color. More...
 
Color set_vertex_color (const Color &c)
 Changes the vertex color. More...
 
Color set_edge_color (const Color &c)
 Changes the edge color. More...
 
Color set_face_color (const Color &c)
 Changes the face color. More...
 

Related Functions

(Note that these are not member functions.)

template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Point_2< R > &p)
 Inserts the point p into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Point_3< R > &p)
 Inserts the point p into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Segment_2< R > &s)
 Inserts the segment s into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Segment_3< R > &s)
 Inserts the segment s into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Ray_2< R > &r)
 Inserts the ray r into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Ray_3< R > &r)
 Inserts the ray r into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Line_2< R > &l)
 Inserts the line l into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Line_3< R > &l)
 Inserts the line l into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Triangle_2< R > &t)
 Inserts the triangle t into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Triangle_3< R > &t)
 Inserts the triangle t into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Tetrahedron_3< R > &t)
 Inserts the tetrahedron t into the stream gs.
 
template<class R >
Geomview_streamoperator<< (Geomview_stream &gs, const Sphere_3< R > &s)
 Inserts the sphere s into the stream gs.
 
Geomview_streamoperator<< (Geomview_stream &gs, const Bbox_2 &b)
 Inserts the bounding box b into the stream gs.
 
Geomview_streamoperator<< (Geomview_stream &gs, const Bbox_3 &b)
 Inserts the bounding box b into the stream gs.
 
Geomview_streamoperator<< (Geomview_stream &gs, const Bbox_3 &b)
 Inserts the bounding box b into the stream gs.
 
Geomview_streamoperator<< (Geomview_stream &gs, const Bbox_3 &b)
 Inserts the bounding box b into the stream gs.
 
template<class R >
Geomview_streamoperator>> (Geomview_stream &gs, Point_3< R > &p)
 Extracts the point p from the stream gs. More...
 
template<class Traits , class HDS >
Geomview_streamoperator<< (Geomview_stream &G, const Polyhedron_3< Traits, HDS > &P)
 Inserts the polyhedron P into the stream gs. More...
 
template<class GT , class TDS >
Geomview_streamoperator<< (Geomview_stream &G, const Triangulation_2< GT, TDS > &T)
 Inserts the 2D triangulation T into the stream gs. More...
 
template<class GT , class TDS >
Geomview_streamoperator<< (Geomview_stream &G, const Triangulation_3< GT, TDS > &T)
 Inserts the 3D triangulation T into the stream gs. More...
 

Creation

 Geomview_stream (const Bbox_3 &bbox=Bbox_3(0, 0, 0, 1, 1, 1), const char *machine=NULL, const char *login=NULL)
 Introduces a Geomview stream gs with a camera that sees the bounding box. More...
 

Colors

Geomview_streamoperator<< (const Color &c)
 Geomview distinguishes between edge and face colors. More...
 

Miscellaneous

void clear ()
 Deletes all objects.
 
void pickplane ()
 Creates a pickplane (useful after a clear).
 
void look_recenter ()
 Positions the camera in a way that all objects can be seen.
 
int get_line_width () const
 Returns the line width.
 
int set_line_width (int w)
 Sets the line width to w. More...
 
double get_vertex_radius () const
 Returns the radius of vertices.
 
double set_vertex_radius (double r) const
 Sets the radius of vertices to d. More...
 
string get_new_id (string s)
 Used to obtain unique identifier names passed to Geomview. More...
 
bool set_wired (bool b)
 Sets wired mode. More...
 
bool get_wired ()
 Returns true iff wired mode is on.
 

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.

Geomview_streamoperator<< (string s)
 Inserts string s into the stream.
 
Geomview_streamoperator>> (char *s)
 Extracts a string s from the stream. More...
 
Geomview_streamoperator<< (int i)
 Inserts i into the stream. More...
 
Geomview_streamoperator<< (unsigned int i)
 Inserts i into the stream. More...
 
Geomview_streamoperator<< (long i)
 Inserts i into the stream. More...
 
Geomview_streamoperator<< (unsigned long i)
 Inserts i into the stream. More...
 
Geomview_streamoperator<< (double d)
 Inserts double d into the stream. More...
 
bool set_trace (bool b)
 Sets tracing on. More...
 
bool get_trace ()
 Returns true iff tracing is on.
 
bool set_raw (bool b)
 Sets raw mode. More...
 
bool get_raw ()
 Returns true iff raw mode is on.
 
bool set_echo (bool b)
 Sets echo mode. More...
 
bool get_echo ()
 Returns true iff echo mode is on.
 
bool set_binary_mode (bool b=true)
 Sets whether we are in binary mode.
 
bool set_ascii_mode (bool b=true)
 Sets whether we are in ascii mode.
 
bool get_binary_mode ()
 Returns true iff gs is in binary mode.
 
bool get_ascii_mode ()
 Returns true iff gs is in ascii mode.
 

Constructor & Destructor Documentation

CGAL::Geomview_stream::Geomview_stream ( const Bbox_3 bbox = Bbox_3(0, 0, 0, 1, 1, 1),
const char *  machine = NULL,
const char *  login = NULL 
)

Introduces a Geomview stream gs with a camera that sees the bounding box.

The command geomview must be in the user's PATH. If machine and login are not NULL, Geomview is started on the remote machine using rsh.

Member Function Documentation

template<class InputIterator >
void CGAL::Geomview_stream::draw_triangles ( InputIterator  begin,
InputIterator  end 
)

[begin;end) is an iterator range with value type Triangle_3<R>.

This method uses the OFF format to draw several triangles at once, which is much faster than drawing them one by one.

string CGAL::Geomview_stream::get_new_id ( string  s)

Used to obtain unique identifier names passed to Geomview.

On successive calls with the same s value, it will return a string which is s appended with the numbers 0, then 1, then 2... Note that all counters are reset when clear() is called.

Geomview_stream& CGAL::Geomview_stream::operator<< ( const Color c)

Geomview distinguishes between edge and face colors.

The edge color is at the same time the color of vertices.

Makes c the color of vertices, edges and faces in subsequent IO operations.

Geomview_stream& CGAL::Geomview_stream::operator<< ( int  i)

Inserts i into the stream.

Puts whitespace around if the stream is in ascii mode.

Geomview_stream& CGAL::Geomview_stream::operator<< ( unsigned int  i)

Inserts i into the stream.

Puts whitespace around if the stream is in ascii mode.

Geomview_stream& CGAL::Geomview_stream::operator<< ( long  i)

Inserts i into the stream.

Puts whitespace around if the stream is in ascii mode. Currently implemented by converting to int, so it can be truncated on 64 bit platforms.

Geomview_stream& CGAL::Geomview_stream::operator<< ( unsigned long  i)

Inserts i into the stream.

Puts whitespace around if the stream is in ascii mode. Currently implemented by converting to unsigned int, so it can be truncated on 64 bit platforms.

Geomview_stream& CGAL::Geomview_stream::operator<< ( double  d)

Inserts double d into the stream.

Puts whitespace around if the stream is in ascii mode.

Geomview_stream& CGAL::Geomview_stream::operator>> ( char *  s)

Extracts a string s from the stream.

Precondition
You have to allocate enough memory.
Color CGAL::Geomview_stream::set_bg_color ( const Color c)

Changes the background color.

Returns the old value.

bool CGAL::Geomview_stream::set_echo ( bool  b)

Sets echo mode.

In echo mode, when you select a point in Geomview, the point is actually sent back to Geomview. Returns the previous value. By default, echo mode is on.

Color CGAL::Geomview_stream::set_edge_color ( const Color c)

Changes the edge color.

Returns the old value.

Color CGAL::Geomview_stream::set_face_color ( const Color c)

Changes the face color.

Returns the old value.

int CGAL::Geomview_stream::set_line_width ( int  w)

Sets the line width to w.

Returns the previous value.

bool CGAL::Geomview_stream::set_raw ( bool  b)

Sets raw mode.

In raw mode, kernel points are output without headers and footers, just the coordinates (in binary or ascii mode). This allows the implementation of the stream functions for other objects to re-use the code for points internally, by temporary saving the raw mode to true, and restoring it after. Returns the previous value. By default, raw mode is off.

bool CGAL::Geomview_stream::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.

Color CGAL::Geomview_stream::set_vertex_color ( const Color c)

Changes the vertex color.

Returns the old value.

double CGAL::Geomview_stream::set_vertex_radius ( double  r) const

Sets the radius of vertices to d.

Returns the previous value.

bool CGAL::Geomview_stream::set_wired ( bool  b)

Sets wired mode.

In wired mode, some structures output only there edges, not there surfaces. Returns the previous value. By default, wired mode is off.