26 #include <dtkCoreSupport/dtkAbstractData.h>
27 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
47 return "axlConeWriter";
52 return "axlConeWriter";
57 return QStringList() <<
"axlCone";
62 return dtkAbstractDataFactory::instance()->registerDataWriterType(
"axlConeWriter", QStringList(),
createaxlConeWriter);
76 return !this->
accept(data);
84 QDomElement coneElement = doc->createElement(
"cone");
85 coneElement.setAttribute(
"name",cone->name());
89 coneElement.setAttribute(
"size", QString::number(cone->
size()));
94 QColor qcolor = cone->
color();
96 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
97 << QString::number(qcolor.green()) <<
" "
98 << QString::number(qcolor.blue()) <<
" "
99 << QString::number(cone->
opacity());
100 coneElement.setAttribute(
"color", color);
103 QString shader = cone->
shader();
104 QFileInfo shaderFileInfo(shader);
105 coneElement.setAttribute(
"shader", shaderFileInfo.fileName());
109 QDomElement apex = doc->createElement(
"point");
111 QTextStream(&apexStr) << QString::number(cone->
apex()->
x()) <<
" "<< QString::number(cone->
apex()->
y()) <<
" "<< QString::number(cone->
apex()->
z());
112 QDomText apexDomText = doc->createTextNode(apexStr);
113 apex.appendChild(apexDomText);
115 coneElement.appendChild(apex);
118 QDomElement basePoint = doc->createElement(
"point");
119 QString basePointStr;
120 QTextStream(&basePointStr) << QString::number(cone->
basePoint()->
x()) <<
" "<< QString::number(cone->
basePoint()->
y()) <<
" "<< QString::number(cone->
basePoint()->
z());
121 QDomText basePointDomText = doc->createTextNode(basePointStr);
122 basePoint.appendChild(basePointDomText);
124 coneElement.appendChild(basePoint);
127 QDomElement radius = doc->createElement(
"radius");
129 QTextStream(&radiusStr) << QString::number(cone->
radius());
130 QDomText radiusDomText = doc->createTextNode(radiusStr);
131 radius.appendChild(radiusDomText);
133 coneElement.appendChild(radius);
136 if(!cone->
fields().isEmpty()){
139 QDomElement fieldElement = field_writer->
write(doc, field);
140 coneElement.appendChild(fieldElement);
149 QDomElement axlConeWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data)
156 if(!axl_writer->
accept(data))
159 element = axl_writer->
write(doc, data);
bool reject(dtkAbstractData *data)
QString identifier(void) const
virtual bool accept(dtkAbstractData *data)=0
static axlFieldWritersFactory * instance(void)
virtual QString identifier(void) const
QString description(void) const
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
static bool registered(void)
dtkAbstractDataWriter * create(const QString &interface_name)
Class axlAbstractField defines an API for arrays of numeric data.
bool accept(dtkAbstractData *data)
QStringList handled(void) const
Class axlCone defines 3D cones.
QList< axlAbstractField * > fields(void)
dtkAbstractDataWriter * createaxlConeWriter(void)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0