60 #include <OpenMesh/Core/IO/IOManager.hh>
85 return __IOManager_instance;
94 std::set<BaseReader*>::const_iterator it = reader_modules_.begin();
95 std::set<BaseReader*>::const_iterator it_end = reader_modules_.end();
99 omerr() <<
"[OpenMesh::IO::_IOManager_] No reading modules available!\n";
104 for(; it != it_end; ++it)
105 if ((*it)->can_u_read(_filename))
108 bool ok = (*it)->read(_filename, _bi, _opt);
125 std::set<BaseReader*>::const_iterator it = reader_modules_.begin();
126 std::set<BaseReader*>::const_iterator it_end = reader_modules_.end();
129 for(; it != it_end; ++it)
130 if ((*it)->BaseReader::can_u_read(_ext))
133 bool ok = (*it)->read(_is, _bi, _opt);
150 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
151 std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
155 omerr() <<
"[OpenMesh::IO::_IOManager_] No writing modules available!\n";
160 for(; it != it_end; ++it)
162 if ((*it)->can_u_write(_filename))
164 return (*it)->write(_filename, _be, _opt, _precision);
179 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
180 std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
184 omerr() <<
"[OpenMesh::IO::_IOManager_] No writing modules available!\n";
189 for(; it != it_end; ++it)
191 if ((*it)->BaseWriter::can_u_write(_ext))
193 return (*it)->write(_os, _be, _opt, _precision);
208 std::set<BaseReader*>::const_iterator it = reader_modules_.begin();
209 std::set<BaseReader*>::const_iterator it_end = reader_modules_.end();
210 std::string filename =
"dummy." + _format;
212 for(; it != it_end; ++it)
213 if ((*it)->can_u_read(filename))
227 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
228 std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
229 std::string filename =
"dummy." + _format;
232 for(; it != it_end; ++it)
233 if ((*it)->can_u_write(filename))
245 find_writer(
const std::string& _format)
249 string::size_type
dot = _format.rfind(
'.');
252 if (dot == string::npos)
255 ext = _format.substr(dot+1,_format.length()-(dot+1));
257 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
258 std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
259 std::string filename =
"dummy." + ext;
262 for(; it != it_end; ++it)
263 if ((*it)->can_u_write(filename))
275 update_read_filters()
277 std::set<BaseReader*>::const_iterator it = reader_modules_.begin(),
278 it_end = reader_modules_.end();
279 std::string all =
"";
280 std::string filters =
"";
282 for(; it != it_end; ++it)
286 std::string tmp =
" ";
288 filters += (*it)->get_description() +
" (";
290 std::istringstream iss((*it)->get_extensions());
292 while (iss && !iss.eof() && (iss >> tmp) )
294 tmp =
" *." + tmp; filters += tmp; all += tmp;
300 all =
"All files ( " + all +
" );;";
302 read_filters_ = all + filters;
311 update_write_filters()
313 std::set<BaseWriter*>::const_iterator it = writer_modules_.begin(),
314 it_end = writer_modules_.end();
318 for(; it != it_end; ++it)
324 filters += (*it)->get_description() +
" (";
326 std::istringstream iss((*it)->get_extensions());
327 while (iss && !iss.eof() && (iss >> s))
328 { s =
" *." + s; filters += s; all += s; }
332 all =
"All files ( " + all +
" );;";
334 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.
Set options for reader/writer modules.
osg::Vec3f::ValueType dot(const osg::Vec3f &_v1, const osg::Vec3f &_v2)
Adapter for osg vector member computing a scalar product.
bool write(const std::string &_filename, BaseExporter &_be, Options _opt=Options::Default, std::streamsize _precision=6)
bool read(const std::string &_filename, BaseImporter &_bi, Options &_opt)
bool can_read(const std::string &_format) const
Returns true if the format is supported by one of the reader modules.
_IOManager_ & IOManager()