next up previous contents index
Next: Windows for 3d visualization Up: Graphics Previous: The GraphWin (GW) File   Contents   Index


Geometry Windows ( GeoWin )

Definition

An instance of data type GeoWin is an editor for sets of geometric objects. It can be used for the visualization of result and progression of geometric algorithms. GeoWin provides an interactive interface and a programming interface to visualize and manipulate geometric objects and data structures.

Sets of geometric objects are maintained in so-called scenes.

Scenes

Scenes are instances of the various scene data types supported by GeoWin. They are used to store collections of geometric objects and attributes of the objects and collections. Furthermore the scene classes have to provide functionality for GeoWin to handle the geometric objects of a scene.

Each scene stores geometric objects in a container (a LEDA-list or STL-list). We call these geometric objects stored in a container of a scene the contents of a scene. The scenes and their contents can be manipulated by the interactive interface and the programming interface of GeoWin.

With every scene a set of attributes is associated. Most of them describe the visual representation of the scene, for instance the boundary- and fill-color of the objects, the visibility of the scene,... .

We use the type geo_scene as the scene item type of GeoWin; it may be helpful to view it as pointers to scenes.

We distinguish the following types of scene classes:

  1. Edit Scenes (type GeoEditScene<CONTAINER>)

    where CONTAINER is the type of the scene's container storing the contents of the scene, for instance list<point>. These scenes can be edited by the user through the interactive interface of GeoWin. Note that edit scenes have some special features. An important feature is the possibility to select objects through the interactive interface. These selected objects have special attributes, see the table of scene attributes.

  2. Result Scenes (type GeoResultScene<I,R>)

    These scenes are not independently editable by the user. The contents of result scenes is computed by a user-defined update function or update object executing a geometric algorithm. This recomputation of the scene contents will be done every time when another scene (this other scene we call the input scene of the result scene) changes. The contents of the result scene is stored in a container of type R. The input scene must be a Basic Scene with a container of type I. The update function void (*f_update)(const I& input, R& result) gets the contents of this input scene and computes the contents result of the result scene. We say that the result scene depends on its input scene.

  3. Basic Scenes (type GeoBaseScene<CONTAINER>)

    Edit Scenes and Result Scenes are derived from Basic Scenes. The basic scene type works on container types providing an interface as the list of the STL library. More precisely, CONTAINER has to support the following type definitions and STL-like operations:

    That means, that LEDA lists can be used as well as containers.

The programming interface of GeoWin provides various operations to create Edit Scenes and Result Scenes. Basic Scenes are not created directly by the operations of the programming interface, but they are used for derivation of the other scene types, and we will find them in the programming interface, when both Edit and Result Scenes are supported by an operation.

GeoWin - class

We explain some important terms of the GeoWin data type. Every instance GW of GeoWin can maintain a number of geo_scenes.
Visible scenes will be displayed by GW, non-visible scenes will not be displayed. Displayed means, that the contents of the scene will be displayed. A special case is the active scene of GW. Every GeoWin can have at most one active scene. The active scene is an Edit Scene with input focus. That means that this scene is currently edited by the user through the interactive interface. Note that the currently active scene will be displayed.
Another important topic is the display order of scenes. Every scene has an associated non-negative z-coordinate. When a scene is created, it gets z-coordinate 0. When GW redraws a scene, the contents of this scene and the contents of its visible dependent scenes is drawn. In the redraw-operation of GeoWin the scenes with higher z-coordinates will be drawn in the background of scenes with lower z-coordinate.The scenes with z-coordinate 0 will be drawn on top in the order of their creation in its instance of GeoWin (the scene, that was created last and has z-coordinae 0 is the scene on top).

Attributes of scenes

The following attributes are associated with every scene.

Name Type Description
active bool activity status of a scene
active_line_width int line width used for drawing objects of active scenes
client_data void* some void*-pointers that can be associated with a scene
color color boundary color of non-selected objects
description string a string describing the scene
fill_color color fill color of objects
line_style line_style line style used for drawing objects
line_width int line width used for drawing objects of non-active scenes
name string the name of the scene
point_style point_style point style used for drawing objects
selection_color color boundary color selected objects
selection_fill_color color fill color of selected objects
show_orientation bool disables/enables the drawing of object orientations/directions
text_color color text label color
visible bool visibility of a scene in its GeoWin
z_order int z-coordinate of a scene in its GeoWin

Attributes and parameters of instances of GeoWin

Every instance of type GeoWin uses the following attributes and parameters. The parameters starting with d3_ are influencing the 3-d output option of GeoWin. This 3-d output option uses the LEDA-class d3_window for displaying geometric objects. See also the d3_window - Manualpages for a description of the 3-d output parameters.

Name Type Description
active_scene geo_scene the active scene
bg_color color window background color
bg_pixmap string name of the used window background pixmap
d3_elimination bool true - in the d3-output hidden lines will be eliminated
d3_show_edges bool enables/disables the redraw of edges in the d3-output
d3_solid bool true - in the d3-output faces will be drawn in different grey scales
grid_dist double width of the grid in the drawing area
grid_style grid_style style of the grid in the drawing area
show_grid bool defines if a grid should be used in the drawing area of the window
show_position bool true - the coordinates of the mouse cursor are displayed

The geometric objects

The objects stored in the containers of the scenes have to support input and output operators for streams and the LEDA window and the output operator to the ps_file.

Manual overview

The following manual pages have this structure:

#include < LEDA/graphics/geowin.h >

Creation

GeoWin GW(const char* label = "GEOWIN")
    creates a GeoWin GW. GW is constructed with frame label label

GeoWin GW(int w, int h, const char* label = "GEOWIN")
    creates a GeoWin GW with frame label label and window size w x h pixels.

Operations


a) Main Operations


In this section you find operations for creating scenes and for starting the interactive mode of GeoWin.

The new_scene and get_objects operations use member templates. If your compiler does not support member templates, you should use instead the templated functions geowin_new_scene and geowin_get_objects with GW as an additional first parameter.

All new_scene operations can get as an optional last parameter a pointer to a function that is used to compute the three-dimensional output of the scene. The type of such a function pointer f is

void (*f)(const T&, d3_window&, GRAPH<d3_point,int>&))

where T is the type of the container used in the scene (for instance list<point>). The function gets a reference to the container of it's scene, a reference to the output d3_window and to the parametrized graph describing the three-dimensional output. The function usually adds new nodes and edges to this graph. Note that every edge in the graph must have a reversal edge ( and the reversal information has to be set).
Example:

void segments_d3(const list<segment>& L,d3_window& W, 
                 GRAPH<d3_point,int>& H)
{
 GRAPH<d3_point,int> G;
 segment iter;
 forall(iter,L) {
   node v1 = G.new_node(d3_point(iter.source().xcoord(),
                                 iter.source().ycoord(),0));
   node v2 = G.new_node(d3_point(iter.target().xcoord(),
                                 iter.target().ycoord(),0));   
   edge e1 = G.new_edge(v1,v2);
   edge e2 = G.new_edge(v2,v1);
   G.set_reversal(e1,e2);
 }
 H.join(G);
}

In this simple example the function gets a list of segments. For every segment in the list two new nodes and two new edges are created. The reversal information is set for the two edges. At the end the local graph G is merged into H.

The following templated new_scene operation can be used to create edit scenes. The CONTAINER has to be a list<T> , where T is one of the following 2d LEDA kernel type

or a d3_point or a d3_rat_point. If you want to use the other 2d LEDA kernel types, you have to include geowin_init.h and to initialize them for usage in GeoWin by calling the geowin_init_default_type function at the beginning of main (before an object of data type GW is constructed). If you want to use the other 3d LEDA kernel types, you have to include geowin_init_d3.h and to initialize them for usage in GeoWin by calling the geowin_init_default_type function at the beginning of main (before an object of data type GW is constructed).

template <class CONTAINER>
GeoEditScene<CONTAINER>* GW.new_scene(CONTAINER& c)
    creates a new edit scene and returns a pointer to the created scene. c will be the container storing the contents of the scene.

template <class CONTAINER>
GeoEditScene<CONTAINER>* GW.new_scene(CONTAINER& c, string str, D3_FCN f)
    creates a new edit scene and returns a pointer to the created scene. c will be the container storing the contents of the scene. The name of the scene will be set to str.


The following new_scene operations can be used to create result scenes. Result scenes use the contents of another scene (the input scene) as input for a function (the update function). This function computes the contents of the result scene. The update function is called every time when the contents of the input scene changes. Instead of using an update function you can use an update object that encapsulates an update function. The type of this update object has to be geowin_update<I,R> (I - type of the container in the input scene, R - type of the container in the result scene) or a class derived from it. A derived class should overwrite the virtual update function

void update(const I& in,R& out)

of the base class to provide a user defined update function. The class geowin_update<I,R> has 3 constructors getting function pointers as arguments:

geowin_update(void (*f)(const I& in, R& res)

geowin_update(void (*f)(const I& in, R::value_type& obj)

geowin_update(R::value_type (*f)(const I& in)

When the update object is constructed by calling the constructor with one of these function pointers, the function (*f) will be called in the update method of the update object. The first variant is the normal update function that gets the contents in of the input scene and computes the contents res of the output scene. In the second variant the contents of the result scene will first be cleared, then the update function will be called and obj will be inserted in the result scene. In the third variant the contents of the result scene will be cleared, and then the object returned by (*f) will be inserted in the result scene. The class geowin_update has also the following virtual functions:

bool insert(const InpObject& new)

bool del(const InpObject& new)

bool change(const InpObject& old_obj,const InpObject& new_obj)

where new is a new inserted or deleted object and old_obj and new_obj are objects before and after a change. InpObject is the value type of the container of the input scene. With these functions it is possible to support incremental algorithms. The functions will be called, when in the input scene new objects are added (insert), deleted (del) or changed when performing a move or rotate operation (change). In the base class geowin_update<I,R> these functions return false. That means, that the standard update-function of the update object should be used. But in derived classes it is possible to overwrite these functions and provide user-defined update operations for these three incremental operations. Then the function has to return true. That means, that the standard update function of the update object should not be used. Instead the incremental operation performs the update-operation.

It is also possible to provide user defined redraw for a scene. For this purpose we use redraw objects derived from geowin_redraw. The derived class has to overwrite the virtual redraw function

void draw(window& W,color c1,color c2,double x1,double y1,double x2,double y2)

of the base class to provide a user defined redraw function. The first 3 parameters of this function are the redraw window and the first and second drawing color (color and color2) of the scene. The class geowin_redraw has also a virtual method

bool draw_container()

that returns false in the base class. If you want the user defined redraw of the scene (provided by the redraw function draw) and the execution of the 'normal' redraw of the scene as well (output of the objects stored in the container of the scene), you have to overwrite draw_container in a derived class by a function returning true. A virtual method

bool write_postscript(ps_file& PS,color c1,color c2)

is provided for output to a LEDA postscript file PS. c1 and c2 are the first and second drawing color (color and color2) of the scene. Another class that can be used for user defined redraw is the templated class geowin_redraw_container<CONTAINER>. This class has as well virtual functions for redraw and postscript output, but provides a slighly changed interface:

bool draw(const CONTAINER& c, window& w, color c1, color c2, double,double,double,double)

bool write_postscript(const CONTAINER& c, ps_file& ps, color c1, color c2)

The parameters of these two virtual functions are like the parameters of the members with the same name of geowin_redraw, but there is an additional first parameter. This parameter is a reference to the container of the scene that has to be redrawn.

In update- and redraw- functions and objects the following static member functions of the GeoWin class can be used:

GeoWin* GeoWin::get_call_geowin()
geo_scene GeoWin::get_call_scene()
geo_scene GeoWin::get_call_input_scene()

The first function returns a pointer to the GeoWin of the calling scene, the second returns the calling scene and the third (only usable in update functions/ objects) returns the input scene of the calling scene.

Note that S and R in the following operations are template parameters. S and R have to be a list<T>, where T is a 2d LEDA kernel type, a d3_point or a d3_rat_point. S is the type of the contents of the input scene, R the type of the contents of the created result scene. All operations creating result scenes return a pointer to the created result scene.

This section contains three small example programs showing you the usage of the new_scene operations for the creation of result scenes. All example programs compute the convex hull of a set of points stored in the container of an input scene sc_points and store the computed hull in a result scene sc_hull.

template <class S, class R>
GeoResultScene<S,R>* GW.new_scene(void (*f_update)(const S& , R& ), geo_scene sc, string str, D3_FCN f = NULL)
    creates a new result scene with name str. The input scene for this new result scene will be sc. The update function will be f_update.

The first example program shows the usage of the new_scene operation taking an update function pointer. The update function computes the convex hull of the points stored in the input scene. The result polygon will be inserted in the container P of the result scene.

  
#include <LEDA/graphics/geowin.h>
#include <LEDA/geo/float_geo_alg.h>

using namespace leda;

void convex_hull(const list<point>& L, list<polygon>& P)
{ P.clear(); P.append(CONVEX_HULL_POLY(L)); }

int main()
{
 GeoWin gw;
 list<point> LP;
 
 geo_scene sc_points = gw.new_scene(LP);
 geo_scene sc_hull = gw.new_scene(convex_hull, sc_points, "Convex hull");
 gw.set_color(sc_hull, blue);
 gw.set_visible(sc_hull, true);
  
 gw.edit(sc_points);
 return 0;
}

template <class S,class R>
GeoResultScene<S,R>* GW.new_scene(geowin_update<S,R>& up, list<geo_scene>& infl, string str, D3_FCN f = NULL)
    creates a new result scene scr with name str. The input scene for this new result scene will be the first scene in infl. The update object will be up. up has to be constructed by a call up(fu,0), where fu is a function of type void fu(const C0&, const C1&, ..., const Cn&, R&). infl is a list of scenes influencing the result scene. C0,...,Cn are the types of the containers of the scenes in infl. When one of the scenes in infl changes, fu will be called to update the contents of scr. Precondition infl must not be empty.

template <class S,class R>
GeoResultScene<S,R>* GW.new_scene(geowin_update<S,R>& up, geo_scene sc_input, string str, D3_FCN f = NULL)
    creates a new result scene with name str. The input scene for this new result scene will be sc_input. The update object will be up.

The second variant of the example program uses an update object update.

  
#include <LEDA/graphics/geowin.h>
#include <LEDA/geo/float_geo_alg.h>

using namespace leda;

int main()
{
 GeoWin gw;
 list<point> LP;
 
 geo_scene sc_points = gw.new_scene(LP);
 
 geowin_update<list<point>, list<polygon> > update(CONVEX_HULL_POLY);
 geo_scene sc_hull = gw.new_scene(update, sc_points, "Convex hull");
 gw.set_color(sc_hull, blue);
 gw.set_visible(sc_hull, true);
  
 gw.edit(sc_points);
 return 0;
}

template <class S,class R>
void GW.set_update(geo_scene res, geowin_update<S,R>& up)
    makes up the update object of res. Precondition res points to a scene of type GeoResultScene<S,R> .

template <class S,class R>
void GW.set_update(geo_scene res, void (*f_update)(const S& , R& ))
    makes f_update the update function of res. Precondition res points to a scene of type GeoResultScene<S,R> .

template <class S,class R>
GeoResultScene<S,R>* GW.new_scene(geowin_update<S,R>& up, geowin_redraw& rd, geo_scene sc_input, string str, D3_FCN f = NULL)
    creates a new result scene with name str. The input scene for this new result scene will be sc_input. The update object will be ub. The redraw object will be rd.

The third variant of the example program uses an update and redraw object. We provide a user defined class for update and redraw of the result scene.

#include <LEDA/graphics/geowin.h>
#include <LEDA/geo/float_geo_alg.h>

using namespace leda;

class hull_update_redraw : public geowin_update<list<point>, list<polygon> > ,
                           public geowin_redraw
{
 list<polygon> polys;
public:
 void update(const list<point>& L, list<polygon>& P)
 { 
  polys.clear();
  polys.append(CONVEX_HULL_POLY(L));
 }
 
 void draw(window& W,color c1,color c2,double x1,double y1,double x2,double y2)
 {
  polygon piter;
  segment seg;
  forall(piter, polys){
    forall_segments(seg, piter){
      W.draw_arrow(seg, c1);
    }
  }
 }
};

int main()
{
 GeoWin gw;
 list<point> LP;
 
 geo_scene sc_points = gw.new_scene(LP);
 
 hull_update_redraw up_rd;
 geo_scene sc_hull = gw.new_scene(up_rd, up_rd, sc_points, "Convex hull");
 gw.set_color(sc_hull, blue);
 gw.set_visible(sc_hull, true);
  
 gw.edit(sc_points);
 return 0;
}

template <class S,class R>
GeoResultScene<S,R>* GW.new_scene(geowin_update<S,R>& up, geowin_redraw_container<R>& rd, geo_scene sc_input, string str, D3_FCN f = NULL)
    creates a new result scene with name str. The input scene for this new result scene will be sc_input. The update object will be ub. The redraw container object will be rd.

template <class CONTAINER>
bool GW.get_objects(CONTAINER& c)
    If the container storing the contents of the current edit scene has type CONTAINER, then the contents of this scene is copied to c.

template <class CONTAINER>
bool GW.get_objects(geo_scene sc, CONTAINER& c)
    If the container storing the contents of scene sc has type CONTAINER, then the contents of scene sc is copied to c.

template <class CONTAINER>
void GW.get_selected_objects(GeoEditScene<CONTAINER>* sc, CONTAINER& cnt)
    returns the selected objects of scene sc in container cnt.

template <class CONTAINER>
void GW.set_selected_objects(GeoEditScene<CONTAINER>* sc, const list<typename CONTAINER::iterator>& LIT)
    selects the objects of scene sc described by the contents of container LIT.

template <class CONTAINER>
void GW.set_selected_objects(GeoEditScene<CONTAINER>* sc)
    selects all objects of scene sc.

template <class CONTAINER>
void GW.set_selected_objects(GeoEditScene<CONTAINER>* sc, const rectangle& R)
    selects all objects of scene sc contained in rectangle R.

void GW.edit() starts the interactive mode of GW. The operation returns if either the DONE or Quit button was pressed.

bool GW.edit(geo_scene sc) edits scene sc. Returns false if the Quit-Button was pressed, true otherwise.

void GW.register_window(window& win, bool (*ev_fcn)(window* w, int event, int but, double x, double y))
    if you enter the interactive mode of GW in an application, but you want to handle events of other windows as well, you can register a callback function ev_fcn for your other window win that will be called when events associated with win occur. The parameters of ev_fcn are the window causing the event, the event that ocurred, the button and the x and y coordinates of the position in win. The handler ev_fcn has to return true if the interactive mode of GeoWin has to be stopped, false otherwise.


Simple Animations

The following operation can be used to perform simple animations. One can animate the movement of selected objects of a scene. This can be done in the following way: select a number of objects in an edit scene; then start the animation by calling the animate member function. The second parameter of this member function is an object anim of type geowin_animation, the first parameter is the scene that will be animated. The object anim has to be derived from the abstract base class geowin_animation. The derived class has to overwrite some methods of the base class:

class geowin_animation { 
public:
 virtual void init(const GeoWin&) { }
 virtual void finish(const GeoWin&) { }
 virtual bool is_running(const GeoWin&) { return true; }
 virtual point get_next_point(const GeoWin&) = 0;
 virtual long  get_next_action(const GeoWin&) 
 { return GEOWIN_STOP_MOVE_SELECTED; }
};

At the start and at the end of an animation the member functions init and finish are called. The animation is stopped if is_running returns false. The member functions get_next_point and get_next_action specify the animation. get_next_point delivers the next point of the animation path. get_next_action currently can return two values: GEOWIN_MOVE_SELECTED (moves the selected objects of the scene) and GEOWIN_STOP_MOVE_SELECTED (stops the movement of the selected objects of the scene).

bool GW.animate(geo_scene sc, geowin_animation& anim)
    starts animation anim for edit scene sc.


b) Window Operations

void GW.close() closes GW .

double GW.get_xmin() returns the minimal x-coordinate of the drawing area.

double GW.get_ymin() returns the minimal y-coordinate of the drawing area.

double GW.get_xmax() returns the maximal x-coordinate of the drawing area.

double GW.get_ymax() returns the maximal y-coordinate of the drawing area.

void GW.display(int x = window::center, int y = window::center)
    opens GW at (x,y).

window& GW.get_window() returns a reference to the drawing window.

void GW.init(double xmin, double xmax, double ymin)
    same as window::init(xmin, xmax, ymin, g).

void GW.init(double x1, double x2, double y1, double y2, int r=GEOWIN_MARGIN)
    inializes the window so that the rectangle with lower left corner (x1 - r, y1 - r) and upper right corner (x2 + r, y2 + r) is visible. The window must be open. GEOWIN$ \_$MARGIN is a default value provided by GeoWin.

void GW.redraw() redraws the contents of GW (all visible scenes).

int GW.set_cursor(int cursor_id = -1)
    sets the mouse cursor to cursor$ \_$id.

bool GW.get_show_status() return

bool GW.set_show_status(bool b)
    display a status window (b=true) or not (b=false). The operation should be called before the first display - operation of GW.

bool GW.set_show_menu(bool v) sets the visibility of the menu of GW to v.

void GW.set_menu_add_fcn(void (*mfcn)(window& W))
    This handler function can be used to add own menus to the menu bar of a GeoWin. It is called before the menu initialization of a GeoWin. See the demo program geowin_gui for an example.

bool GW.set_show_file_menu(bool v)
    sets the visibility of the file menu of GW to v.

bool GW.set_show_edit_menu(bool v)
    sets the visibility of the edit menu of GW to v.

bool GW.set_show_scenes_menu(bool v)
    sets the visibility of the scenes menu of GW to v.

bool GW.set_show_window_menu(bool v)
    sets the visibility of the window menu of GW to v.

bool GW.set_show_options_menu(bool v)
    sets the visibility of the options menu of GW to v.

bool GW.set_show_algorithms_menu(bool v)
    sets the visibility of the algorithms menu of GW to v.

bool GW.set_show_help_menu(bool v)
    sets the visibility of the help menu of GW to v.

void GW.init_menu(window* wptr = NULL)
    initializes the menu of GW. Normally you don't have to call this operation directly, but if you want to add additional graphical elements like sliders or buttons to the window of GW you have to call init_window (with no parameters). After that add the desired elements and then call edit or display. See the demo programs for examples.


c) Scene and scene group Operations

geo_scene GW.get_scene_with_name(string nm)
    returns the scene with name nm or nil if there is no scene with name nm.

void GW.activate(geo_scene sc) makes scene sc the active scene of GW.

int GW.get_z_order(geo_scene sc)
    returns the z-coordinate of sc.

int GW.set_z_order(geo_scene sc, int n)
    sets the z-coordinate of sc to n and returns its previous value.


In front of the scenes of a GeoWin object a so-called "user layer" can store some geometric objects illustrating scenes. The following functions let you add some of these objects.

void GW.add_user_layer_segment(const segment& s)
    adds segment s to the segments of the user layer.

void GW.add_user_layer_circle(const circle& c)
    adds circle c to the circles of the user layer.

void GW.add_user_layer_point(const point& p)
    adds point p to the points of the user layer.

void GW.add_user_layer_rectangle(const rectangle& r)
    adds rectangle r to the rectangles of the user layer.

void GW.remove_user_layer_objects()
    removes all objects of the user layer.

void GW.set_draw_user_layer_fcn(void (*fcn)(GeoWin*))
    this function can be used for additional user-defined redraw after drawing the objects of the user layer.

void GW.set_postscript_user_layer_fcn(void (*fcn)(GeoWin*, ps_file& ))
   

geo_scene GW.get_active_scene() returns the active scene of GW.

bool GW.is_active(geo_scene sc)
    returns true if sc is an active scene in a GeoWin.


The following get and set operations can be used for retrieving and changing scene parameters. All set operations return the previous value.

string GW.get_name(geo_scene sc) returns the name of scene sc.

string GW.get_name(geo_scenegroup gs)
    returns the name of scene group gs.

string GW.set_name(geo_scene sc, string nm)
    gives scene sc the name nm. If there is already a scene with name nm, another name is constructed based on nm and is given to sc. The operation will return the given name.

color GW.get_color(geo_scene sc)
    returns the boundary drawing color of scene sc.

color GW.set_color(geo_scene sc, color c)
    sets the boundary drawing color of scene sc to c.

void GW.set_color(geo_scenegroup gs, color c)
    sets the boundary drawing color of all scenes in group gs to c.

color GW.get_selection_color(geo_scene sc)
    returns the boundary drawing color for selected objects of scene sc.

color GW.set_selection_color(geo_scene sc, color c)
    sets the boundary drawing color for selected objects of scene sc to c.

void GW.set_selection_color(geo_scenegroup gs, color c)
    sets the boundary drawing color for selected objects of all scenes in gs to c.

color GW.get_selection_fill_color(geo_scene sc)
    returns the fill color for selected objects of scene sc.

color GW.set_selection_fill_color(geo_scene sc, color c)
    sets the fill color for selected objects of scene sc to c.

line_style GW.get_selection_line_style(geo_scene sc)
    returns the line style for selected objects of scene sc.

line_style GW.set_selection_line_style(geo_scene sc, line_style l)
    sets the line style for selected objects of scene sc to l.

int GW.get_selection_line_width(geo_scene sc)
    returns the line width for selected objects of scene sc.

int GW.set_selection_line_width(geo_scene sc, int w)
    sets the line width for selected objects of scene sc to w.

color GW.get_fill_color(geo_scene sc)
    returns the fill color of sc.

color GW.set_fill_color(geo_scene sc, color c)
    sets the fill color of sc to c. Use color invisible to disable filling.

void GW.set_fill_color(geo_scenegroup gs, color c)
    sets the fill color of all scenes in gs to c. Use color invisible to disable filling.

color GW.get_text_color(geo_scene sc)
    returns the text color of sc.

color GW.set_text_color(geo_scene sc, color c)
    sets the text color of sc to c.

void GW.set_text_color(geo_scenegroup gs, color c)
    sets the text color of all scenes in gs to c.

int GW.get_line_width(geo_scene sc)
    returns the line width of scene sc .

int GW.get_active_line_width(geo_scene sc)
    returns the active line width of sc .

int GW.set_line_width(geo_scene sc, int w)
    sets the line width for scene sc to w.

void GW.set_line_width(geo_scenegroup gs, int w)
    sets the line width for all scenes in gs to w.

int GW.set_active_line_width(geo_scene sc, int w)
    sets the active line width of scene sc to w.

void GW.set_active_line_width(geo_scenegroup gs, int w)
    sets the active line width for all scenes in gs to w.

line_style GW.get_line_style(geo_scene sc)
    returns the line style of sc.

line_style GW.set_line_style(geo_scene sc, line_style l)
    sets the line style of scene sc to l.

void GW.set_line_style(geo_scenegroup gs, line_style l)
    sets the line style of all scenes in gs to l.

bool GW.get_visible(geo_scene sc)
    returns the visible flag of scene sc.

bool GW.set_visible(geo_scene sc, bool v)
    sets the visible flag of scene sc to v.

void GW.set_visible(geo_scenegroup gs, bool v)
    sets the visible flag of all scenes in gs to v.

void GW.set_all_visible(bool v)
    sets the visible flag of all scenes that are currently in GW to v.

point_style GW.get_point_style(geo_scene sc)
    returns the point style of sc.

point_style GW.set_point_style(geo_scene sc, point_style p)
    sets the point style of sc to p

void GW.set_point_style(geo_scenegroup gs, point_style p)
    sets the point style of all scenes in gs to p

bool GW.get_cyclic_colors(geo_scene sc)
    returns the cyclic colors flag for editable scene sc.

bool GW.set_cyclic_colors(geo_scene sc, bool b)
    sets the cyclic colors flag for editable scene sc. If the cyclic colors flag is set, the new inserted objects of the scene get color counter%16, where counter is the object counter of the scene.

string GW.get_description(geo_scene sc)
    returns the description string of scene sc.

string GW.set_description(geo_scene sc, string desc)
    sets the description string of scene sc to desc. The description string has the task to describe the scene in a more detailed way than the name of the scene does.

bool GW.get_show_orientation(geo_scene sc)
    returns the show orientation/direction parameter of scene sc

bool GW.set_show_orientation(geo_scene sc, bool o)
    sets the show orientation/direction parameter of scene sc to o.

void* GW.get_client_data(geo_scene sc, int i=0)
    returns the i-th client data pointer of of scene sc. Precondition i < 16.

void* GW.set_client_data(geo_scene sc, void* p, int i=0)
    sets the i-th client data pointer of scene sc to p and returns its previous value. Precondition i < 16.

void GW.set_handle_defining_points(geo_scene sc, geowin_defining_points gdp)
    sets the attribute for handling of defining points of editable scene (*sc) to gdp. Options for gdp are geowin_show (show the defining points of all objects of the scene, geowin_hide (hide the defining points of all objects of the scene) and geowin_highlight (shows only the defining points of the object under the mousepointer).

geowin_defining_points GW.get_handle_defining_points(geo_scene sc)
    returns the attribute for handling of defining points of editable scene (*sc).


The following operations can be used for getting/setting a flag influencing the behaviour of incremental update operations in result scenes. If update_state is true (default) : if the first incremental operation returns false , incremental update loop will be left
false : the incremental update loop will be executed until the end
You can also set an update_limit for the incremental update operations. If a number of objects bigger than this limit will be added/deleted/changed, the incremental update will not be executed. Instead the "normal" scene update operation will be used.

bool GW.get_incremental_update_state(geo_scene sc)
    returns the incremental update flag of scene sc.

bool GW.set_incremental_update_state(geo_scene sc, bool us)
    sets the incremental update flag of scene sc to us.

int GW.get_incremental_update_limit(geo_scene sc)
    returns the incremental update limit of scene sc.

int GW.set_incremental_update_limit(geo_scene sc, int l)
    sets the incremental update limit of scene sc to l.


It is not only possible to assign (graphical) attributes to a whole scene.

The following operations can be used to set/get individual attributes of objects in scenes. All set operations return the previous value. The first parameter is the scene, where the object belongs to. The second parameter is a generic pointer to the object or an iterator pointing to the position of the object in the container of a scene. Precondition: the object belongs to the scene (is in the container of the scene).
Note that you cannot use a pointer to a copy of the object.
The following example program demonstrates the setting of individual object attributes in an update member function of an update class:

#include <LEDA/graphics/geowin.h>
#include <LEDA/geo/rat_geo_alg.h>

using namespace leda;

class attr_update : public geowin_update<list<rat_point>, list<rat_circle> >  
{
 void update(const list<rat_point>& L, list<rat_circle>& C)
 {
  GeoWin* GW_ptr = GeoWin::get_call_geowin(); 
  GeoBaseScene<list<rat_circle> >* aec = 
   (GeoBaseScene<list<rat_circle> >*) GeoWin::get_call_scene();
  
  C.clear();
  if (! L.empty()) {
    ALL_EMPTY_CIRCLES(L,C);

    // now set some attributes
    list<rat_circle>::iterator it = C.begin();
    int cw=0;
    for(;it!=C.end();it++) { 
      GW_ptr->set_obj_fill_color(aec,it,color(cw % 15)); 
      GW_ptr->set_obj_color(aec,it,color(cw % 10));     
      cw++;
    }
  } 
 }
};

int main()
{
  GeoWin GW("All empty circles - object attribute test");
  
  list<rat_point> L;
  geo_scene input =  GW.new_scene(L); 
  GW.set_point_style(input, disc_point);

  attr_update aec_help;
  geo_scene aec = GW.new_scene(aec_help, input, string("All empty circles")); 
  
  GW.set_all_visible(true);
  GW.edit(input); 
  return 0;  
}

template <class T>
color GW.get_obj_color(GeoBaseScene<T>* sc, void* adr)
    returns the boundary color of the object at (*adr).

template <class T>
color GW.get_obj_color(GeoBaseScene<T>* sc, typename T::iterator it)
    returns the boundary color of the object it points to.

template <class T>
color GW.set_obj_color(GeoBaseScene<T>* sc, void* adr, color c)
    sets the boundary color of the object at (*adr) to c.

template <class T>
color GW.set_obj_color(GeoBaseScene<T>* sc, typename T::iterator it, color c)
    sets the boundary color of the object it points to to c.

template <class T>
bool GW.get_obj_color(GeoBaseScene<T>* sc, const typename T::value_type& obj, color& c)
    if there is an object o in the container of scene sc with o = = obj the boundary color of o is assigned to c and true is returned. Otherwise false is returned.

template <class T>
bool GW.set_obj_color(GeoBaseScene<T>* sc, const typename T::value_type& obj, color c, bool all=true)
    if there is an object o in the container of scene sc with o = = obj the boundary color of o is set to c and true will be returned. Otherwise false will be returned.

template <class T>
color GW.get_obj_fill_color(GeoBaseScene<T>* sc, void* adr)
    returns the interior color of the object at (*adr).

template <class T>
color GW.set_obj_fill_color(GeoBaseScene<T>* sc, void* adr, color c)
    sets the interior color of the object at (*adr) to c.

template <class T>
bool GW.get_obj_fill_color(GeoBaseScene<T>* sc, const typename T::value_type& obj, color& c)
    if there is an object o in the container of scene sc with o = = obj the interior color of o is assigned to c and true is returned. Otherwise false is returned.

template <class T>
bool GW.set_obj_fill_color(GeoBaseScene<T>* sc, const typename T::value_type& obj, color c, bool all=true)
    if there is an object o in the container of scene sc with o = = obj the interior color of o is set to c and true will be returned. Otherwise false will be returned.

template <class T>
line_style GW.get_obj_line_style(GeoBaseScene<T>* sc, void* adr)
    returns the line style of the object at (*adr).

template <class T>
line_style GW.set_obj_line_style(GeoBaseScene<T>* sc, void* adr, line_style l)
    sets the line style of the object at (*adr) to l.

template <class T>
bool GW.get_obj_line_style(GeoBaseScene<T>* sc, const typename T::value_type& obj, line_style& l)
    if there is an object o in the container of scene sc with o = = obj the line style of o is assigned to l and true is returned. Otherwise false is returned.

template <class T>
bool GW.set_obj_line_style(GeoBaseScene<T>* sc, const typename T::value_type& obj, line_style l, bool all=true)
    if there is an object o in the container of scene sc with o = = obj the line style of o is set to l and true will be returned. Otherwise false will be returned.

template <class T>
int GW.get_obj_line_width(GeoBaseScene<T>* sc, void* adr)
    returns the line width of the object at (*adr).

template <class T>
int GW.set_obj_line_width(GeoBaseScene<T>* sc, void* adr, int w)
    sets the line width of the object at (*adr) to w.

template <class T>
bool GW.get_obj_line_width(GeoBaseScene<T>* sc, const typename T::value_type& obj, int& l)
    if there is an object o in the container of scene sc with o = = obj the line width of o is assigned to l and true is returned. Otherwise false is returned.

template <class T>
bool GW.set_obj_line_width(GeoBaseScene<T>* sc, const typename T::value_type& obj, int l, bool all=true)
    if there is an object o in the container of scene sc with o = = obj the line width of o is set to l and true will be returned. Otherwise false will be returned.

template <class T>
string GW.get_obj_label(GeoBaseScene<T>* sc, void* adr)
    returns the label of the object at (*adr).

template <class T>
string GW.get_obj_label(GeoBaseScene<T>* sc, typename T::iterator it)
    returns the label of the object it points to.

template <class T>
string GW.set_obj_label(GeoBaseScene<T>* sc, void* adr, string lb)
    sets the label of the object at (*adr) to lb.

template <class T>
string GW.set_obj_label(GeoBaseScene<T>* sc, typename T::iterator it, string lb)
    sets the label of the object it points to to lb.


Object texts
The following operations can be used to add/retrieve objects of type geowin_text to objects in scenes. The class geowin_text is used to store graphical representations of texts. It stores a string (the text) and the following attributes:

Name Type Description
font_type geowin_font_type font type
size double font size
text_color color color of the text
user_font string font name (if font_type = user_font)
x_offset double offset in x-direction to drawing position
y_offset double offset in y-direction to drawing position

The enumeration type geowin_font_type has the following set of integral constants: roman_font, bold_font, italic_font, fixed_font and user_font.
The class geowin_text has the following constructors:

    
    geowin_text(string t, double ox, double oy, geowin_font_type ft, 
                double sz, string uf, color c = black);
    geowin_text(string t, geowin_font_type ft, double sz);
    geowin_text(string t);
The arguments are: t - the text, ox,oy - the x/y offsets, ft - the font type, sz - the font size, uf - the user font and c - the text color. If a text is associated with an object, it will be drawn centered at the center of the bounding box of the object translated by the x/y - offset parameters. Note that it is also possible to add texts to a whole scene and to instances of class GeoWin. Then the x/y - offset parameters specify the position (see add_text operation).

template <class T>
bool GW.get_obj_text(GeoBaseScene<T>* sc, void* adr, geowin_text& gt)
    Gets the text associated with the object at adr in the container of scene sc and assigns it to gt. If no text is associated with the object, false will be returned, otherwise true.

template <class T>
bool GW.get_obj_text(GeoBaseScene<T>* sc, typename T::iterator it, geowin_text& gt)
    Gets the text associated with the object it points to and assigns it to gt. If no text is associated with the object, false will be returned, otherwise true.

template <class T>
void GW.set_obj_text(GeoBaseScene<T>* sc, void* adr, const geowin_text& gt)
    Assigns gt to the object at adr in scene sc.

template <class T>
void GW.set_obj_text(GeoBaseScene<T>* sc, typename T::iterator it, const geowin_text& gt)
    Assigns gt to the object it points to in scene sc.

template <class T>
void GW.reset_obj_attributes(GeoBaseScene<T>* sc)
    deletes all individual attributes of objects in scene (*sc).


d) Input and Output Operations

void GW.read(geo_scene sc, istream& is)
    reads the contents of sc from input stream is. Before the contents of sc is cleared.

void GW.write(geo_scene sc, ostream& os)
    writes the contents of sc to output stream os.

void GW.write_active_scene(ostream& os)
    writes the contents of the active scene of GW to output stream os.


e) View Operations

void GW.zoom_up() The visible range is reduced to the half.

void GW.zoom_down() The visible range is doubled.

void GW.fill_window() changes window coordinate system, so that the objects of the currently active scene fill the window.

void GW.reset_window() resets the visible range to the values that where current when constructing GW.


f) Parameter Operations
The following operations allow the set and retrieve the various parameters of GeoWin.

string GW.get_bg_pixmap() returns the name of the current background pixmap.

string GW.set_bg_pixmap(string pix_name)
    changes the window background pixmap to pixmap with name pix_name. Returns the name of the previous background pixmap.

color GW.get_bg_color() returns the current background color.

color GW.set_bg_color(const color& c)
    sets the background color to c and returns its previous value.

color GW.get_user_layer_color() returns the current color of the user layer.

color GW.set_user_layer_color(const color& c)
    sets the user layer color to c and returns its previous value.

int GW.get_user_layer_line_width()
    returns the current line width of the user layer.

int GW.set_user_layer_line_width(int lw)
    sets the user layer line width to lw and returns its previous value.

bool GW.get_show_grid() returns true, if the grid will be shown, false otherwise.

bool GW.set_show_grid(bool sh) sets the show grid flag to sh and returns the previous value.

double GW.get_grid_dist() returns the grid width parameter.

double GW.set_grid_dist(double g)
    sets the grid width parameter to g and returns the previous value.

grid_style GW.get_grid_style() returns the grid style parameter.

grid_style GW.set_grid_style(grid_style g)
    sets the grid style parameter to g and returns the previous value.

bool GW.get_show_position() returns true, if the mouse position will be shown, false otherwise.

bool GW.set_show_position(bool sp)
    sets the show position flag to sp and returns the previous value.

The following operations set or return various parameters that are used in the three-dimensional output of GeoWin. The three-dimensional output can be started by pressing the Show D3 Output button in the Window menu.

bool GW.get_d3_elimination() returns true, if elimination of hidden lines in the 3d-output mode is enabled, false otherwise.

bool GW.set_d3_elimination(bool b)
    sets the d3_elimination flag of GW to b and returns its previous value.

bool GW.get_d3_solid() return true, if faces in the 3d-output mode have to be drawn in different grey scales, false otherwise.

bool GW.set_d3_solid(bool b) sets the d3_solid flag of GW to b and returns its previous value.

bool GW.get_d3_show_edges() returns true, if the redraw of edges is enabled in the 3d-output mode, false otherwise.

bool GW.set_d3_show_edges(bool b)
    sets the d3_show_edges flag of GW to b and returns its previous value.


g) Handling of events

GeoWin provides operations for changing its default handling of events. As in GraphWin (cf. Section Graph Windows) the user can define what action should follow a mouse or key event. Constants are defined as in GraphWin :

and can be combined with OR ( ).

void GW.set_action(long mask, geo_action f=0)
    set action on condition mask to f. geo_action is a function of type void (*)(GeoWin&, const point&). For f == 0 the corresponding action is deleted.

geo_action GW.get_action(long mask) get action defined for condition mask.

void GW.reset_actions() set all actions to their default values.


Default values are defined as follows :

void GW.clear_actions() clears all actions.


Scene events

The following event handling functions can be set for edit scenes:

The add handlers will be called when a user tries to add an object to an edit scene in GeoWin, the delete handlers will be called when the user tries to delete an object and the change handlers will be called when the user tries to change an object (for instance by moving it). The templated set operations for setting handlers uses member templates. If your compiler does not support member templates, you should use instead the templated functions geowin_set_HANDLER, where HANDLER is one the following handlers. All handling functions get as the first parameter a reference to the GeoWin, where the scene belongs to.

template <class T,class F>
bool GW.set_pre_add_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called before an object is added to (*sc). handler must have type bool (*handler)(GeoWin&, const T::value_type &). handler gets a reference to the added object. If handler returns false, the object will not be added to the scene.

template <class T,class F>
bool GW.set_post_add_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called after an object is added to (*sc). handler must have type void (*handler)(GeoWin&, const T::value_type &). handler gets a reference to the added object.

template <class T,class F>
bool GW.set_pre_del_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called before an object is deleted from (*sc). handler must have type bool (*handler)(GeoWin&, const T::value_type &). handler gets a reference to the added object. If handler returns true, the object will be deleted, if handler returns false, the object will not be deleted.

template <class T,class F>
bool GW.set_post_del_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called after an object is deleted from (*sc). handler must have type void (*handler)(GeoWin&, const T::value_type &).

template <class T,class F>
bool GW.set_start_change_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called when a geometric object from (*sc) starts changing (for instance when you move it or rotate it). handler must have type bool (*handler)(GeoWin&, const T::value_type &). The handler function gets a reference to the object.

template <class T,class F>
bool GW.set_pre_move_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called before every move operation. handler must have type bool (*handler)(GeoWin&, const T::value_type &, double x, double y). The handler gets as the second parameter a reference to the object, as the third parameter and fourth parameter the move vector. If the handler returns true, the change operation will be executed, if the handler returns false, it will not be executed.

template <class T,class F>
bool GW.set_post_move_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called after every move operation. handler must have type void (*handler)(GeoWin&, const T::value_type &, double x, double y). The handler gets as the second parameter a reference to the object, as the third parameter and fourth parameter the move vector.

template <class T,class F>
bool GW.set_pre_rotate_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called before every rotate operation. handler must have type bool (*handler)(GeoWin&, const T::value_type &, double x, double y, double a). If the handler returns true, the rotate operation will be executed, if the handler returns false, it will not be executed.

template <class T,class F>
bool GW.set_post_rotate_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called after every rotate operation. handler must have type void (*handler)(GeoWin&, const T::value_type&, double x, double x, double a).

template <class T,class F>
bool GW.set_end_change_handler(GeoEditScene<T>* sc, F handler)
    sets the handler that is called when a geometric object from (*sc) ends changing. handler gets the object as the second parameter. handler must have type void (*handler)(GeoWin&, const T::value_type &).


Generator functions: The following operation can be used to set a generator function for an edit scene. The operation uses member templates. If your compiler does not support member templates, you should use instead the templated function geowin_set_generate_fcn.

template <class T>
bool GW.set_generate_fcn(GeoEditScene<T>* sc, void (*f)(GeoWin& gw, T& L))
    sets the generator function for edit scene (*sc). The function gets the GeoWin where (*sc) belongs to and a reference to the container L of (*sc). The function should write the generated objects to L.


Editing of objects in a scene: It is possible to edit single objects in an editable scene. For this purpose an edit_object - function can be set for editable scenes. This function has type

void (*f)(GeoWin& gw, T& obj, int nr)

where gw is the GeoWin-object where the scene belongs to, obj is a reference to the object that will be edited and nr is the edit mode of the scene.

template <class T,class T2>
bool GW.set_edit_object_fcn(GeoEditScene<T>* sc, T2 f)
    sets the edit object - function of scene sc to f.

template <class T>
void* GW.get_edit_object_fcn(GeoEditScene<T>* sc)
    returns the edit object - function of scene sc .


Transformation objects:

GeoWin supports affine transformations of selected objects in editable scenes for the LEDA rat- and float-kernel classes. The used transformation classes are rat_transform and transform respectively. The following class templates can be used to instantiate transformation objects. They are derived from type geowin_transform.

 geowin_gui_rat_transform<KERNEL_CLASS> 
 geowin_gui_transform<KERNEL_CLASS>
where KERNEL_CLASS is a class of the LEDA rat- or float-kernel. The default is that no transformation objects are associated with editable scenes.

template <class S,class GeoObj>
void GW.set_transform(GeoEditScene<S>* sc, geowin_transform<GeoObj>& trans)
    makes trans the transformation object of edit scene sc.


Input objects: The following operation can be used to set an input object for an edit scene. The operation uses member templates. If your compiler does not support member templates, you should use instead the templated functions prefixed with geowin. A GeoInputObject< GeoObjtex2html_wrap_inline> has the following virtual functions:

void operator()(GeoWin& gw, list<GeoObj>& L);

This virtual function is called for the input of objects. The new objects have to be returned in L.

void options(GeoWin& gw);

This function is called for setting options for the input object.

template <class T>
bool GW.set_input_object(GeoEditScene<T>* sc, const GeoInputObject<typename T::value_type>& obj, string name)
    sets the input object obj for edit scene (*sc). The function gets the GeoWin where (*sc) belongs to and a reference to a list L. The function must write the new objects to L.

template <class T>
bool GW.add_input_object(GeoEditScene<T>* sc, const GeoInputObject<typename T::value_type>& obj, string name)
    adds the input object obj to the list of available input objects of edit scene (*sc) without setting obj as input object.

template <class T>
void GW.set_draw_object_fcn(GeoBaseScene<T>* sc, window& (*fcn)(window& , const typename T::value_type& , int w))
    sets a function fcn for scene (*sc) that will be called for drawing the objects of scene (*sc). If no such function is set (the default), the output operator is used.

void GW.set_activate_handler(geo_scene sc, void (*f)(geo_scene))
    sets a handler function f that is called with sc as parameter when the user activates sc.

void GW.set_edit_loop_handler(bool (*f)(const GeoWin& gw))
    sets a handler function f that is called periodically in the interactive mode. If this handler returns true, we will leave the interactive mode.

void GW.set_quit_handler(bool (*f)(const GeoWin& gw))
    sets a handler function f that is called when the user clicks the quit menu button. f should return true for allowing quiting, false otherwise.

void GW.set_done_handler(bool (*f)(const GeoWin& gw))
    sets a handler function f that is called when the user clicks the done menu button. f should return true for allowing quiting, false otherwise.

int GW.set_edit_mode(geo_scene sc, int emode)
    sets the edit mode of scene sc to emode.

int GW.get_edit_mode(geo_scene sc)
    return the edit mode of scene sc.


h) Scene group Operations
GeoWin can manage scenes in groups. It is possible to add and remove scenes to/from groups. Various parameters and dependences can be set for whole groups. Note that geo_scenegroup is a pointer to a scene group.

geo_scenegroup GW.new_scenegroup(string name)
    Creates a new scene group with name name and returns a pointer to it.

geo_scenegroup GW.new_scenegroup(string name, const list<geo_scene>& LS)
    Creates a new scene group name and adds the scenes in LS to this group.

void GW.insert(geo_scenegroup gs, geo_scene sc)
    adds sc to scene group gs .

bool GW.del(geo_scenegroup gs, geo_scene sc)
    removes sc from scene group gs and returns true, if the operation was succesful (false: sc was not in gs).


i) Further Operations

int GW.set_button_width(int w)
    sets the width of the scene visibility buttons in GW and returns the previous value.

int GW.set_button_height(int h)
    sets the height of the scene visibility buttons in GW and returns the previous value.


You can associate a) buttons with labels or b) bitmap buttons with the visibility of a scene in GeoWin. You cannot use a) and b) at the same time. The following operations allow you to use add such visibility buttons to GeoWin. Note that before setting bitmap buttons with the set_bitmap operation you have to set the button width and height.

void GW.set_label(geo_scene sc, string label)
    associates a button with label label with the visibility of scene sc.

void GW.set_bitmap(geo_scene sc, unsigned char* bitmap)
    associates a button with bitmap bitmap with the visibility of scene sc.

void GW.add_scene_buttons(const list<geo_scene>& Ls, const list<string>& Ln)
    add a multiple choice panel for visibility of the scenes in Ls to GW. The button for the n-th scene in Ls gets the n-th label in Ln.

void GW.add_scene_buttons(const list<geo_scene>& Ls, int w, int h, unsigned char** bm)
    add a multiple choice panel for visibility of the scenes in Ls to GW. The button for the n-th scene in Ls gets the n-th bitmap in bm. The bitmaps have width w and height h.

list<geo_scene> GW.get_scenes() returns the scenes of GW.

list<geo_scenegroup> GW.get_scenegroups() returns the scene groups of GW.

list<geo_scene> GW.get_scenes(geo_scenegroup gs)
    returns the scenes of group gs.

list<geo_scene> GW.get_visible_scenes() returns the visible scenes of GW.

void GW.add_dependence(geo_scene sc1, geo_scene sc2)
    makes sc2 dependent from sc1. That means that sc2 will be updated when the contents of sc1 changes.

void GW.del_dependence(geo_scene sc1, geo_scene sc2)
    deletes the dependence of scene sc2 from sc1.

void GW.set_frame_label(const char* label)
    makes label the frame label of GW.

int GW.open_panel(panel& P) displays panel P centered on the drawing area of GW, disabels the menu bar of GW and returns the result of P.open().

void GW.add_text(const geowin_text& gt)
    adds a text gt to GW.

void GW.remove_texts() removes all texts from GW (but not from the scenes of GW).

void GW.add_text(geo_scene sc, const geowin_text& gt)
    adds a text gt to scene sc.

void GW.remove_texts(geo_scene sc)
    removes all texts from scene sc.

void GW.enable_menus() enables the menus of GW.

void GW.disable_menus() disables the menus of GW, but not the User menu.

double GW.version() returns the GeoWin version number.

void GW.message(string msg) displays message msg on top of the drawing area. If msg is the empty string, a previously written message is deleted.

void GW.msg_open(string msg) displays message msg in the message window of GW . If the message window is not open, it will be opened.

void GW.msg_close() closes the message window.

void GW.msg_clear() clears the message window.

void GW.set_d3_fcn(geo_scene sc, void (*f)(geo_scene gs, d3_window& W, GRAPH<d3_point,int>& H))
    sets a function for computing 3d output. The parameters of the function are the geo_scene for that it will be set and a function pointer. The function f will get the scene for that it was set and the reference to a d3_window that will be the output window.

D3_FCN GW.get_d3_fcn(geo_scene sc)
    returns the function for computing 3d output that is set for scene sc. The returned function has pointer type void (*)(geo_scene, d3_window&, GRAPH<d3_point,int>&).


GeoWin can be pined at a point in the plane. As standard behavior it is defined that moves of geometric objects will be rotations around the pin point.

bool GW.get_pin_point(point& p)
    returns the pin point in p if it is set.

void GW.set_pin_point(point p)
    sets the pin point to p.

void GW.del_pin_point() deletes the pin point.

void GW.add_help_text(string name)
    adds the help text contained in name.hlp with label name to the help menu of the main window. The file name.hlp must exist either in the current working directory or in $LEDAROOT/incl/Help. Note that this operation must be called before gw.display().

void GW.add_special_help_text(string name, bool auto_display = false)
    adds one help text contained in name.hlp to the menu of the main window. The file name.hlp must exist either in the current working directory or in $LEDAROOT/incl/Help. Note that this operation must be called before gw.display(). If auto_display is true, this help text will be displayed, when the main window is displayed.

template <class T>
int GW.get_limit(GeoEditScene<T> *es)
    returns the limit of edit scene es (a negative number will be returned, if there is no limit).

template <class T>
int GW.set_limit(GeoEditScene<T> *es, int limit)
    sets the limit of edit scene es to limit and returns the previous value.


The templated add_user_call operation uses member templates. If your compiler does not support member templates, you should use instead the templated function geowin_add_user_call with GW as an additional first parameter.

template <class F>
void GW.add_user_call(string label, F f)
    adds a menu item label to the "User" menu of GW. The user defined function void geo_call(GeoWin&, F, string) is called whenever this menu button was pressed with parameters GW, f and label. This menu definition has to be finished before GW is opened.

Import- and export objects can be used to import and export the contents of scenes in various formats.
The classes geowin_import and geowin_export are used for implementing import- and export objects. The classes geowin_import and geowin_export have virtual () - operators:

virtual void operator()(geo_scene sc, string filename)

This virtual operator can be overwritten in derived classes to provide import and export functionality for own formats. The first parameter is the scene sc that will be used as source for the output or target for the input. The second parameter filename is the name of the input (import objects) or output (export objects) file.

void GW.add_import_object(geo_scene sc, geowin_import& io, string name, string desc)
    Adds an import object io to scene sc. The import object gets the name name and the description desc.

void GW.add_export_object(geo_scene sc, geowin_export& eo, string name, string desc)
    Adds an export object eo to scene sc. The export object gets the name name and the description desc.


4. Non-Member Functions

GeoWin* get_geowin(geo_scene sc) returns a pointer to the GeoWin of sc.

template <class CONTAINER>
bool get_objects(geo_scene sc, CONTAINER& c)
    If the contents of scene sc matches type CONTAINER, then the contents of scene sc is copied to c.


next up previous contents index
Next: Windows for 3d visualization Up: Graphics Previous: The GraphWin (GW) File   Contents   Index
root 2008-01-09