25 #include <dtkCoreSupport/dtkAbstractData.h>
26 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
46 return "axlAbstractDataCompositeWriter";
51 return "axlAbstractDataCompositeWriter";
56 return QStringList() <<
"axlAbstractDataComposite";
67 if(composite && !(dynamic_cast<axlDataDynamic *>(composite)))
75 return !this->
accept(data);
82 QDomElement compositeElement = doc->createElement(
"composite");
83 compositeElement.setAttribute(
"name",composite->name());
85 QColor qcolor = composite->
color();
87 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
88 << QString::number(qcolor.green()) <<
" "
89 << QString::number(qcolor.blue()) ;
90 compositeElement.setAttribute(
"color", color);
91 QString shader = composite->
shader();
92 QFileInfo shaderFileInfo(shader);
93 compositeElement.setAttribute(
"shader", shaderFileInfo.fileName());
95 for(
int i = 0; i < composite->
count(); i ++)
100 foreach(QString writer, dtkAbstractDataFactory::instance()->writers()) {
104 QDomElement element = this->elementByWriter(axl_writer, doc, composite->
get(i));
106 if(element.hasChildNodes()) {
107 compositeElement.appendChild(element);
116 QDomElement element = this->elementByWriter(axl_writer, doc, composite->
get(i));
118 if(element.hasChildNodes()) {
119 compositeElement.appendChild(element);
125 dtkWarn() <<
"No writer found for composite item:"<< composite->
get(i)->identifier();
129 return compositeElement;
133 QDomElement axlAbstractDataCompositeWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data)
140 if(!axl_writer->
accept(data))
143 element = axl_writer->
write(doc, data);
bool reject(dtkAbstractData *data)
axlAbstractDataCompositeWriter(void)
virtual bool accept(dtkAbstractData *data)=0
QStringList handled(void) const
static bool registered(void)
QString identifier(void) const
dtkAbstractDataWriter * createaxlAbstractDataCompositeWriter(void)
bool accept(dtkAbstractData *data)
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
~axlAbstractDataCompositeWriter(void)
QString description(void) const
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
bool get(dtkAbstractData *data)