21 #include <dtkCoreSupport/dtkAbstractData.h> 
   22 #include <dtkCoreSupport/dtkAbstractDataFactory.h> 
   44     return "axlShapeReader";
 
   48     return "axlShapeReader";
 
   52     return QStringList() << 
"axlShape";
 
   56     return dtkAbstractDataFactory::instance()->registerDataReaderType(
"axlShapeReader", QStringList(), 
createaxlShapeReader);
 
   60     QDomElement element = node.toElement();
 
   62     if (element.tagName() != 
"shape")
 
   69     return !this->
accept(node);
 
   74     QDomElement element = node.toElement();
 
   77     int vertexCount = element.attribute(
"nb_vertices").toInt();
 
   78     int edgeCount = element.attribute(
"nb_edges").toInt();
 
   79     int faceCount = element.attribute(
"nb_faces").toInt();
 
   83     QString name = element.attribute(
"name");
 
   84     if (!name.isEmpty()) {
 
   85         shape->setObjectName(name);
 
   89     QString color = element.attribute(
"color");
 
   90     if (!color.isEmpty()) {
 
   91         QStringList colorList = color.split(
" ");
 
   92         if (colorList.size() > 2) 
 
   93             shape->
setColor(QColor(colorList.at(0).toInt(), colorList.at(1).toInt(), colorList.at(2).toInt()));
 
   94         if (colorList.size() == 4)
 
   99     QString shader = element.attribute(
"shader");
 
  101     if (!shader.isEmpty()) {
 
  103         dirShader = 
":axlShader/shader/" + shader;
 
  104         if (!QFile::exists(dirShader)) {
 
  105             QSettings settings(
"inria", 
"dtk");
 
  107             settings.beginGroup(
"shader");
 
  108             dirShader = settings.value(
"path", defaultPath).toString();
 
  109             dirShader.append(
"/" + shader);
 
  115     QString size = element.attribute(
"size");
 
  117         shape->
setSize(size.toFloat());
 
  120     QDomElement verticesElement = element.elementsByTagName(
"vertices").at(0).toElement();
 
  121     QStringList verticesList = verticesElement.text().simplified().split(QRegExp(
"\\s+"));
 
  122     for (
int k = 0; k < verticesList.size(); k+=3) {
 
  124                                           verticesList.at(k+1).toDouble(),
 
  125                                           verticesList.at(k+2).toDouble());
 
  130     QDomElement edgesElement = element.elementsByTagName(
"edges").at(0).toElement();
 
  131     QDomNodeList edgesList = edgesElement.elementsByTagName(
"edge");
 
  133     for (
int k = 0; k < edgesList.size(); k++) {
 
  134         QDomElement edgeElement = edgesList.at(k).toElement();
 
  138         newEdge->
indexEndVertex = edgeElement.attribute(
"index_end").toInt();
 
  142         QString curveReaderTag = edgeElement.attribute(
"type")+
"Reader";
 
  148             shape->
insert_edge(newEdge, edgeElement.attribute(
"id").toInt());
 
  149             dtkWarn()<<
"axlShapeReader::read"<< curveReaderTag;
 
  151             dtkWarn()<< 
"Error within axlShapeReader::read edge:" << curveReaderTag << 
"is not registered within readers.";
 
  156     QDomElement facesElement = element.elementsByTagName(
"faces").at(0).toElement();
 
  157     QDomNodeList facesList = facesElement.elementsByTagName(
"face");
 
  159     for (
int k = 0; k < facesList.size(); k++) {
 
  160         QDomElement faceElement = facesList.at(k).toElement();
 
  163         QDomNodeList loopsList = faceElement.elementsByTagName(
"loop");
 
  167         QString surfaceReaderTag = faceElement.attribute(
"type")+
"Reader";
 
  178             dtkWarn() << 
"Error within axlShapeReader::read face:" << surfaceReaderTag << 
"is not registered within readers.";
 
  184         for (
int i = 0; i < loopsList.size(); i++) {
 
  185             QDomElement loopElement = loopsList.at(i).toElement();
 
  188             QDomNodeList edgesList = loopElement.elementsByTagName(
"edge");
 
  190             for (
int j = 0; j < edgesList.size(); j++) {
 
  191                 QDomElement edgeElement = edgesList.at(j).toElement();
 
  193                 loop->
edges << edgeElement.attribute(
"id").toInt();
 
  195                 bool currOrientation = edgeElement.attribute(
"orientation").toInt();
 
  201         shape->
insert_face(face, faceElement.attribute(
"id").toInt());
 
Class axlPoint defines 3D points. 
 
axlAbstractCurveParametric * curve
Pointer to the parametric curve supporting the edge, of type axlAbstractCurveParametric. 
 
virtual ~axlShapeReader(void)
 
int indexStartVertex
Index of the starting point of the edge in the array of vertices of the axlShape. ...
 
QVector< int > edges
Vector of indices of the edges of the loop in the array of edges of the axlShape. ...
 
QString description(void) const 
 
Class axlPlane defines 3D planes. 
 
void setShader(const QString &shader)
 
void insert_face(Face *face, int index)
 
bool reject(const QDomNode &node)
 
void insert_edge(Edge *edge, int index)
 
Generic interface for parametric curve. 
 
virtual axlAbstractData * read(const QDomNode &node)=0
 
int indexEndVertex
Index of the ending point of the edge in the array of vertices of the axlShape. 
 
bool accept(const QDomNode &node)
 
QStringList handled(void) const 
 
QVector< bool > orientations
Vector of booleans of the same size as edges: true means the direct orientation, false is the reverse...
 
axlAbstractSurfaceParametric * surface
Pointer to the supporting surface of type axlAbstractSurfaceParametric. 
 
axlAbstractData * read(const QDomNode &node)
 
static bool registered(void)
 
QVector< Loop * > loops
Vector of all the loops defining the face. 
 
void setOpacity(const double &opacity)
 
void insert_vertex(axlPoint *vertex, int index)
 
dtkAbstractDataReader * createaxlShapeReader(void)
 
void setSize(const double &size)
 
void setColor(double r, double g, double b)
 
Class axlAbstractData defines an API for all type of axel data. 
 
QString identifier(void) const