- 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:
@@ -4,10 +4,10 @@
|
||||
* Copyright (C) 2001-2012 by Computer Graphics Group, RWTH Aachen *
|
||||
* www.openmesh.org *
|
||||
* *
|
||||
*---------------------------------------------------------------------------*
|
||||
*---------------------------------------------------------------------------*
|
||||
* This file is part of OpenMesh. *
|
||||
* *
|
||||
* OpenMesh is free software: you can redistribute it and/or modify *
|
||||
* OpenMesh is free software: you can redistribute it and/or modify *
|
||||
* it under the terms of the GNU Lesser General Public License as *
|
||||
* published by the Free Software Foundation, either version 3 of *
|
||||
* the License, or (at your option) any later version with the *
|
||||
@@ -30,10 +30,10 @@
|
||||
* License along with OpenMesh. If not, *
|
||||
* see <http://www.gnu.org/licenses/>. *
|
||||
* *
|
||||
\*===========================================================================*/
|
||||
\*===========================================================================*/
|
||||
|
||||
/*===========================================================================*\
|
||||
* *
|
||||
* *
|
||||
* $Revision$ *
|
||||
* $Date$ *
|
||||
* *
|
||||
@@ -79,12 +79,12 @@ namespace IO {
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** \brief Read a mesh from file _filename.
|
||||
/** \brief Read a mesh from file _filename.
|
||||
|
||||
The file format is determined by the file extension.
|
||||
The file format is determined by the file extension.
|
||||
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
ensure that readers and writers get initialized correctly.
|
||||
|
||||
@param _mesh The target mesh that will be filled with the read data
|
||||
@@ -95,22 +95,22 @@ namespace IO {
|
||||
@return Successful?
|
||||
*/
|
||||
template <class Mesh>
|
||||
bool
|
||||
bool
|
||||
read_mesh(Mesh& _mesh,
|
||||
const std::string& _filename,
|
||||
bool _clear = true)
|
||||
const std::string& _filename,
|
||||
bool _clear = true)
|
||||
{
|
||||
Options opt;
|
||||
return read_mesh(_mesh, _filename, opt, _clear);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Read a mesh from file _filename.
|
||||
/** \brief Read a mesh from file _filename.
|
||||
|
||||
The file format is determined by the file extension.
|
||||
The file format is determined by the file extension.
|
||||
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
ensure that readers and writers get initialized correctly.
|
||||
|
||||
@param _mesh The target mesh that will be filled with the read data
|
||||
@@ -123,25 +123,25 @@ read_mesh(Mesh& _mesh,
|
||||
@return Successful?
|
||||
*/
|
||||
template <class Mesh>
|
||||
bool
|
||||
bool
|
||||
read_mesh(Mesh& _mesh,
|
||||
const std::string& _filename,
|
||||
Options& _opt,
|
||||
bool _clear = true)
|
||||
const std::string& _filename,
|
||||
Options& _opt,
|
||||
bool _clear = true)
|
||||
{
|
||||
if (_clear) _mesh.clear();
|
||||
ImporterT<Mesh> importer(_mesh);
|
||||
return IOManager().read(_filename, importer, _opt);
|
||||
return IOManager().read(_filename, importer, _opt);
|
||||
}
|
||||
|
||||
|
||||
/** \brief Read a mesh from file open std::istream.
|
||||
/** \brief Read a mesh from file open std::istream.
|
||||
|
||||
The file format is determined by parameter _ext. _ext has to include
|
||||
The file format is determined by parameter _ext. _ext has to include
|
||||
".[format]" in order to work properly (e.g. ".OFF")
|
||||
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
ensure that readers and writers get initialized correctly.
|
||||
|
||||
@param _mesh The target mesh that will be filled with the read data
|
||||
@@ -155,16 +155,16 @@ read_mesh(Mesh& _mesh,
|
||||
@return Successful?
|
||||
*/
|
||||
template <class Mesh>
|
||||
bool
|
||||
bool
|
||||
read_mesh(Mesh& _mesh,
|
||||
std::istream& _is,
|
||||
const std::string& _ext,
|
||||
Options& _opt,
|
||||
bool _clear = true)
|
||||
Options& _opt,
|
||||
bool _clear = true)
|
||||
{
|
||||
if (_clear) _mesh.clear();
|
||||
ImporterT<Mesh> importer(_mesh);
|
||||
return IOManager().read(_is,_ext, importer, _opt);
|
||||
return IOManager().read(_is,_ext, importer, _opt);
|
||||
}
|
||||
|
||||
|
||||
@@ -172,12 +172,12 @@ read_mesh(Mesh& _mesh,
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** \brief Write a mesh to the file _filename.
|
||||
/** \brief Write a mesh to the file _filename.
|
||||
|
||||
The file format is determined by _filename's extension.
|
||||
The file format is determined by _filename's extension.
|
||||
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
ensure that readers and writers get initialized correctly.
|
||||
|
||||
@param _mesh The mesh that will be written to file
|
||||
@@ -188,25 +188,26 @@ read_mesh(Mesh& _mesh,
|
||||
@return Successful?
|
||||
*/
|
||||
template <class Mesh>
|
||||
bool write_mesh(const Mesh& _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);
|
||||
}
|
||||
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
|
||||
/** Write a mesh to an open std::ostream.
|
||||
/** Write a mesh to an open std::ostream.
|
||||
|
||||
The file format is determined by parameter _ext. _ext has to include
|
||||
The file format is determined by parameter _ext. _ext has to include
|
||||
".[format]" in order to work properly (e.g. ".OFF")
|
||||
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
\note If you link statically against OpenMesh, you have to add
|
||||
the define OM_STATIC_BUILD to your application. This will
|
||||
ensure that readers and writers get initialized correctly.
|
||||
|
||||
@param _mesh The mesh that will be written to file
|
||||
@@ -218,13 +219,14 @@ bool write_mesh(const Mesh& _mesh,
|
||||
@return Successful?
|
||||
*/
|
||||
template <class Mesh>
|
||||
bool write_mesh(const Mesh& _mesh,
|
||||
std::ostream& _os,
|
||||
const std::string& _ext,
|
||||
Options _opt = Options::Default)
|
||||
{
|
||||
bool write_mesh(const Mesh& _mesh,
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
@@ -246,7 +248,7 @@ bool write_mesh(const Mesh& _mesh,
|
||||
@return Binary size in bytes used when writing the data
|
||||
*/
|
||||
template <class Mesh>
|
||||
size_t binary_size(const Mesh& _mesh,
|
||||
size_t binary_size(const Mesh& _mesh,
|
||||
const std::string& _ext,
|
||||
Options _opt = Options::Default)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user