17 #include <dtkCoreSupport/dtkAbstractData.h>
18 #include <dtkCoreSupport/dtkAbstractDataFactory.h>
52 return "axlOFFWriter";
62 return "axlOFFWriter";
72 return QStringList() <<
".off" <<
"off document";
83 return dtkAbstractDataFactory::instance()->registerDataWriterType(
"axlOFFWriter", QStringList(),
createaxlOFFWriter);
92 return (file.endsWith(
".off"));
102 QFile filename(file);
103 QTextStream os( &filename);
105 if( !filename.open(QIODevice::WriteOnly | QIODevice::Text)) {
106 QMessageBox::information(0,
"Axel",
"Error of writing",
"&Ok",0) ;
115 int numberElement = data->
count();
117 for(
int i = 0 ; i < numberElement ; i++)
119 bool founded =
false;
126 foreach(QString converter, dtkAbstractDataFactory::instance()->converters())
131 axl_converter->setData(data->
get(i));
132 currentMesh = axl_converter->
toMesh();
153 if ( (currentMesh = dynamic_cast<axlMesh*>(data->
get(i))) ) {
159 mesh->
append(currentMesh);
172 os <<
"# "<< file <<
"\n";
173 os <<
"# This file was created with axelModeler.\n";
174 os <<
"# Go to http://axl.inria.fr for more information.\n";
185 os << p.
x() <<
" " << p.
y() <<
" " << p.
z()<<
"\n";
190 QVector<int> face = mesh->
face(i);
193 for(
int j = 0 ; j < face.size(); j++)
195 os <<
" " << face.at(j);
Class axlPoint defines 3D points.
QString identifier(void) const
Return the identifier "axlOFFWriter".
int face_count(void) const
static bool registered(void)
Register the writer in the factory.
void append(axlMesh *mesh)
QString description(void) const
Return a description of the writer.
bool canWrite(const QString &file)
Check if the writer can write the file.
int edge_count(void) const
void vertex(const int &ind, double vertex[3])
set vertex values of vertices with index ind.
QStringList handled(void) const
Return the appropriate extension of files (.off) written by this writer.
dtkAbstractDataWriter * createaxlOFFWriter(void)
bool write(const QString &file)
Write the .off file.
virtual axlMesh * toMesh(void)
Mesh conversion.
int vertex_count(void) const
bool get(dtkAbstractData *data)
Class axlMesh defines a piecewise-linear 3D object.