Algorithmic Solutions > LEDA > LEDA Guide > GeoWin > Programming Interface > Result Scenes and Update Objects

GeoWin Result Scenes and Update Objects

As an alternative for update functions GeoWin provides update objects for Result Scenes.

Why Both Update Functions and Update Objects?

Update functions are quite easy to use and sufficient in many situations. However, there are also disadvantages:

  • In more complex applications the update function might need additional information. This can only be done with global variables.
  • Not all compilers support member template functions that are used for update functions in GeoWin result scenes. Users of MSVC++ 6, for example, cannot use update functions for this reason.

Update objects allow you to provide additional data and do not use member template functions.

Using Update Objects

The class template for update objects is geowin_update<I,R> where I is the container of the input scene and R is the container of the result scene.

On the right you see a screenshot of an Example for Result Scenes and Update Objects.

It is possible to define a new update object by deriving from the base type and overwriting the virtual update function of the base class

    void update(const I& input, R& output);

with your own update functionality.

Example of GeoWin Update Objects

Example Update Objects

Alternatively, you can use one of the following constructors of geowin_update<I,R> to provide your update function.
    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));
The first version simply uses an update function as described on Edit and Result Scenes as the parameter of the constructor. The second and the third variant use an update function that returns an object obj of the value type of the container of the result scene; in the second variant as a reference and in the third as a return value.

See also:

Programming Interface

GeoWin

Edit and Result Scenes

Interactive Interface


Linear Lists

Data Types for 2D Geometry


Manual Pages:

Manual Page GraphWin




Please send any suggestions, comments or questions to leda@algorithmic-solutions.com
© Copyright 2001-2003, Algorithmic Solutions Software GmbH