Skip to content
Snippets Groups Projects
Commit 4338d7a9 authored by Tom Fischer's avatar Tom Fischer
Browse files

Using logog logging in class XmlLutReader.

parent c8b06486
No related branches found
No related tags found
No related merge requests found
...@@ -18,7 +18,8 @@ ...@@ -18,7 +18,8 @@
#include <QFile> #include <QFile>
#include <QtXml/QDomDocument> #include <QtXml/QDomDocument>
#include <iostream> // ThirdParty/logog
#include "logog/include/logog.hpp"
/** /**
* \brief Reader for vtk-Lookup-Tables (in XML / ParaView Format) * \brief Reader for vtk-Lookup-Tables (in XML / ParaView Format)
...@@ -33,7 +34,7 @@ public: ...@@ -33,7 +34,7 @@ public:
QFile* file = new QFile(fileName); QFile* file = new QFile(fileName);
if (!file->open(QIODevice::ReadOnly | QIODevice::Text)) if (!file->open(QIODevice::ReadOnly | QIODevice::Text))
{ {
std::cout << "XmlLutReader::readFromFile() - Can't open xml-file." << std::endl; ERR("XmlLutReader::readFromFile(): Can't open xml-file %s.", fileName.data());
delete file; delete file;
return NULL; return NULL;
} }
...@@ -43,7 +44,7 @@ public: ...@@ -43,7 +44,7 @@ public:
QDomElement docElement = doc.documentElement(); QDomElement docElement = doc.documentElement();
if (docElement.nodeName().compare("ColorMap")) if (docElement.nodeName().compare("ColorMap"))
{ {
std::cout << "XmlLutReader::readFromFile() - Unexpected XML root." << std::endl; ERR("XmlLutReader::readFromFile(): Unexpected XML root.");
delete file; delete file;
return NULL; return NULL;
} }
...@@ -66,10 +67,10 @@ public: ...@@ -66,10 +67,10 @@ public:
while (!point.isNull()) while (!point.isNull())
{ {
if ((point.nodeName().compare("Point") == 0 ) if ((point.nodeName().compare("Point") == 0 )
&& point.hasAttribute("x") && point.hasAttribute("x")
&& point.hasAttribute("r") && point.hasAttribute("r")
&& point.hasAttribute("g") && point.hasAttribute("g")
&& point.hasAttribute("b")) && point.hasAttribute("b"))
{ {
double value = strtod((point.attribute("x")).toStdString().c_str(),0); double value = strtod((point.attribute("x")).toStdString().c_str(),0);
unsigned char r = static_cast<int>(255 * strtod((point.attribute("r")).toStdString().c_str(),0)); unsigned char r = static_cast<int>(255 * strtod((point.attribute("r")).toStdString().c_str(),0));
...@@ -77,8 +78,10 @@ public: ...@@ -77,8 +78,10 @@ public:
unsigned char b = static_cast<int>(255 * strtod((point.attribute("b")).toStdString().c_str(),0)); unsigned char b = static_cast<int>(255 * strtod((point.attribute("b")).toStdString().c_str(),0));
unsigned char o = static_cast<int>(255 * (point.hasAttribute("o") ? strtod((point.attribute("o")).toStdString().c_str(),0) : 1)); unsigned char o = static_cast<int>(255 * (point.hasAttribute("o") ? strtod((point.attribute("o")).toStdString().c_str(),0) : 1));
if (value<range[0]) range[0] = value; if (value < range[0])
if (value>range[1]) range[1] = value; range[0] = value;
if (value > range[1])
range[1] = value;
unsigned char a[4] = { r, g, b, o }; unsigned char a[4] = { r, g, b, o };
lut->setColor(value, a); lut->setColor(value, a);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment