- added precision option to MeshIO and IOManager

refs #1157

git-svn-id: http://www.openmesh.org/svnrepo/OpenMesh/trunk@748 fdac6126-5c0c-442c-9429-916003d36597
This commit is contained in:
Isaak Lim
2012-10-15 13:52:32 +00:00
parent d370b6e06c
commit 1707f09f0d
3 changed files with 142 additions and 138 deletions

View File

@@ -132,7 +132,7 @@ read(std::istream& _is, const std::string& _ext, BaseImporter& _bi, Options& _op
bool
_IOManager_::
write(const std::string& _filename, BaseExporter& _be, Options _opt)
write(const std::string& _filename, BaseExporter& _be, Options _opt, std::streamsize _precision)
{
std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
@@ -148,7 +148,7 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt)
{
if ((*it)->can_u_write(_filename))
{
return (*it)->write(_filename, _be, _opt);
return (*it)->write(_filename, _be, _opt, _precision);
}
}
@@ -161,7 +161,7 @@ write(const std::string& _filename, BaseExporter& _be, Options _opt)
bool
_IOManager_::
write(std::ostream& _os,const std::string &_ext, BaseExporter& _be, Options _opt)
write(std::ostream& _os,const std::string &_ext, BaseExporter& _be, Options _opt, std::streamsize _precision)
{
std::set<BaseWriter*>::const_iterator it = writer_modules_.begin();
std::set<BaseWriter*>::const_iterator it_end = writer_modules_.end();
@@ -177,7 +177,7 @@ write(std::ostream& _os,const std::string &_ext, BaseExporter& _be, Options _opt
{
if ((*it)->BaseWriter::can_u_write(_ext)) //Restrict test to the extension check
{
return (*it)->write(_os, _be, _opt);
return (*it)->write(_os, _be, _opt, _precision);
}
}

View File

@@ -138,7 +138,8 @@ public:
*/
bool write(const std::string& _filename,
BaseExporter& _be,
Options _opt=Options::Default);
Options _opt=Options::Default,
std::streamsize _precision = 6);
/** Write a mesh to open std::ostream _os. The source data structure is specified
by the given BaseExporter. The \c save method consecutively queries all
@@ -149,7 +150,8 @@ public:
bool write(std::ostream& _filename,
const std::string& _ext,
BaseExporter& _be,
Options _opt=Options::Default);
Options _opt=Options::Default,
std::streamsize _precision = 6);
/// Returns true if the format is supported by one of the reader modules.

View File

@@ -190,10 +190,11 @@ read_mesh(Mesh& _mesh,
template <class Mesh>
bool write_mesh(const Mesh& _mesh,
const std::string& _filename,
Options _opt = Options::Default)
Options _opt = Options::Default,
std::streamsize _precision = 6)
{
ExporterT<Mesh> exporter(_mesh);
return IOManager().write(_filename, exporter, _opt);
return IOManager().write(_filename, exporter, _opt, _precision);
}
@@ -219,12 +220,13 @@ bool write_mesh(const Mesh& _mesh,
*/
template <class Mesh>
bool write_mesh(const Mesh& _mesh,
std::ostream& _os,
const std::string& _ext,
Options _opt = Options::Default)
std::ostream& _os,
const std::string& _ext,
Options _opt = Options::Default,
std::streamsize _precision = 6)
{
ExporterT<Mesh> exporter(_mesh);
return IOManager().write(_os,_ext, exporter, _opt);
return IOManager().write(_os,_ext, exporter, _opt, _precision);
}