25 #include <dtkCoreSupport/dtkAbstractData.h>
26 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
44 return "axlPointSetWriter";
49 return "axlPointSetWriter";
54 return QStringList() <<
"axlPointSet";
59 return dtkAbstractDataFactory::instance()->registerDataWriterType(
"axlPointSetWriter", QStringList(),
createaxlPointSetWriter);
73 return !this->
accept(data);
81 QDomElement pointElement = doc->createElement(
"pointset");
82 pointElement.setAttribute(
"name",pointSet->name());
86 pointElement.setAttribute(
"size", QString::number(pointSet->
size()));
96 QColor qcolor = pointSet->
color();
97 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
98 << QString::number(qcolor.green()) <<
" "
99 << QString::number(qcolor.blue()) <<
" "
100 << QString::number(pointSet->
opacity());
104 pointElement.setAttribute(
"color", color);
107 QString shader = pointSet->
shader();
108 QFileInfo shaderFileInfo(shader);
109 pointElement.setAttribute(
"shader", shaderFileInfo.fileName());
113 QDomElement numberofpoints = doc->createElement(
"numberofpoints");
114 QString numberofpointsStr;
115 QTextStream(&numberofpointsStr) << QString::number(pointSet->
numberOfPoints());
116 QDomText numberofpointsDomText = doc->createTextNode(numberofpointsStr);
117 numberofpoints.appendChild(numberofpointsDomText);
119 pointElement.appendChild(numberofpoints);
122 QDomElement coordinates = doc->createElement(
"points");
123 QString pointSetText;
127 QTextStream(&pointSetText)<<
"\n" << QString::number(pointSet->
value(i)->
x()) <<
" "<< QString::number(pointSet->
value(i)->
y()) <<
" "<< QString::number(pointSet->
value(i)->
z());
132 QTextStream(&pointSetText)<<
"\n" << QString::number(pointSet->
value(i)->
x()) <<
" "<< QString::number(pointSet->
value(i)->
y()) <<
" "<< QString::number(pointSet->
value(i)->
z())<<
" " << QString::number(pointSet->
value(i)->
color().red()) <<
" "<< QString::number(pointSet->
value(i)->
color().green()) <<
" "<< QString::number(pointSet->
value(i)->
color().blue());
134 QTextStream(&pointSetText)<<
"\n";
136 QDomText pointDomText = doc->createTextNode(pointSetText);
138 coordinates.appendChild(pointDomText);
140 pointElement.appendChild(coordinates);
146 QDomElement axlPointSetWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data)
153 if(!axl_writer->
accept(data))
156 element = axl_writer->
write(doc, data);
virtual bool accept(dtkAbstractData *data)=0
dtkAbstractDataWriter * createaxlPointSetWriter(void)
axlPoint * value(int n) const
QString identifier(void) const
static bool registered(void)
bool isUniqueColor(void) const
bool accept(dtkAbstractData *data)
bool reject(dtkAbstractData *data)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
QStringList handled(void) const
QString description(void) const
int numberOfPoints(void) const
QDomElement write(QDomDocument *doc, dtkAbstractData *data)