26 #include <dtkCoreSupport/dtkAbstractData.h>
27 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
46 return "axlEllipsoidWriter";
51 return "axlEllipsoidWriter";
56 return QStringList() <<
"axlEllipsoid";
61 return dtkAbstractDataFactory::instance()->registerDataWriterType(
"axlEllipsoidWriter", QStringList(),
createaxlEllipsoidWriter);
75 return !this->
accept(data);
82 QDomElement ellipsoidElement = doc->createElement(
"ellipsoid");
83 ellipsoidElement.setAttribute(
"name",ellipsoid->name());
87 ellipsoidElement.setAttribute(
"size", QString::number(ellipsoid->
size()));
92 QColor qcolor = ellipsoid->
color();
94 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
95 << QString::number(qcolor.green()) <<
" "
96 << QString::number(qcolor.blue()) <<
" "
97 << QString::number(ellipsoid->
opacity());
98 ellipsoidElement.setAttribute(
"color", color);
101 QString shader = ellipsoid->
shader();
102 QFileInfo shaderFileInfo(shader);
103 ellipsoidElement.setAttribute(
"shader", shaderFileInfo.fileName());
107 QDomElement center = doc->createElement(
"center");
109 QTextStream(¢erStr) << QString::number(ellipsoid->
center()->
x()) <<
" "<< QString::number(ellipsoid->
center()->
y()) <<
" "<< QString::number(ellipsoid->
center()->
z());
110 QDomText centerDomText = doc->createTextNode(centerStr);
111 center.appendChild(centerDomText);
113 ellipsoidElement.appendChild(center);
116 QDomElement semix = doc->createElement(
"semix");
118 QTextStream(&semixStr) << QString::number(ellipsoid->
semiX()->
x()) <<
" "<< QString::number(ellipsoid->
semiX()->
y()) <<
" "<< QString::number(ellipsoid->
semiX()->
z());
119 QDomText semixDomText = doc->createTextNode(semixStr);
120 semix.appendChild(semixDomText);
122 ellipsoidElement.appendChild(semix);
125 QDomElement semiy = doc->createElement(
"semiy");
127 QTextStream(&semiyStr) << QString::number(ellipsoid->
semiY()->
x()) <<
" "<< QString::number(ellipsoid->
semiY()->
y()) <<
" "<< QString::number(ellipsoid->
semiY()->
z());
128 QDomText semiyDomText = doc->createTextNode(semiyStr);
129 semiy.appendChild(semiyDomText);
131 ellipsoidElement.appendChild(semiy);
134 QDomElement semiz = doc->createElement(
"semiz");
136 QTextStream(&semizStr) << QString::number(ellipsoid->
semiZ()->
x()) <<
" "<< QString::number(ellipsoid->
semiZ()->
y()) <<
" "<< QString::number(ellipsoid->
semiZ()->
z());
137 QDomText semizDomText = doc->createTextNode(semizStr);
138 semiz.appendChild(semizDomText);
140 ellipsoidElement.appendChild(semiz);
144 if(!ellipsoid->
fields().isEmpty()){
147 QDomElement fieldElement = field_writer->
write(doc, field);
148 ellipsoidElement.appendChild(fieldElement);
153 return ellipsoidElement;
157 QDomElement axlEllipsoidWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data)
164 if(!axl_writer->
accept(data))
167 element = axl_writer->
write(doc, data);
QString description(void) const
static bool registered(void)
virtual bool accept(dtkAbstractData *data)=0
static axlFieldWritersFactory * instance(void)
~axlEllipsoidWriter(void)
virtual QString identifier(void) const
QString identifier(void) const
dtkAbstractDataWriter * createaxlEllipsoidWriter(void)
dtkAbstractDataWriter * create(const QString &interface_name)
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
Class axlAbstractField defines an API for arrays of numeric data.
bool accept(dtkAbstractData *data)
QStringList handled(void) const
QList< axlAbstractField * > fields(void)
bool reject(dtkAbstractData *data)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
Class axlEllipsoid defines 3D ellipsoids.