next up previous contents index
Next: Implementations Up: Graphics Previous: Graph Windows ( GraphWin   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 manages the geometric objects in so called scenes. A scene contains a container storing geometric objects (the contents of the scene) and provides all operations that GeoWin needs to edit it. Every scene maintains a set of parameters:

There are three kinds of scenes:

  1. Basic Scenes

    The basic scene type GeoBaseScene<CONTAINER> works on every container type that provides an interface as the list of the STL library. More precisely, CONTAINER has to support the following type definitions and operations:

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

  2. Edit Scenes

    A scene of type GeoEditScene<CONTAINER> is a user editable scene. GeoWin is an editor for this kind of scenes.

  3. Result Scenes

    A scene of type GeoResultScene<I,R> is not independently editable. Instead its contents (a container of type R) is computed by a user defined update function or update object with an update function. The update function computes the contents of the result scene every time when another scene (the input scene for the result scene) changes. The update function void (*f_update)(const I& input, R& result) gets the contents of this input scene (a container input of type I) and computes the contents result of the result scene. We say that the result scene depends on its input scene.

Both Edit and Result scenes are derived from Basic scenes. 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.

Please note that the type geo_scene is the scene item type used in GeoWin. You can interpret them as pointers to scenes.

#include < LEDA/geowin.h >

Creation

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

GeoWin GW(double x, double y, const char* label = "GEOWIN")
    creates a GeoWin GW. GW is constructed with frame label label and physical size x x y.

Operations


a) Main Operations


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 an as 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 program 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 a 2d LEDA kernel type, a d3_point or a d3_rat_point.

GeoEditScene<CONTAINER>* GW.new_scene(CONTAINER& c, D3_FCN f = NULL)
    creates a new edit scene for c. c will be edited by GW.


The following new_scene operations can be used to create result scenes. Result scenes use the contents of another scene (the input scene) as the 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)

These functions (*f) will be called in the update function of the update object. The first 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 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.

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

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.

GeoResultScene<S,R>* GW.new_scene(void (*f_update)(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.

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.

void GW.set_update(geo_scene res, geowin_update<S,R>& up)
    makes up the update object of res.

void GW.set_update(geo_scene res, void (*f_update)(S, R& ))
    makes f_update the update function of res.

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.

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.

bool GW.get_objects(CONTAINER& c)
    If the contents of the current edit scene matches type CONTAINER, then the contents of this scene is copied to c.

bool GW.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.

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

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 when the Quit-Button was pressed, true otherwise.


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.


c) Scene and scene group Operations

void GW.destroy(geo_scene sc) removes scene sc from GW and destroys it.

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.

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


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. Precondition: the object belongs to the scene (is in the container of the scene).

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

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

bool GW.get_obj_color(GeoBaseScene<T>* sc, 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.

bool GW.set_obj_color(GeoBaseScene<T>* sc, 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 set to c and true will be returned. Otherwise false will be returned.

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

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

bool GW.get_obj_fill_color(GeoBaseScene<T>* sc, 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.

bool GW.set_obj_fill_color(GeoBaseScene<T>* sc, 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 set to c and true will be returned. Otherwise false will be returned.

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

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.

bool GW.get_obj_line_style(GeoBaseScene<T>* sc, 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.

bool GW.set_obj_line_style(GeoBaseScene<T>* sc, 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 set to l and true will be returned. Otherwise false will be returned.

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

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

bool GW.get_obj_line_width(GeoBaseScene<T>* sc, 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.

bool GW.set_obj_line_width(GeoBaseScene<T>* sc, 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 set to l and true will be returned. Otherwise false will be returned.

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.

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(color c) sets the background color to c and returns its previous value.


f) Handling of events

GeoWin provides operations for changing its default handling of events. As in GraphWin (cf. 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.

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.

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.

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.

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 &).

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.

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.

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.

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.

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

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.

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.


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< GeoObjtex2html_wrap_inline> & 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.

bool GW.set_input_object(GeoEditScene<T>* sc, GeoInputObject< 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.

bool GW.add_input_object(GeoEditScene<T>* sc, GeoInputObject< 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.

void GW.set_draw_object_fcn(GeoBaseScene<T>* sc, window& (*fcn)(window& , T::value_type ))
    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_quit_handler(bool (*f)(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)(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.


g) 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, list<geo_scene> LS)
    Cretes 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).


h) 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, char* bitmap)
    associates a button with bitmap bitmap with the visibility of scene sc.

void GW.add_scene_buttons(list<geo_scene> Ls, 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(list<geo_scene> Ls, int w, int h, 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.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().


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.

void GW.add_user_call(string label, F f)
    adds a menu item label to the "User" menu of GW. User defined function geo_call(GeoWin& gw, F f, string label) is called whenever this menu button was pressed. This menu definition has to be finished before GW is opened.


4. Non-Member Functions

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


next up previous contents index
Next: Implementations Up: Graphics Previous: Graph Windows ( GraphWin   Contents   Index
LEDA research project
2000-02-09