6 #include <QGraphicsScene> 19 QGraphicsItem* parent)
20 : QGraphicsItemGroup(parent),
23 stack(), stack_watermark(0),
24 palette(apalette), itemPool()
26 LINE_PEN = QPen(Qt::black,pen_width,Qt::SolidLine,Qt::FlatCap);
33 foreach(QGraphicsItem* item, childItems())
40 return new QGraphicsLineItem(
this);
47 removeFromGroup(item);
48 scene()->removeItem(item);
49 itemPool.append((QGraphicsLineItem*)item);
60 gval =
grid->hor().map(ival);
62 gval =
grid->vert().map(ival);
68 line->setLine(
insert(bval));
69 line->setData(0,(
int)component);
82 for(frechet::k::IntervalMap::const_iterator i = mvals.begin(); i != mvals.end(); ++i)
97 foreach(QGraphicsItem* line, childItems())
99 size_t component = line->data(0).toUInt();
101 !resultSet || resultSet->
contains(component) ?
110 stack[row].insert(ival);
124 for(
int row=0; row <
stack.size(); ++row)
126 if (ival.lower()==ival.upper())
128 if (
stack[row].find(ival.lower()) ==
stack[row].end())
133 if (
stack[row].find(ival) ==
stack[row].end())
138 stack.push_back(boost::icl::interval_set<double>());
141 return stack.size()-1;
void add(const Interval &ival, size_t component)
add an interval
static const QColor LIGHT_GRAY
used for disabled components (k-Frechet)
boost::icl::continuous_interval< double > boost_ival
what's this?
global definitions for all algorithms.
std::vector< MappedInterval > IntervalMap
a vector of MappedInterval objects. Usually these are sorted according to the natural ordering impose...
Palette * palette
color palette
Orientation
orientation: horizontal or vertical
attaches a component ID to an interval
std::vector< boost_ivalset > stack
stack of intervals
void setItemColor(QGraphicsLineItem *item, QColor col)
update ttem color
double ROW_HEIGHT
height of a row
bool contains(int offset) const
int findRow(const boost_ival &ival)
place a new interval in a free space
void showResult(const frechet::data::BitSet *resultSet)
highlight result set of a k-Frechet algorithm. All intervals that are not part of the result set are ...
enum frechet::view::IntervalView::Orientation orientation
boost::shared_ptr< Grid > ptr
smart pointer to a Grid object
QQueue< QGraphicsLineItem * > itemPool
pool of unused QGraphicsItems
int stack_watermark
stack watermark
void addAll(const k::IntervalMap &mvals)
add a set of intervals
A simple bit vector of fixed size.
void releaseItem(QGraphicsItem *)
release item
QGraphicsLineItem * createItem()
create a line item
QLineF insert(const boost_ival &ival)
insert an interval
QPen LINE_PEN
pen for drawing lines
an interval of two double values.
Grid::ptr grid
coordinate grid
void clear()
remove all intervals