26 #include <dtkCoreSupport/dtkAbstractData.h>
27 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
43 return "axlCircleArcWriter";
47 return "axlCircleArcWriter";
51 return QStringList() <<
"axlCircleArc";
55 return dtkAbstractDataFactory::instance()->registerDataWriterType(
"axlCircleArcWriter", QStringList(),
createaxlCircleArcWriter);
66 return !this->
accept(data);
75 QDomElement arcElement = doc->createElement(
"arc");
76 arcElement.setAttribute(
"name", arc->name());
79 arcElement.setAttribute(
"size", QString::number(arc->
size()));
82 QColor qcolor = arc->
color();
84 QTextStream(&color) << QString::number(qcolor.red()) <<
" "
85 << QString::number(qcolor.green()) <<
" "
86 << QString::number(qcolor.blue()) <<
" "
87 << QString::number(arc->
opacity());
88 arcElement.setAttribute(
"color", color);
91 QString shader = arc->
shader();
92 QFileInfo shaderFileInfo(shader);
93 arcElement.setAttribute(
"shader", shaderFileInfo.fileName());
97 QDomElement point1Element = doc->createElement(
"point1");
99 QTextStream(&point1Str) << QString::number(arc->
point1().
x()) <<
" "
100 << QString::number(arc->
point1().
y()) <<
" "
101 << QString::number(arc->
point1().
z());
102 QDomText point1DomText = doc->createTextNode(point1Str);
103 point1Element.appendChild(point1DomText);
105 arcElement.appendChild(point1Element);
108 QDomElement Point2Element = doc->createElement(
"point2");
110 QTextStream(&Point2Str) << QString::number(arc->
point2().
x()) <<
" "
111 << QString::number(arc->
point2().
y()) <<
" "
112 << QString::number(arc->
point2().
z());
113 QDomText Point2DomText = doc->createTextNode(Point2Str);
114 Point2Element.appendChild(Point2DomText);
116 arcElement.appendChild(Point2Element);
119 QDomElement centerElement = doc->createElement(
"center");
121 QTextStream(¢erStr) << QString::number(arc->
center().
x()) <<
" "
122 << QString::number(arc->
center().
y()) <<
" "
123 << QString::number(arc->
center().
z());
124 QDomText centerDomText = doc->createTextNode(centerStr);
125 centerElement.appendChild(centerDomText);
127 arcElement.appendChild(centerElement);
130 QDomElement normalElement = doc->createElement(
"normal");
132 QTextStream(&normalStr) << QString::number(arc->
normal().
x()) <<
" "
133 << QString::number(arc->
normal().
y()) <<
" "
134 << QString::number(arc->
normal().
z());
135 QDomText normalDomText = doc->createTextNode(normalStr);
136 normalElement.appendChild(normalDomText);
138 arcElement.appendChild(normalElement);
141 QDomElement cCWElement = doc->createElement(
"ccw");
143 QTextStream(&cCWStr) << arc->
isDirect();
144 QDomText cCWDomText = doc->createTextNode(cCWStr);
145 cCWElement.appendChild(cCWDomText);
147 arcElement.appendChild(cCWElement);
151 if(!arc->
fields().isEmpty()){
154 QDomElement fieldElement = field_writer->
write(doc, field);
155 arcElement.appendChild(fieldElement);
162 QDomElement axlCircleArcWriter::elementByWriter(
axlAbstractDataWriter *axl_writer, QDomDocument *doc, dtkAbstractData *data) {
167 if(!axl_writer->
accept(data))
170 element = axl_writer->
write(doc, data);
bool isDirect(void) const
axlPoint point1(void) const
bool accept(dtkAbstractData *data)
virtual bool accept(dtkAbstractData *data)=0
QStringList handled(void) const
QDomElement write(QDomDocument *doc, dtkAbstractData *data)
QString description(void) const
static axlFieldWritersFactory * instance(void)
axlPoint center(void) const
QString identifier(void) const
virtual QString identifier(void) const
dtkAbstractDataWriter * createaxlCircleArcWriter(void)
dtkAbstractDataWriter * create(const QString &interface_name)
axlPoint point2(void) const
bool reject(dtkAbstractData *data)
Class axlAbstractField defines an API for arrays of numeric data.
virtual ~axlCircleArcWriter(void)
static bool registered(void)
axlPoint normal(void) const
QList< axlAbstractField * > fields(void)
virtual QDomElement write(QDomDocument *doc, dtkAbstractData *data)=0