Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <QtGui>
#include <iostream>
#include "bsaccumulatorview.h"
using namespace std;
const int BSAccumulatorView::CELL_SIZE = 12;
BSAccumulatorView::BSAccumulatorView (BSDetector *sd)
{
int w = LineSpaceFilter::DEFAULT_NB_ANG_CELLS * CELL_SIZE;
int h = LineSpaceFilter::DEFAULT_NB_DIST_CELLS * CELL_SIZE;
setBackgroundBrush (QBrush (Qt::yellow));
setScene (new QGraphicsScene (0, 0, w, h));
grid = new BSAccumulatorItem (sd, w, h);
scene()->addItem (grid);
setWindowTitle (grid->isPrefilterDisplayed () ?
"Pre-filter accumulator" : "Final filter accumulator");
}
BSAccumulatorView::~BSAccumulatorView ()
{
scene()->removeItem (grid);
delete grid;
}
void BSAccumulatorView::paint (QPainter *painter,
const QStyleOptionGraphicsItem *option,
QWidget *widget)
{
Q_UNUSED (painter);
Q_UNUSED (option);
Q_UNUSED (widget);
}
bool BSAccumulatorView::processKeyEvent (QKeyEvent *event)
{
bool processed = false;
switch (event->key ())
{
case Qt::Key_I :
grid->switchAccumulator ();
setWindowTitle (grid->isPrefilterDisplayed () ?
"Pre-filter accumulator" : "Final filter accumulator");
processed = true;
break;
case Qt::Key_V :
grid->switchInfoDisplay ();
processed = true;
break;
case Qt::Key_S :
processed = grid->resizeAccumulator (
(event->modifiers () & Qt::ShiftModifier) == 0);
break;
case Qt::Key_R :
processed = grid->zoomAccumulator (
(event->modifiers () & Qt::ShiftModifier) == 0);
break;
processed = grid->subpixellise (
(event->modifiers () & Qt::ShiftModifier) != 0);
break;
case Qt::Key_F :
processed = grid->setFilterSelectivity (
(event->modifiers () & Qt::ShiftModifier) == 0);
break;
// viewport()->grab (
// QRect (QPoint (0, 0),
// QSize (grid->getWidth(), grid->getHeight()))
// ).toImage().save ("accu.png");
// cout << "Accumulator shot in capture.png" << endl;