OpenMS
|
A heuristic: Given a set of levels (rows), try to add items at to topmost row which does not overlap an already placed item in this row (according to its x-coordinate) More...
#include <OpenMS/VISUAL/MISC/GUIHelpers.h>
Public Member Functions | |
OverlapDetector (int levels) | |
size_t | placeItem (double x_start, double x_end) |
Private Attributes | |
std::vector< double > | rows_ |
store the largest x_end for each row More... | |
A heuristic: Given a set of levels (rows), try to add items at to topmost row which does not overlap an already placed item in this row (according to its x-coordinate)
If a collision occurs, try the row below. If no row is collision-free, pick the one with the smallest overlap.
Only positions beyond the largest x-coordinate observed so far are considered (i.e. gaps are not filled).
X-coordinates should always be positive (a warning is issued otherwise).
|
explicit |
C'tor: number of levels
must be >=1
Exception::InvalidSize | if levels <= 0 |
size_t placeItem | ( | double | x_start, |
double | x_end | ||
) |
try to put an item which spans from x_start
to x_end
in the topmost row possible
|
private |
store the largest x_end for each row