31.01.2014 Views

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

Version 5.0 The LEDA User Manual

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

eturn 0;<br />

}<br />

template <br />

void GW.set update(geo scene res, geowin update& up)<br />

makes up the update object of res. Precondition: res<br />

points to a scene of type GeoResultScene .<br />

template <br />

void GW.set update(geo scene res, void (∗f update)(const S& , R& ))<br />

makes f update the update function of res.<br />

Precondition: res points to a scene of type<br />

GeoResultScene .<br />

template <br />

GeoResultScene∗ GW.new scene(geowin update& up, geowin redraw& rd,<br />

geo scene sc input, string str,<br />

D3 FCN f = NULL)<br />

creates a new result scene with name str. <strong>The</strong> input<br />

scene for this new result scene will be sc input. <strong>The</strong><br />

update object will be ub. <strong>The</strong> redraw object will be<br />

rd.<br />

<strong>The</strong> third variant of the example program uses an update and redraw object. We provide<br />

a user defined class for update and redraw of the result scene.<br />

#include <br />

#include <br />

using namespace leda;<br />

class hull_update_redraw : public geowin_update ,<br />

public geowin_redraw<br />

{<br />

list polys;<br />

public:<br />

void update(const list& L, list& P)<br />

{<br />

polys.clear();<br />

polys.append(CONVEX_HULL_POLY(L));<br />

}<br />

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

{<br />

polygon piter;<br />

segment seg;<br />

forall(piter, polys){<br />

forall_segments(seg, piter){<br />

W.draw_arrow(seg, c1);<br />

}<br />

}

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!