23 #include <dtkCoreSupport/dtkAbstractData.h>
24 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
39 return "axlTorusParametricWriter";
43 return "axlTorusParametricWriter";
47 return QStringList() <<
"axlTorusParametric";
56 return torusParam != NULL;
60 return !this->
accept(data);
70 QDomElement torusParamElement = doc->createElement(
"torusParam");
71 torusParamElement.setAttribute(
"name",torus->name());
74 torusParamElement.setAttribute(
"size", QString::number(torus->
size()));
77 QColor qcolor = torus->
color();
79 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
80 << QString::number(qcolor.green()) <<
" "
81 << QString::number(qcolor.blue()) <<
" "
82 << QString::number(torus->
opacity());
83 torusParamElement.setAttribute(
"color", color);
86 QString shader = torus->
shader();
87 QFileInfo shaderFileInfo(shader);
88 torusParamElement.setAttribute(
"shader", shaderFileInfo.fileName());
92 QDomElement center = doc->createElement(
"center");
95 QDomText centerDomText = doc->createTextNode(centerStr);
96 center.appendChild(centerDomText);
98 torusParamElement.appendChild(center);
101 QDomElement direction = doc->createElement(
"direction");
102 QString directionStr;
103 QTextStream(&directionStr) << QString::number(torus->
direction()->
x()) <<
" "<< QString::number(torus->
direction()->
y()) <<
" "<< QString::number(torus->
direction()->
z());
104 QDomText directionDomText = doc->createTextNode(directionStr);
105 direction.appendChild(directionDomText);
107 torusParamElement.appendChild(direction);
110 QDomElement ringRadius = doc->createElement(
"ringRadius");
111 QString ringRadiusStr;
112 QTextStream(&ringRadiusStr) << QString::number(torus->
ringRadius());
113 QDomText ringRadiusDomText = doc->createTextNode(ringRadiusStr);
114 ringRadius.appendChild(ringRadiusDomText);
116 torusParamElement.appendChild(ringRadius);
119 QDomElement crossSectionRadius = doc->createElement(
"crossSectionRadius");
120 QString crossSectionRadiusStr;
122 QDomText crossSectionRadiusDomText = doc->createTextNode(crossSectionRadiusStr);
123 crossSectionRadius.appendChild(crossSectionRadiusDomText);
125 torusParamElement.appendChild(crossSectionRadius);
128 QDomElement refdir = doc->createElement(
"refdir");
130 QTextStream(&refdirStr) << QString::number(torusParam->
getR()->
x()) <<
" "<< QString::number(torusParam->
getR()->
y()) <<
" "<< QString::number(torusParam->
getR()->
z());
131 QDomText refdirDomText = doc->createTextNode(refdirStr);
132 refdir.appendChild(refdirDomText);
134 torusParamElement.appendChild(refdir);
137 if(!torus->
fields().isEmpty()){
140 QDomElement fieldElement = field_writer->
write(doc, field);
141 torusParamElement.appendChild(fieldElement);
145 return torusParamElement;
149 QDomElement axlTorusParametricWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data) {
155 if(!axl_writer->
accept(data))
158 element = axl_writer->
write(doc, data);
axlTorus * getTorus(void) const
double crossSectionRadius
axlTorusParametricWriter(void)
virtual bool accept(dtkAbstractData *data)=0
QStringList handled(void) const
static axlFieldWritersFactory * instance(void)
virtual QString identifier(void) const
dtkAbstractDataWriter * create(const QString &interface_name)
Class axlAbstractField defines an API for arrays of numeric data.
dtkAbstractDataWriter * createaxlTorusParametricWriter(void)
static bool registered(void)
axlPoint * getR(void) const
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
virtual ~axlTorusParametricWriter(void)
bool accept(dtkAbstractData *data)
QList< axlAbstractField * > fields(void)
bool reject(dtkAbstractData *data)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
QString description(void) const
QString identifier(void) const