Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

MeshIO.hh

00001 /*===========================================================================*\
00002  *                                                                           *
00003  *                               OpenMesh                                    *
00004  *      Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen      *
00005  *                           www.openmesh.org                                *
00006  *                                                                           *
00007  *---------------------------------------------------------------------------* 
00008  *                                                                           *
00009  *                                License                                    *
00010  *                                                                           *
00011  *  This library is free software; you can redistribute it and/or modify it  *
00012  *  under the terms of the GNU Library General Public License as published   *
00013  *  by the Free Software Foundation, version 2.                              *
00014  *                                                                           *
00015  *  This library is distributed in the hope that it will be useful, but      *
00016  *  WITHOUT ANY WARRANTY; without even the implied warranty of               *
00017  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU        *
00018  *  Library General Public License for more details.                         *
00019  *                                                                           *
00020  *  You should have received a copy of the GNU Library General Public        *
00021  *  License along with this library; if not, write to the Free Software      *
00022  *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.                *
00023  *                                                                           *
00024 \*===========================================================================*/
00025 
00026 
00027 #ifndef OM_MESHIO_HH
00028 #define OM_MESHIO_HH
00029 
00030 
00031 //=== INCLUDES ================================================================
00032 
00033 // -------------------- system settings
00034 #include <OpenMesh/Core/System/config.hh>
00035 // -------------------- check include order
00036 #if defined (OPENMESH_TRIMESH_ARRAY_KERNEL_HH) || \
00037     defined (OPENMESH_POLYMESH_ARRAY_KERNEL_HH)
00038 #  error "Include MeshIO.hh before including a mesh type!"
00039 #endif
00040 // -------------------- OpenMesh
00041 #include <OpenMesh/Core/IO/SR_store.hh>
00042 #include <OpenMesh/Core/IO/IOManager.hh>
00043 #include <OpenMesh/Core/IO/importer/ImporterT.hh>
00044 #include <OpenMesh/Core/IO/exporter/ExporterT.hh>
00045 
00046 
00047 //== NAMESPACES ==============================================================
00048 
00049 namespace OpenMesh {
00050 namespace IO   {
00051 
00052 
00053 //=== IMPLEMENTATION ==========================================================
00054 
00055 
00061 
00062 
00063 //-----------------------------------------------------------------------------
00064 
00065 
00068 template <class Mesh>
00069 bool 
00070 read_mesh(Mesh&               _mesh, 
00071           const std::string&  _filename, 
00072           bool                _clear = true) 
00073 {
00074   Options opt;
00075   return read_mesh(_mesh, _filename, opt, _clear);
00076 }
00077 
00078 
00081 template <class Mesh>
00082 bool 
00083 read_mesh(Mesh&               _mesh, 
00084           const std::string&  _filename, 
00085           Options&            _opt, 
00086           bool                _clear = true) 
00087 {
00088   if (_clear) _mesh.clear();
00089   ImporterT<Mesh> importer(_mesh);
00090   return IOManager().read(_filename, importer, _opt); 
00091 }
00092 
00093 
00094 //-----------------------------------------------------------------------------
00095 
00096 
00099 template <class Mesh>
00100 bool write_mesh(const Mesh& _mesh, const std::string& _filename,
00101                 Options _opt = Options::Default) 
00102 { 
00103   ExporterT<Mesh> exporter(_mesh);
00104   return IOManager().write(_filename, exporter, _opt); 
00105 }
00106 
00107 
00108 //-----------------------------------------------------------------------------
00109 
00110 
00111 template <class Mesh>
00112 size_t binary_size(const Mesh& _mesh, const std::string& _format,
00113                    Options _opt = Options::Default)
00114 {
00115   ExporterT<Mesh> exporter(_mesh);
00116   return IOManager().binary_size(_format, exporter, _opt);
00117 }
00118 
00119 
00120 //-----------------------------------------------------------------------------
00121 
00123 
00124 
00125 //=============================================================================
00126 } // namespace IO
00127 } // namespace OpenMesh
00128 //=============================================================================
00129 #if defined(OM_STATIC_BUILD) || defined(ARCH_DARWIN)
00130 #  include <OpenMesh/Core/IO/IOInstances.hh>
00131 #endif
00132 //=============================================================================
00133 #endif
00134 //=============================================================================

acg pic Project OpenMesh, ©  Computer Graphics Group, RWTH Aachen. Documentation generated using doxygen .