21 #include <dtkCoreSupport/dtkAbstractData.h>
24 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
43 return "axlDataDynamicWriter";
48 return "axlDataDynamicWriter";
53 return QStringList() <<
"axlDataDynamic";
58 return dtkAbstractDataFactory::instance()->registerDataWriterType(
"axlDataDynamicWriter", QStringList(),
createaxlDataDynamicWriter);
72 return !this->
accept(data);
81 QDomElement dataDynamicElement = doc->createElement(
"process");
85 dataDynamicElement.setAttribute(
"status",
"static");
87 dataDynamicElement.setAttribute(
"status",
"dynamic");
89 dataDynamicElement.setAttribute(
"name", dataDynamic->name());
113 int channelCountDouble = 0;
114 int channelCountData = 0;
116 QDomElement newInput = doc->createElement(
"input");
117 if(
axlDouble *value = dynamic_cast<axlDouble *>(axlvalue)){
118 newInput.setAttribute(
"value", value->value());
119 newInput.setAttribute(
"type",
"double");
121 dataDynamicElement.appendChild(newInput);
122 channelCountDouble++;
125 newInput.setAttribute(
"name", axlvalue->name());
126 newInput.setAttribute(
"type",
"data");
128 dataDynamicElement.appendChild(newInput);
137 QDomElement newOutput = doc->createElement(
"output");
138 newOutput.setAttribute(
"name", dataDynamic->
outputs(i)->name());
141 newOutput.setAttribute(
"size", QString::number(dataDynamic->
outputs()->
size()));
146 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
147 << QString::number(qcolor.green()) <<
" "
148 << QString::number(qcolor.blue())<<
" "
150 newOutput.setAttribute(
"color", color);
154 QFileInfo shaderFileInfo(shader);
155 newOutput.setAttribute(
"shader", shaderFileInfo.fileName());
158 dataDynamicElement.appendChild(newOutput);
164 if(!dataDynamic->
fields().isEmpty()){
167 QDomElement fieldElement = field_writer->
write(doc, field);
168 dataDynamicElement.appendChild(fieldElement);
172 return dataDynamicElement;
177 QDomElement axlDataDynamicWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data)
184 if(!axl_writer->
accept(data))
187 element = axl_writer->
write(doc, data);
axlDataDynamic::Type getType(void)
Return the type : dynamic if it is a dynamic object or static if it is just a computation node...
virtual int numberOfChannels(void)
Return the number of output(s);.
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
QStringList handled(void) const
Class axlDouble defines a double.
virtual bool accept(dtkAbstractData *data)=0
dtkAbstractDataWriter * createaxlDataDynamicWriter(void)
QString identifier(void) const
~axlDataDynamicWriter(void)
static axlFieldWritersFactory * instance(void)
virtual QString identifier(void) const
axlAbstractData * outputs(void)
Return the first output of the list.
axlAbstractProcess * process(void)
Return the process.
static bool registered(void)
Class axlDataDynamic defines a dynamic object.
axlDataDynamicWriter(void)
dtkAbstractDataWriter * create(const QString &interface_name)
bool reject(dtkAbstractData *data)
Class axlAbstractField defines an API for arrays of numeric data.
QList< axlAbstractData * > inputs(void)
Return input list;.
QString description(void) const
QList< axlAbstractField * > fields(void)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
virtual QString identifier(void) const
Class axlAbstractData defines an API for all type of axel data.
bool accept(dtkAbstractData *data)