19 #include <dtkCoreSupport/dtkAbstractData.h>
20 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
40 return "axlVolumeDiscreteWriter";
45 return "axlVolumeDiscreteWriter";
50 return QStringList() <<
"axlVolumeDiscrete";
69 return !this->
accept(data);
77 QDomElement volumeElement = doc->createElement(
"volume");
79 volumeElement.setAttribute(
"type",
"discrete");
80 volumeElement.setAttribute(
"name",volume->name());
84 QDomElement dimension = doc->createElement(
"dimension");
85 QString dimensionValue;
86 QTextStream(&dimensionValue) << QString::number(volume->
xDimension()) <<
" "<< QString::number(volume->
yDimension()) <<
" "<< QString::number(volume->
zDimension());
88 QDomText dimensionDomText = doc->createTextNode(dimensionValue);
90 dimension.appendChild(dimensionDomText);
91 volumeElement.appendChild(dimension);
95 QDomElement values = doc->createElement(
"values");
100 for(
int i = 0;i < nx;i++){
101 for(
int j = 0;j < ny;j++){
102 for(
int k = 0;k < nz;k++){
104 QTextStream(&scalarValues)<<
"\n" << QString::number(volume->
getValue(i,j,k)) ;
109 QTextStream(&scalarValues) <<
"\n";
110 QDomText scalarDomText = doc->createTextNode(scalarValues);
112 values.appendChild(scalarDomText);
113 volumeElement.appendChild(values);
117 return volumeElement;
121 QDomElement axlVolumeDiscreteWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data)
128 if(!axl_writer->
accept(data))
131 element = axl_writer->
write(doc, data);
double getValue(int i, int j, int k) const
dtkAbstractDataWriter * createaxlVolumeDiscreteWriter(void)
virtual bool accept(dtkAbstractData *data)=0
int yDimension(void) const
bool accept(dtkAbstractData *data)
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
int xDimension(void) const
int zDimension(void) const
bool reject(dtkAbstractData *data)
QString description(void) const
QStringList handled(void) const
QString identifier(void) const
static bool registered(void)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0
axlVolumeDiscreteWriter(void)
~axlVolumeDiscreteWriter(void)
static dtkAbstractDataFactory * dataFactSingleton