v2.0.0
Loading...
Searching...
No Matches
selectionscene.cpp
Go to the documentation of this file.
1//=============================================================================================================
14
15//=============================================================================================================
16// INCLUDES
17//=============================================================================================================
18
19#include "selectionscene.h"
20#include "selectionsceneitem.h"
21
22#include <fiff/fiff_types.h>
23
24//=============================================================================================================
25// QT INCLUDES
26//=============================================================================================================
27
28#include <QGraphicsScene>
29#include <QWidget>
30#include <QMutableListIterator>
31
32//=============================================================================================================
33// EIGEN INCLUDES
34//=============================================================================================================
35
36//=============================================================================================================
37// USED NAMESPACES
38//=============================================================================================================
39
40using namespace DISPLIB;
41
42//=============================================================================================================
43// DEFINE MEMBER METHODS
44//=============================================================================================================
45
46SelectionScene::SelectionScene(QGraphicsView* view, QObject* parent)
47: LayoutScene(view, parent)
49{
50}
51
52//=============================================================================================================
53
54void SelectionScene::repaintItems(const QMap<QString,QPointF> &layoutMap, QStringList badChannels)
55{
56 this->clear();
57
58 QMapIterator<QString,QPointF > i(layoutMap);
59 while (i.hasNext()) {
60 i.next();
61 SelectionSceneItem* SelectionSceneItemTemp;
62
63 if(i.key().contains("EEG"))
64 SelectionSceneItemTemp = new SelectionSceneItem(i.key(),
65 0,
66 i.value(),
69 Qt::blue,
70 badChannels.contains(i.key()));
71 else
72 SelectionSceneItemTemp = new SelectionSceneItem(i.key(),
73 0,
74 i.value(),
77 Qt::blue,
78 badChannels.contains(i.key()));
79
80 this->addItem(SelectionSceneItemTemp);
81 }
82}
83
84//=============================================================================================================
85
86void SelectionScene::hideItems(QStringList visibleItems)
87{
88 //Hide all items which names are in the the string list visibleItems. All other items' opacity is set to 0.25 an dthey are no longer selectable.
89 QList<QGraphicsItem *> itemList = this->items();
90
91 for(int i = 0; i<itemList.size(); i++) {
92 SelectionSceneItem* item = static_cast<SelectionSceneItem*>(itemList.at(i));
93
95 item->show();
96
97 if(!visibleItems.contains(item->m_sChannelName)) {
98 item->setFlag(QGraphicsItem::ItemIsSelectable, false);
99 item->setOpacity(0.25);
100 }
101 else {
102 item->setFlag(QGraphicsItem::ItemIsSelectable, true);
103 item->setOpacity(1);
104 }
105 }
106 else
107 item->hide();
108 }
109}
110
Channel-selection group descriptor (SelectionItem) and the matching QGraphicsItem (SelectionSceneItem...
QGraphicsScene of the sensor-layout dots used by ChannelSelectionView for interactive channel picking...
#define FIFFV_EEG_CH
#define FIFFV_MEG_CH
#define FIFF_UNIT_T_M
Primitive scalar typedefs and forward-compatible aliases backing the FIFF type system.
2-D display widgets and visualisation helpers (charts, topography, colour maps).
LayoutScene(QGraphicsView *view, QObject *parent=0)
void repaintItems(const QMap< QString, QPointF > &layoutMap, QStringList badChannels)
SelectionScene(QGraphicsView *view, QObject *parent=0)
void hideItems(QStringList visibleItems)
Graphics item representing a selectable electrode or channel in a 2-D layout scene.