MNE-CPP  beta 1.0
sensorlayout.cpp
1 //=============================================================================================================
36 //*************************************************************************************************************
37 //=============================================================================================================
38 // INCLUDES
39 //=============================================================================================================
40 
41 #include "sensorlayout.h"
42 
43 
44 //*************************************************************************************************************
45 //=============================================================================================================
46 // Qt INCLUDES
47 //=============================================================================================================
48 
49 #include <QDebug>
50 
51 
52 //*************************************************************************************************************
53 //=============================================================================================================
54 // USED NAMESPACES
55 //=============================================================================================================
56 
57 using namespace XDISPLIB;
58 
59 
60 //*************************************************************************************************************
61 //=============================================================================================================
62 // DEFINE MEMBER METHODS
63 //=============================================================================================================
64 
66 {
67 }
68 
69 
70 //*************************************************************************************************************
71 
72 SensorLayout SensorLayout::parseSensorLayout(const QDomElement &sensorLayoutElement)
73 {
74  SensorLayout layout;
75 
76  qint32 t_iNumChannels = sensorLayoutElement.attribute("NumChannels", 0).toInt();
77 
78  Q_UNUSED(t_iNumChannels)
79 
80  layout.m_sName = sensorLayoutElement.attribute("Type", "");
81 
82  QDomElement childSensor = sensorLayoutElement.firstChildElement("Sensor");
83  while (!childSensor.isNull()) {
84  QString chName = layout.m_sName.isEmpty() ? childSensor.attribute("ChannelNumber") : QString("%1%2").arg(layout.m_sName).arg(childSensor.attribute("ChannelNumber"));
85  layout.m_qListFullChannelNames.append(chName);
86  layout.m_qListShortChannelNames.append(childSensor.attribute("ChannelNumber"));
87  float plot_x = childSensor.attribute("plot_x").toFloat()*5; //mm to pixel
88  float plot_y = childSensor.attribute("plot_y").toFloat()*5; //mm to pixel
89  layout.m_qListLocations.append(QPointF(plot_x,plot_y));
90  childSensor = childSensor.nextSiblingElement("Sensor");
91  }
92 
93 // qDebug() << "layout.m_qListChannels" << layout.m_qListChannels;
94 // qDebug() << "layout.m_qListLocations" << layout.m_qListLocations;
95 
96 // if(t_iNumChannels == layout.m_qListChannels.size())
97  return layout;
98 // else
99 // {
100 // qWarning() << "Number of channel inconsistency!";
101 // return SensorLayout();
102 // }
103 }
Declaration of the SensorLayout Class.
The SensorLayout class represents a channel layout.
Definition: sensorlayout.h:66
static SensorLayout parseSensorLayout(const QDomElement &sensorLayoutElement)