55 #include <OpenMesh/Core/IO/IOManager.hh> 80 return __IOManager_instance;
89 std::set<BaseReader*>::const_iterator it = reader_modules_.begin();
90 std::set<BaseReader*>::const_iterator it_end = reader_modules_.end();
94 omerr() <<
"[OpenMesh::IO::_IOManager_] No reading modules available!\n";
99 for(; it != it_end; ++it)
100 if ((*it)->can_u_read(_filename))
103 bool ok = (*it)->read(_filename, _bi, _opt);
120 std::set<BaseReader*>::const_iterator it = reader_modules_.begin();
121 std::set<BaseReader*>::const_iterator it_end = reader_modules_.end();
124 for(; it != it_end; ++it)
125 if ((*it)->BaseReader::can_u_read(_ext))
128 bool ok = (*it)->read(_is, _bi, _opt);
145 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
146 std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
150 omerr() <<
"[OpenMesh::IO::_IOManager_] No writing modules available!\n";
155 for(; it != it_end; ++it)
157 if ((*it)->can_u_write(_filename))
159 return (*it)->write(_filename, _be, _opt, _precision);
174 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
175 std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
179 omerr() <<
"[OpenMesh::IO::_IOManager_] No writing modules available!\n";
184 for(; it != it_end; ++it)
186 if ((*it)->BaseWriter::can_u_write(_ext))
188 return (*it)->write(_os, _be, _opt, _precision);
203 std::set<BaseReader*>::const_iterator it = reader_modules_.begin();
204 std::set<BaseReader*>::const_iterator it_end = reader_modules_.end();
205 std::string filename =
"dummy." + _format;
207 for(; it != it_end; ++it)
208 if ((*it)->can_u_read(filename))
222 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
223 std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
224 std::string filename =
"dummy." + _format;
227 for(; it != it_end; ++it)
228 if ((*it)->can_u_write(filename))
240 find_writer(
const std::string& _format)
244 string::size_type
dot = _format.rfind(
'.');
247 if (dot == string::npos)
250 ext = _format.substr(dot+1,_format.length()-(dot+1));
252 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
253 std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
254 std::string filename =
"dummy." + ext;
257 for(; it != it_end; ++it)
258 if ((*it)->can_u_write(filename))
270 update_read_filters()
272 std::set<BaseReader*>::const_iterator it = reader_modules_.begin(),
273 it_end = reader_modules_.end();
274 std::string all =
"";
275 std::string filters =
"";
277 for(; it != it_end; ++it)
281 std::string tmp =
" ";
283 filters += (*it)->get_description() +
" (";
285 std::istringstream iss((*it)->get_extensions());
287 while (iss && !iss.eof() && (iss >> tmp) )
289 tmp =
" *." + tmp; filters += tmp; all += tmp;
295 all =
"All files ( " + all +
" );;";
297 read_filters_ = all + filters;
306 update_write_filters()
308 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin(),
309 it_end = writer_modules_.end();
313 for(; it != it_end; ++it)
319 filters += (*it)->get_description() +
" (";
321 std::istringstream iss((*it)->get_extensions());
322 while (iss && !iss.eof() && (iss >> s))
323 { s =
" *." + s; filters += s; all += s; }
327 all =
"All files ( " + all +
" );;";
329 write_filters_ = all + filters;
bool can_write(const std::string &_format) const
Returns true if the format is supported by one of the writer modules.
bool can_read(const std::string &_format) const
Returns true if the format is supported by one of the reader modules.
_IOManager_ & IOManager()
osg::Vec3f::ValueType dot(const osg::Vec3f &_v1, const osg::Vec3f &_v2)
Adapter for osg vector member computing a scalar product.
bool read(const std::string &_filename, BaseImporter &_bi, Options &_opt)
Set options for reader/writer modules.
bool write(const std::string &_filename, BaseExporter &_be, Options _opt=Options::Default, std::streamsize _precision=6)