Algorithmic Solutions > LEDA > LEDA Guide > Windows and Panels > Input and Output Operators

Input and Output Operators

For the input and output of basic two-dimensional geometric objects of the floating point kernel (point, segment, ray, line, circle, polygon) the operators << and >> can be used.

Remarks: Graphical input and output of for windows can be extended to user-defined types by overloading << and >>.

The window class also provides a large number of additional drawing operations that give more flexibility.

Example

The following program uses the operator >> to read points defined by mouse clicks and draws each point using the operator << until input is terminated by clicking the right mouse button.

On the right there is a screenshot of the program. Clicking on the picture shows the window in original size.

Picture of Convex Hull
#include <LEDA/graphics/window.h>
#include <LEDA/geo/point.h>

int main()
{
  leda::window W(400,400);
  W.display(leda::window::center, leda::window::center);

  leda::point p;
  while (W >> p) W << p;

  W.screenshot("io_operators");

  return 0;
}	

See also:

Basic Data Types for 2D Geometry

Windows and Panels

Drawing Operations


Manual Pages:

Manual Page Windows




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