26 #include <dtkCoreSupport/dtkAbstractData.h>
27 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
42 return "axlTorusWriter";
46 return "axlTorusWriter";
50 return QStringList() <<
"axlTorus";
54 return dtkAbstractDataFactory::instance()->registerDataWriterType(
"axlTorusWriter", QStringList(),
createaxlTorusWriter);
65 return !this->
accept(data);
73 QDomElement torusElement = doc->createElement(
"torus");
74 torusElement.setAttribute(
"name", torus->name());
77 torusElement.setAttribute(
"size", QString::number(torus->
size()));
80 QColor qcolor = torus->
color();
82 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
83 << QString::number(qcolor.green()) <<
" "
84 << QString::number(qcolor.blue()) <<
" "
85 << QString::number(torus->
opacity());
86 torusElement.setAttribute(
"color", color);
89 QString shader = torus->
shader();
90 QFileInfo shaderFileInfo(shader);
91 torusElement.setAttribute(
"shader", shaderFileInfo.fileName());
95 QDomElement centerElement = doc->createElement(
"center");
97 QTextStream(¢erStr) << QString::number(torus->
centerPoint()->
x()) <<
" "
100 QDomText centerDomText = doc->createTextNode(centerStr);
101 centerElement.appendChild(centerDomText);
103 torusElement.appendChild(centerElement);
106 QDomElement directionElement = doc->createElement(
"direction");
107 QString directionStr;
108 QTextStream(&directionStr) << QString::number(torus->
direction()->
x()) <<
" "
109 << QString::number(torus->
direction()->
y()) <<
" "
111 QDomText directionDomText = doc->createTextNode(directionStr);
112 directionElement.appendChild(directionDomText);
114 torusElement.appendChild(directionElement);
117 QDomElement ringRadiusElement = doc->createElement(
"ringRadius");
118 QString ringRadiusStr;
119 QTextStream(&ringRadiusStr) << QString::number(torus->
ringRadius());
120 QDomText ringRadiusDomText = doc->createTextNode(ringRadiusStr);
121 ringRadiusElement.appendChild(ringRadiusDomText);
123 torusElement.appendChild(ringRadiusElement);
126 QDomElement crossSectionRadiusElement = doc->createElement(
"crossSectionRadius");
127 QString crossSectionRadiusStr;
129 QDomText crossSectionRadiusDomText = doc->createTextNode(crossSectionRadiusStr);
130 crossSectionRadiusElement.appendChild(crossSectionRadiusDomText);
132 torusElement.appendChild(crossSectionRadiusElement);
135 if(!torus->
fields().isEmpty()){
138 QDomElement fieldElement = field_writer->
write(doc, field);
139 torusElement.appendChild(fieldElement);
146 QDomElement axlTorusWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data) {
151 if(!axl_writer->
accept(data))
154 element = axl_writer->
write(doc, data);
double crossSectionRadius
virtual ~axlTorusWriter(void)
bool reject(dtkAbstractData *data)
virtual bool accept(dtkAbstractData *data)=0
static axlFieldWritersFactory * instance(void)
QString description(void) const
QStringList handled(void) const
virtual QString identifier(void) const
dtkAbstractDataWriter * createaxlTorusWriter(void)
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
dtkAbstractDataWriter * create(const QString &interface_name)
Class axlAbstractField defines an API for arrays of numeric data.
static bool registered(void)
QList< axlAbstractField * > fields(void)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
QString identifier(void) const
bool accept(dtkAbstractData *data)