Fraxinus  18.10
An IGT application
cxDataMetric.cpp
Go to the documentation of this file.
1 /*=========================================================================
2 This file is part of CustusX, an Image Guided Therapy Application.
3 
4 Copyright (c) SINTEF Department of Medical Technology.
5 All rights reserved.
6 
7 CustusX is released under a BSD 3-Clause license.
8 
9 See Lisence.txt (https://github.com/SINTEFMedtek/CustusX/blob/master/License.txt) for details.
10 =========================================================================*/
11 
12 
13 #include "cxDataMetric.h"
15 #include "cxTypeConversions.h"
16 
17 namespace cx
18 {
19 
20 DataMetric::DataMetric(const QString& uid, const QString& name, PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider) :
21  Data(uid, name)
22 {
23  mDataManager = dataManager;
24  mSpaceProvider = spaceProvider;
25 
26  mColor = QColor(240, 170, 255, 255);
28 }
29 
31 {
32 }
33 
35 {
36  return "";
37 }
38 
39 void DataMetric::setColor(const QColor& color)
40 {
41  mColor = color;
42  emit propertiesChanged();
43 }
44 
46 {
47  return mColor;
48 }
49 
50 
51 void DataMetric::addXml(QDomNode& dataNode)
52 {
53  Data::addXml(dataNode);
54  QDomDocument doc = dataNode.ownerDocument();
55 
56  QDomElement colorNode = doc.createElement("color");
57  colorNode.appendChild(doc.createTextNode(color2string(mColor)));
58  dataNode.appendChild(colorNode);
59 }
60 
61 void DataMetric::parseXml(QDomNode& dataNode)
62 {
63  Data::parseXml(dataNode);
64 
65  if (dataNode.isNull())
66  return;
67 
68  QDomNode colorNode = dataNode.namedItem("color");
69  if (!colorNode.isNull())
70  {
71  mColor = string2color(colorNode.toElement().text(), mColor);
72  }
73 
74  emit propertiesChanged();
75 }
76 
77 
78 }
boost::shared_ptr< class SpaceProvider > SpaceProviderPtr
QColor string2color(QString input, QColor defaultValue)
void addXml(QDomNode &dataNode)
adds xml information about the data and its variabels
QString color2string(QColor color)
void setColor(const QColor &color)
static RegistrationHistoryPtr getNullObject()
void propertiesChanged()
emitted when one of the metadata properties (uid, name etc) changes
PatientModelServicePtr mDataManager
Definition: cxDataMetric.h:67
virtual void addXml(QDomNode &dataNode)
adds xml information about the data and its variabels
Definition: cxData.cpp:123
virtual QString getSpace()
SpaceProviderPtr mSpaceProvider
Definition: cxDataMetric.h:68
virtual ~DataMetric()
void parseXml(QDomNode &dataNode)
Use a XML node to load data.
DataMetric(const QString &uid, const QString &name, PatientModelServicePtr dataManager, SpaceProviderPtr spaceProvider)
virtual void parseXml(QDomNode &dataNode)
Use a XML node to load data.
Definition: cxData.cpp:149
boost::shared_ptr< class PatientModelService > PatientModelServicePtr
QColor getColor()
RegistrationHistoryPtr m_rMd_History
Definition: cxData.h:159
Superclass for all data objects.
Definition: cxData.h:88
Namespace for all CustusX production code.