23 #include <dtkCoreSupport/dtkAbstractData.h>
24 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
39 return "axlPlaneParametricWriter";
43 return "axlPlaneParametricWriter";
47 return QStringList() <<
"axlPlaneParametric";
56 return planeParam != NULL;
60 return !this->
accept(data);
70 QDomElement planeParamElement = doc->createElement(
"planeParam");
71 planeParamElement.setAttribute(
"name",plane->name());
74 planeParamElement.setAttribute(
"size", QString::number(plane->
size()));
77 QColor qcolor = plane->
color();
79 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
80 << QString::number(qcolor.green()) <<
" "
81 << QString::number(qcolor.blue()) <<
" "
82 << QString::number(plane->
opacity());
83 planeParamElement.setAttribute(
"color", color);
86 QString shader = plane->
shader();
87 QFileInfo shaderFileInfo(shader);
88 planeParamElement.setAttribute(
"shader", shaderFileInfo.fileName());
92 QDomElement point = doc->createElement(
"point");
94 QTextStream(&pointStr) << QString::number(plane->
point()->
x()) <<
" "<< QString::number(plane->
point()->
y()) <<
" "<< QString::number(plane->
point()->
z());
95 QDomText pointDomText = doc->createTextNode(pointStr);
96 point.appendChild(pointDomText);
98 planeParamElement.appendChild(point);
101 QDomElement normal = doc->createElement(
"normal");
103 QTextStream(&normalStr) << QString::number(plane->
normal()->
x()) <<
" "<< QString::number(plane->
normal()->
y()) <<
" "<< QString::number(plane->
normal()->
z());
104 QDomText normalDomText = doc->createTextNode(normalStr);
105 normal.appendChild(normalDomText);
107 planeParamElement.appendChild(normal);
110 QDomElement refdir = doc->createElement(
"refdir");
112 QTextStream(&refdirStr) << QString::number(planeParam->
getI()->
x()) <<
" "<< QString::number(planeParam->
getI()->
y()) <<
" "<< QString::number(planeParam->
getI()->
z());
113 QDomText refdirDomText = doc->createTextNode(refdirStr);
114 refdir.appendChild(refdirDomText);
116 planeParamElement.appendChild(refdir);
119 if (!plane->
fields().isEmpty()) {
122 QDomElement fieldElement = field_writer->
write(doc, field);
123 planeParamElement.appendChild(fieldElement);
127 return planeParamElement;
131 QDomElement axlPlaneParametricWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data) {
137 if(!axl_writer->
accept(data))
140 element = axl_writer->
write(doc, data);
axlPlane * getPlane(void) const
virtual ~axlPlaneParametricWriter(void)
virtual bool accept(dtkAbstractData *data)=0
Class axlPlane defines 3D planes.
static axlFieldWritersFactory * instance(void)
dtkAbstractDataWriter * createaxlPlaneParametricWriter(void)
virtual QString identifier(void) const
axlPlaneParametricWriter(void)
QStringList handled(void) const
dtkAbstractDataWriter * create(const QString &interface_name)
Class axlAbstractField defines an API for arrays of numeric data.
bool accept(dtkAbstractData *data)
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
axlPoint * getI(void) const
QList< axlAbstractField * > fields(void)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
static bool registered(void)
QString identifier(void) const
QString description(void) const
bool reject(dtkAbstractData *data)