7 #include <dtkCoreSupport/dtkAbstractData.h>
8 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
26 return "axlSurfaceRevolutionReader";
30 return "axlSurfaceRevolutionReader";
34 return QStringList() <<
"axlSurfaceRevolution";
42 QDomElement element = node.toElement();
44 if (element.tagName() !=
"surface_revolution")
51 return !this->
accept(node);
56 QDomElement element = node.toElement();
61 QString name = element.attribute(
"name");
62 if (!name.isEmpty()) {
63 surRev->setObjectName(name);
67 QString color = element.attribute(
"color");
68 if (!color.isEmpty()) {
69 QStringList colorList = color.split(
" ");
70 if (colorList.size() > 2)
71 surRev->
setColor(QColor(colorList.at(0).toInt(), colorList.at(1).toInt(), colorList.at(2).toInt()));
72 if (colorList.size() == 4)
77 QString shader = element.attribute(
"shader");
79 if (!shader.isEmpty()) {
81 dirShader =
":axlShader/shader/" + shader;
82 if (!QFile::exists(dirShader)) {
83 QSettings settings(
"inria",
"dtk");
85 settings.beginGroup(
"shader");
86 dirShader = settings.value(
"path", defaultPath).toString();
87 dirShader.append(
"/" + shader);
93 QString size = element.attribute(
"size");
95 surRev->
setSize(size.toFloat());
99 QDomElement axeElement = element.elementsByTagName(
"axe").at(0).toElement();
105 QList<axlAbstractCurve *> curveList;
106 QDomElement curvesElement = element.elementsByTagName(
"curves").at(0).toElement();
107 QDomNodeList curvelistElement = curvesElement.elementsByTagName(
"curve");
108 for(
int i = 0; i<curvelistElement.size(); i++) {
109 QDomElement curveElement = curvelistElement.at(i).toElement();
110 QString curveReaderTag = curveElement.attribute(
"type")+
"Reader";
113 curveList.append(curve);
119 QDomElement angleElement = element.elementsByTagName(
"angle").at(0).toElement();
120 double startAngle = angleElement.attribute(
"start_angle").toDouble();
121 double endAngle = angleElement.attribute(
"end_angle").toDouble();
122 surRev->
setAngle(startAngle,endAngle);
static bool registered(void)
Class axlLine defines 3D lines.
axlAbstractData * read(const QDomNode &node)
void setShader(const QString &shader)
QString description(void) const
axlAbstractData * read(const QDomNode &node)
void setAxe(axlLine *line)
bool reject(const QDomNode &node)
dtkAbstractDataReader * createaxlSurfaceRevolutionReader(void)
void setCurves(QList< axlAbstractCurve * > curves)
virtual axlAbstractData * read(const QDomNode &node)=0
QStringList handled(void) const
bool accept(const QDomNode &node)
void setAngle(double startAngle, double endAngle)
void setOpacity(const double &opacity)
QString identifier(void) const
virtual ~axlSurfaceRevolutionReader(void)
void setSize(const double &size)
void setColor(double r, double g, double b)
axlSurfaceRevolutionReader(void)
Class axlAbstractData defines an API for all type of axel data.