25 #include <dtkCoreSupport/dtkAbstractData.h>
26 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
46 return "axlPointReader";
51 return "axlPointReader";
56 return QStringList() <<
"axlPoint";
61 return dtkAbstractDataFactory::instance()->registerDataReaderType(
"axlPointReader", QStringList(),
createaxlPointReader);
66 QDomElement element = node.toElement();
68 if(element.tagName() !=
"point")
77 return !this->
accept(node);
82 QDomElement element = node.toElement();
86 QString name = element.attribute(
"name");
89 currentPoint->setObjectName(name);
92 QString color = element.attribute(
"color");
95 QStringList colorList = color.split(
" ");
96 if(colorList.size() > 2)
97 currentPoint->
setColor(QColor(colorList.at(0).toInt(), colorList.at(1).toInt(), colorList.at(2).toInt()));
98 if(colorList.size() == 4)
99 currentPoint->
setOpacity(colorList.at(3).toFloat());
102 QString shader = element.attribute(
"shader");
104 if(!shader.isEmpty())
107 dirShader =
":axlShader/shader/"+shader;
108 if(!QFile::exists(dirShader))
110 QSettings settings(
"inria",
"dtk");
112 settings.beginGroup(
"shader");
113 dirShader = settings.value(
"path", defaultPath).toString();
115 dirShader.append(
"/"+shader);
120 QString size = element.attribute(
"size");
122 currentPoint->
setSize(size.toFloat());
124 QStringList coordinates = element.text().simplified().split(QRegExp(
"\\s+"));
126 if(coordinates.size() == 3)
128 currentPoint->
coordinates()[0] = coordinates[0].toFloat();
129 currentPoint->
coordinates()[1] = coordinates[1].toFloat();
130 currentPoint->
coordinates()[2] = coordinates[2].toFloat();
133 qDebug()<<
"Point data cannot be read correctly";
137 QDomNodeList nodeListField = element.elementsByTagName(
"field");
138 if(!nodeListField.isEmpty()){
139 for(
int i =0; i < nodeListField.size(); i++){
140 QDomElement fieldElement = nodeListField.at(i).toElement();
141 QString fieldType = fieldElement.attribute(
"type");
142 if(!fieldType.isEmpty()){
147 fieldToAdd->setObjectName(newName);
Class axlPoint defines 3D points.
QStringList handled(void) const
double * coordinates(void) const
Returns coordinates of this point.
bool accept(const QDomNode &node)
void setShader(const QString &shader)
QString changeFieldName(QString fieldName)
dtkAbstractDataReader * create(const QString &interface_name)
QString description(void) const
static bool registered(void)
virtual axlAbstractData * read(const QDomNode &node)=0
axlAbstractData * read(const QDomNode &node)
Class axlAbstractField defines an API for arrays of numeric data.
void setOpacity(const double &opacity)
bool reject(const QDomNode &node)
static axlFieldReadersFactory * instance(void)
void addField(axlAbstractField *field)
Add a field to the field list of the object.
void setSize(const double &size)
void setColor(double r, double g, double b)
Class axlAbstractData defines an API for all type of axel data.
QString identifier(void) const
dtkAbstractDataReader * createaxlPointReader(void)