Fréchet View  1.6.0
A Tool for Exploring Fréchet Distance Algorithms
intervalview.h
Go to the documentation of this file.
1 #ifndef INTERVALVIEW_H
2 #define INTERVALVIEW_H
3 
4 #include <QGraphicsItemGroup>
5 #include <QQueue>
6 
7 #include <vector>
8 #include <boost/icl/interval_set.hpp>
9 
10 #include <palette.h>
11 #include <grid.h>
12 #include <components.h>
13 #include <k_frechet/kalgorithm.h>
14 
15 #include <QLineF>
16 #include <QPen>
17 
18 namespace frechet {
19 
20 using namespace fs;
21 using namespace data;
22 
23 namespace view {
24 
33 class IntervalView : public QGraphicsItemGroup
34 {
35 public:
37  enum Orientation { HORIZONTAL, VERTICAL } orientation;
39  double ROW_HEIGHT;
40 
41 private:
43  typedef boost::icl::interval_set<double> boost_ivalset;
45  typedef boost::icl::continuous_interval<double> boost_ival;
46 
50  std::vector<boost_ivalset> stack;
56  QQueue<QGraphicsLineItem*> itemPool;
58  QPen LINE_PEN;
59 
60 public:
70  Orientation orient,
71  Palette* palette,
72  double pen_width,
73  QGraphicsItem* parent=0);
75  void clear();
76 
82  void add(const Interval& ival, size_t component);
87  void add(const k::MappedInterval& mval);
92  void addAll(const k::IntervalMap& mvals);
93 
99  void showResult(const frechet::data::BitSet* resultSet);
100 
104  double extent() const {
105  return stack_watermark * ROW_HEIGHT;
106  }
107 
108 private:
114  QLineF insert(const boost_ival& ival);
120  int findRow(const boost_ival& ival);
121 
126  QGraphicsLineItem* createItem();
130  void releaseItem(QGraphicsItem*);
131 
137  void setItemColor(QGraphicsLineItem* item, QColor col);
138 };
139 
140 } } // namespace
141 
142 #endif // INTERVALVIEW_H
boost::icl::interval_set< double > boost_ivalset
set of intervals
Definition: intervalview.h:43
boost::icl::continuous_interval< double > boost_ival
what's this?
Definition: intervalview.h:45
global definitions for all algorithms.
std::vector< MappedInterval > IntervalMap
a vector of MappedInterval objects. Usually these are sorted according to the natural ordering impose...
Definition: kalgorithm.h:71
Palette * palette
color palette
Definition: intervalview.h:54
Orientation
orientation: horizontal or vertical
Definition: intervalview.h:37
Display k-Frechet intervals, i.e. projections of connected components to the domain axes.
Definition: intervalview.h:33
attaches a component ID to an interval
Definition: kalgorithm.h:32
std::vector< boost_ivalset > stack
stack of intervals
Definition: intervalview.h:50
double ROW_HEIGHT
height of a row
Definition: intervalview.h:39
a color map.
Definition: palette.h:17
boost::shared_ptr< Grid > ptr
smart pointer to a Grid object
Definition: grid.h:128
QQueue< QGraphicsLineItem * > itemPool
pool of unused QGraphicsItems
Definition: intervalview.h:56
int stack_watermark
stack watermark
Definition: intervalview.h:52
A simple bit vector of fixed size.
Definition: bitset.h:16
QPen LINE_PEN
pen for drawing lines
Definition: intervalview.h:58
an interval of two double values.
Definition: interval.h:31
Grid::ptr grid
coordinate grid
Definition: intervalview.h:48