MNE-CPP 0.1.9
A Framework for Electrophysiology
Loading...
Searching...
No Matches
selectionscene.cpp
Go to the documentation of this file.
1//=============================================================================================================
36//=============================================================================================================
37// INCLUDES
38//=============================================================================================================
39
40#include "selectionscene.h"
41#include "selectionsceneitem.h"
42
43#include <fiff/fiff_types.h>
44
45//=============================================================================================================
46// QT INCLUDES
47//=============================================================================================================
48
49#include <QGraphicsScene>
50#include <QWidget>
51#include <QMutableListIterator>
52
53//=============================================================================================================
54// EIGEN INCLUDES
55//=============================================================================================================
56
57//=============================================================================================================
58// USED NAMESPACES
59//=============================================================================================================
60
61using namespace DISPLIB;
62
63//=============================================================================================================
64// DEFINE MEMBER METHODS
65//=============================================================================================================
66
67SelectionScene::SelectionScene(QGraphicsView* view, QObject* parent)
68: LayoutScene(view, parent)
69, m_iChannelTypeMode(FIFFV_MEG_CH)
70{
71}
72
73//=============================================================================================================
74
75void SelectionScene::repaintItems(const QMap<QString,QPointF> &layoutMap, QStringList badChannels)
76{
77 this->clear();
78
79 QMapIterator<QString,QPointF > i(layoutMap);
80 while (i.hasNext()) {
81 i.next();
82 SelectionSceneItem* SelectionSceneItemTemp;
83
84 if(i.key().contains("EEG"))
85 SelectionSceneItemTemp = new SelectionSceneItem(i.key(),
86 0,
87 i.value(),
88 FIFFV_EEG_CH,
89 FIFF_UNIT_T_M,
90 Qt::blue,
91 badChannels.contains(i.key()));
92 else
93 SelectionSceneItemTemp = new SelectionSceneItem(i.key(),
94 0,
95 i.value(),
96 FIFFV_MEG_CH,
97 FIFF_UNIT_T_M,
98 Qt::blue,
99 badChannels.contains(i.key()));
100
101 this->addItem(SelectionSceneItemTemp);
102 }
103}
104
105//=============================================================================================================
106
107void SelectionScene::hideItems(QStringList visibleItems)
108{
109 //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.
110 QList<QGraphicsItem *> itemList = this->items();
111
112 for(int i = 0; i<itemList.size(); i++) {
113 SelectionSceneItem* item = static_cast<SelectionSceneItem*>(itemList.at(i));
114
116 item->show();
117
118 if(!visibleItems.contains(item->m_sChannelName)) {
119 item->setFlag(QGraphicsItem::ItemIsSelectable, false);
120 item->setOpacity(0.25);
121 }
122 else {
123 item->setFlag(QGraphicsItem::ItemIsSelectable, true);
124 item->setOpacity(1);
125 }
126 }
127 else
128 item->hide();
129 }
130}
131
Contains the declaration of the SelectionScene class.
Contains the declaration of the SelectionSceneItem class.
Definitions for describing the objects in a FIFF file.
The LayoutScene class provides a reimplemented QGraphicsScene for 2D layout plotting....
Definition layoutscene.h:82
void repaintItems(const QMap< QString, QPointF > &layoutMap, QStringList badChannels)
SelectionScene(QGraphicsView *view, QObject *parent=0)
void hideItems(QStringList visibleItems)