26 #include <dtkCoreSupport/dtkAbstractData.h>
27 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
42 return "axlLineWriter";
46 return "axlLineWriter";
50 return QStringList() <<
"axlLine";
54 return dtkAbstractDataFactory::instance()->registerDataWriterType(
"axlLineWriter", QStringList(),
createaxlLineWriter);
66 return !this->
accept(data);
74 QDomElement lineElement = doc->createElement(
"line");
75 lineElement.setAttribute(
"name",line->name());
78 lineElement.setAttribute(
"size", QString::number(line->
size()));
81 QColor qcolor = line->
color();
83 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
84 << QString::number(qcolor.green()) <<
" "
85 << QString::number(qcolor.blue()) <<
" "
86 << QString::number(line->
opacity());
87 lineElement.setAttribute(
"color", color);
90 QString shader = line->
shader();
91 QFileInfo shaderFileInfo(shader);
92 lineElement.setAttribute(
"shader", shaderFileInfo.fileName());
96 QDomElement firstPoint = doc->createElement(
"point");
97 QString firstPointStr;
98 QTextStream(&firstPointStr) << QString::number(line->
firstPoint()->
x()) <<
" "<< QString::number(line->
firstPoint()->
y()) <<
" "<< QString::number(line->
firstPoint()->
z());
99 QDomText firstPointDomText = doc->createTextNode(firstPointStr);
100 firstPoint.appendChild(firstPointDomText);
102 lineElement.appendChild(firstPoint);
105 QDomElement secondPoint = doc->createElement(
"point");
106 QString secondPointStr;
107 QTextStream(&secondPointStr) << QString::number(line->
secondPoint()->
x()) <<
" "<< QString::number(line->
secondPoint()->
y()) <<
" "<< QString::number(line->
secondPoint()->
z());
108 QDomText secondPointDomText = doc->createTextNode(secondPointStr);
109 secondPoint.appendChild(secondPointDomText);
111 lineElement.appendChild(secondPoint);
114 if(!line->
fields().isEmpty()){
117 QDomElement fieldElement = field_writer->
write(doc, field);
118 lineElement.appendChild(fieldElement);
126 QDomElement axlLineWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data) {
132 if(!axl_writer->
accept(data))
135 element = axl_writer->
write(doc, data);
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
Class axlLine defines 3D lines.
QStringList handled(void) const
QString description(void) const
axlPoint * secondPoint(void) const
Returns second point of the line.
bool reject(dtkAbstractData *data)
virtual bool accept(dtkAbstractData *data)=0
static axlFieldWritersFactory * instance(void)
dtkAbstractDataWriter * createaxlLineWriter(void)
virtual QString identifier(void) const
axlPoint * firstPoint(void) const
Returns first point of the line.
dtkAbstractDataWriter * create(const QString &interface_name)
Class axlAbstractField defines an API for arrays of numeric data.
bool accept(dtkAbstractData *data)
QList< axlAbstractField * > fields(void)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
QString identifier(void) const
static bool registered(void)