26 #include <dtkCoreSupport/dtkAbstractData.h>
27 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
46 return "axlPlaneWriter";
51 return "axlPlaneWriter";
56 return QStringList() <<
"axlPlane";
61 return dtkAbstractDataFactory::instance()->registerDataWriterType(
"axlPlaneWriter", QStringList(),
createaxlPlaneWriter);
75 return !this->
accept(data);
83 QDomElement planeElement = doc->createElement(
"plane");
84 planeElement.setAttribute(
"name",plane->name());
88 planeElement.setAttribute(
"size", QString::number(plane->
size()));
93 QColor qcolor = plane->
color();
95 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
96 << QString::number(qcolor.green()) <<
" "
97 << QString::number(qcolor.blue()) <<
" "
98 << QString::number(plane->
opacity());
99 planeElement.setAttribute(
"color", color);
102 QString shader = plane->
shader();
103 QFileInfo shaderFileInfo(shader);
104 planeElement.setAttribute(
"shader", shaderFileInfo.fileName());
108 QDomElement point = doc->createElement(
"point");
110 QTextStream(&pointStr) << QString::number(plane->
point()->
x()) <<
" "<< QString::number(plane->
point()->
y()) <<
" "<< QString::number(plane->
point()->
z());
111 QDomText pointDomText = doc->createTextNode(pointStr);
112 point.appendChild(pointDomText);
114 planeElement.appendChild(point);
117 QDomElement normal = doc->createElement(
"normal");
119 QTextStream(&normalStr) << QString::number(plane->
normal()->
x()) <<
" "<< QString::number(plane->
normal()->
y()) <<
" "<< QString::number(plane->
normal()->
z());
120 QDomText normalDomText = doc->createTextNode(normalStr);
121 normal.appendChild(normalDomText);
123 planeElement.appendChild(normal);
127 if(!plane->
fields().isEmpty()){
130 QDomElement fieldElement = field_writer->
write(doc, field);
131 planeElement.appendChild(fieldElement);
140 QDomElement axlPlaneWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data)
147 if(!axl_writer->
accept(data))
150 element = axl_writer->
write(doc, data);
bool reject(dtkAbstractData *data)
dtkAbstractDataWriter * createaxlPlaneWriter(void)
virtual bool accept(dtkAbstractData *data)=0
Class axlPlane defines 3D planes.
static axlFieldWritersFactory * instance(void)
virtual QString identifier(void) const
QStringList handled(void) const
dtkAbstractDataWriter * create(const QString &interface_name)
Class axlAbstractField defines an API for arrays of numeric data.
QString identifier(void) const
bool accept(dtkAbstractData *data)
QList< axlAbstractField * > fields(void)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
QString description(void) const
static bool registered(void)