26 #include <dtkCoreSupport/dtkAbstractData.h> 
   27 #include <dtkCoreSupport/dtkAbstractDataFactory.h> 
   43     return "axlLineReader";
 
   47     return "axlLineReader";
 
   51     return QStringList() << 
"axlLine";
 
   55     return dtkAbstractDataFactory::instance()->registerDataReaderType(
"axlLineReader", QStringList(), 
createaxlLineReader);
 
   59     QDomElement element = node.toElement();
 
   61     if (element.tagName() != 
"line")
 
   71     return !this->
accept(node);
 
   75     QDomElement element = node.toElement();
 
   81     QString name = element.attribute(
"name");
 
   82     if (!name.isEmpty()) {
 
   83         currentLine->setObjectName(name);
 
   87     QString color = element.attribute(
"color");
 
   88     if (!color.isEmpty()) {
 
   89         QStringList colorList = color.split(
" ");
 
   90         if(colorList.size() > 2) 
 
   91             currentLine->
setColor(QColor(colorList.at(0).toInt(), colorList.at(1).toInt(), colorList.at(2).toInt()));
 
   92         if(colorList.size() == 4)
 
   93             currentLine->
setOpacity(colorList.at(3).toFloat());
 
   97     QString shader = element.attribute(
"shader");
 
   99     if (!shader.isEmpty()) {
 
  101         dirShader = 
":axlShader/shader/"+shader;
 
  102         if(!QFile::exists(dirShader)) {
 
  103             QSettings settings(
"inria", 
"dtk");
 
  105             settings.beginGroup(
"shader");
 
  106             dirShader = settings.value(
"path", defaultPath).toString();
 
  108             dirShader.append(
"/"+shader);
 
  114     QString size = element.attribute(
"size");
 
  116         currentLine->
setSize(size.toFloat());
 
  119     QDomNodeList nodelistfirstPoint = element.elementsByTagName(
"point") ;
 
  120     QDomElement elementfirstPoint = nodelistfirstPoint.item(0).toElement() ;
 
  122     QStringList coordinates = elementfirstPoint.text().simplified().split(QRegExp(
"\\s+"));
 
  123     if(coordinates.size() == 3)
 
  125         currentLine->
setFirstPoint(
new axlPoint(coordinates[0].toDouble(), coordinates[1].toDouble(), coordinates[2].toDouble()));
 
  127         dtkWarn() << 
"Error within axlLineReader::read, line first point data cannot be read correctly: coordinates";
 
  130     QDomNodeList nodelistsecondPoint = element.elementsByTagName(
"point") ;
 
  131     QDomElement elementsecondPoint = nodelistsecondPoint.item(1).toElement() ;
 
  133     coordinates = elementsecondPoint.text().simplified().split(QRegExp(
"\\s+"));
 
  134     if (coordinates.size() == 3) {
 
  135         currentLine->
setSecondPoint(
new axlPoint(coordinates[0].toDouble(), coordinates[1].toDouble(), coordinates[2].toDouble()));
 
  138         dtkWarn() << 
"Error within axlLineReader::read, line second point data cannot be read correctly: coordinates";
 
  141     QDomNodeList nodeListField = element.elementsByTagName(
"field");
 
  142     if (!nodeListField.isEmpty()) {
 
  143         for (
int i = 0; i < nodeListField.size(); i++) {
 
  144             QDomElement fieldElement = nodeListField.at(i).toElement();
 
  145             QString fieldType = fieldElement.attribute(
"type");
 
  146             if (!fieldType.isEmpty()) {
 
  151                     fieldToAdd->setObjectName(newName);
 
QStringList handled(void) const 
 
Class axlPoint defines 3D points. 
 
Class axlLine defines 3D lines. 
 
axlAbstractData * read(const QDomNode &node)
 
QString identifier(void) const 
 
void setShader(const QString &shader)
 
QString changeFieldName(QString fieldName)
 
dtkAbstractDataReader * create(const QString &interface_name)
 
static bool registered(void)
 
QString description(void) const 
 
virtual axlAbstractData * read(const QDomNode &node)=0
 
void setSecondPoint(axlPoint *p2)
Change second point of this line. 
 
bool reject(const QDomNode &node)
 
void setFirstPoint(axlPoint *p1)
Change first point of this line. 
 
Class axlAbstractField defines an API for arrays of numeric data. 
 
dtkAbstractDataReader * createaxlLineReader(void)
 
bool hasChildNode(QDomElement element, const QString &tag)
 
void setOpacity(const double &opacity)
 
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)
 
bool accept(const QDomNode &node)
 
Class axlAbstractData defines an API for all type of axel data.