21 #include <dtkCoreSupport/dtkAbstractData.h>
22 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
45 return "axlOFFReader";
55 return "axlOFFReader";
65 return QStringList() <<
".off" <<
"off document";
75 return dtkAbstractDataFactory::instance()->registerDataReaderType(
"axlOFFReader", QStringList(),
createaxlOFFReader);
86 if (filename.open(QFile::ReadOnly))
88 QTextStream in(&filename);
92 QVector<int> currentFace;
94 format = in.readLine(75);
96 if(format.startsWith(
"OFF") || format.startsWith(
"off") || format.startsWith(
"Off")){
111 QFile filename(file);
112 if (filename.open(QFile::ReadOnly))
114 QTextStream in(&filename);
120 bool intConvert =
false;
126 QVector<int> currentFace;
127 int currentFaceSize = 0;
128 int currentFaceIndex = 0;
130 format = in.readLine(75);
132 if(format.startsWith(
"OFF") || format.startsWith(
"off") || format.startsWith(
"Off"))
142 vertexCount = format.toInt(&intConvert);
151 for(
int i = 0 ; i < vertexCount ; i++)
164 for(
int i = 0 ; i < faceCount+edgeCount ; i++)
168 in >> currentFaceSize;
170 if(currentFaceSize == 1){
171 for(
int j = 0 ; j < 2 ; j++)
174 in >> currentFaceIndex;
175 currentFace << currentFaceIndex;
183 for(
int j = 0 ; j < currentFaceSize ; j++)
186 in >> currentFaceIndex;
187 currentFace << currentFaceIndex;
int face_count(void) const
QString description(void) const
Return a description of the reader.
bool read(const QString &file)
Read the file which is supposed to be of right type OFF and create a data.
bool vertex_show(void) const
void push_back_edge(int, int)
static bool registered(void)
Register this reader type in the factory.
bool edge_show(void) const
int edge_count(void) const
QString identifier(void) const
Return the identifier "axlOFFReader".
bool face_show(void) const
void push_back_face(const Face &face)
int vertex_count(void) const
dtkAbstractDataReader * createaxlOFFReader(void)
QStringList handled(void) const
Return the type of file that the reader is able to read : "OFF files (.OFF, .off)" ...
Class axlMesh defines a piecewise-linear 3D object.
void push_back_vertex(const double &x, const double &y, const double &z)
Add a new vertex to the mesh.
bool canRead(const QString &file)
Check that the file can be read by this type of reader.