MNE-CPP  beta 1.0
selectionscene.cpp
1 //=============================================================================================================
37 //*************************************************************************************************************
38 //=============================================================================================================
39 // INCLUDES
40 //=============================================================================================================
41 
42 #include "selectionscene.h"
43 
44 
45 //*************************************************************************************************************
46 //=============================================================================================================
47 // USED NAMESPACES
48 //=============================================================================================================
49 
50 using namespace XDISPLIB;
51 using namespace std;
52 
53 
54 //*************************************************************************************************************
55 //=============================================================================================================
56 // DEFINE MEMBER METHODS
57 //=============================================================================================================
58 
59 SelectionScene::SelectionScene(QGraphicsView* view, QObject* parent)
60 : LayoutScene(view, parent)
61 , m_iChannelTypeMode(FIFFV_MEG_CH)
62 {
63 }
64 
65 
66 //*************************************************************************************************************
67 
68 void SelectionScene::repaintItems(const QMap<QString,QPointF> &layoutMap)
69 {
70  this->clear();
71 
72  QMapIterator<QString,QPointF > i(layoutMap);
73  while (i.hasNext()) {
74  i.next();
75  SelectionSceneItem* SelectionSceneItemTemp;
76 
77  if(i.key().contains("EEG"))
78  SelectionSceneItemTemp = new SelectionSceneItem(i.key(),
79  0,
80  i.value(),
81  FIFFV_EEG_CH,
83  else
84  SelectionSceneItemTemp = new SelectionSceneItem(i.key(),
85  0,
86  i.value(),
87  FIFFV_MEG_CH,
89 
90  this->addItem(SelectionSceneItemTemp);
91  }
92 }
93 
94 
95 //*************************************************************************************************************
96 
97 void SelectionScene::hideItems(QStringList visibleItems)
98 {
99  //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.
100  QList<QGraphicsItem *> itemList = this->items();
101 
102  for(int i = 0; i<itemList.size(); i++) {
103  SelectionSceneItem* item = static_cast<SelectionSceneItem*>(itemList.at(i));
104 
105  if(item->m_iChannelKind == m_iChannelTypeMode) {
106  item->show();
107 
108  if(!visibleItems.contains(item->m_sChannelName)) {
109  item->setFlag(QGraphicsItem::ItemIsSelectable, false);
110  item->setOpacity(0.25);
111  }
112  else {
113  item->setFlag(QGraphicsItem::ItemIsSelectable, true);
114  item->setOpacity(1);
115  }
116  }
117  else
118  item->hide();
119  }
120 }
121 
122 
void hideItems(QStringList visibleItems)
void repaintItems(const QMap< QString, QPointF > &layoutMap)
#define FIFF_UNIT_T_M
The LayoutScene class provides a reimplemented QGraphicsScene for 2D layout plotting. This class handles all the user interaction features (subclass in order to use).
Definition: layoutscene.h:81
The SelectionSceneItem class provides a new data structure for visualizing channels in a 2D layout...
SelectionScene(QGraphicsView *view, QObject *parent=0)