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

ModProgMeshT.hh

Go to the documentation of this file.
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 //   $Revision: 1.2 $
00027 //   $Date: 2005/04/18 09:07:11 $
00028 //
00029 //=============================================================================
00030 
00035 //=============================================================================
00036 //
00037 //  CLASS ModProgMeshT
00038 //
00039 //=============================================================================
00040 
00041 #ifndef OPENMESH_TOOLS_MODPROGMESHT_HH
00042 #define OPENMESH_TOOLS_MODPROGMESHT_HH
00043 
00044 
00045 //== INCLUDES =================================================================
00046 
00047 #include <OpenMesh/Tools/Decimater/ModBaseT.hh>
00048 #include <OpenMesh/Core/Utils/Property.hh>
00049 
00050 
00051 //== NAMESPACE ================================================================
00052 
00053 namespace OpenMesh  {
00054 namespace Decimater {
00055 
00056 
00057 //== CLASS DEFINITION =========================================================
00058 
00059 
00066 template <class DecimaterType>
00067 class ModProgMeshT : public ModBaseT<DecimaterType>
00068 {
00069 public:
00070 
00071   DECIMATING_MODULE( ModProgMeshT, DecimaterType, ProgMesh );
00072 
00076   struct Info
00077   {
00080     Info( const CollapseInfo& _ci )
00081       : v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr)
00082     {}
00083 
00084     typename Mesh::VertexHandle v0; 
00085     typename Mesh::VertexHandle v1; 
00086     typename Mesh::VertexHandle vl; 
00087     typename Mesh::VertexHandle vr; 
00088 
00089   };
00090 
00092   typedef std::vector<Info>           InfoList;
00093 
00094 
00095 public:
00096 
00098   ModProgMeshT( DecimaterType &_dec ) : Base(_dec, true)
00099   {
00100     Self::mesh().add_property( idx_ );
00101   }
00102 
00103 
00105   ~ModProgMeshT()
00106   {
00107     Self::mesh().remove_property( idx_ );
00108   }
00109 
00110   const InfoList&                            pmi() const
00111   {
00112     return pmi_;
00113   }
00114 
00115 public: // inherited
00116 
00117 
00120   void postprocess_collapse(const CollapseInfo& _ci)
00121   {
00122     pmi_.push_back( Info( _ci ) );
00123   }
00124 
00125 
00126   bool is_binary(void) const { return true; }
00127 
00128 
00129   // only binary mode possible
00130   void set_binary(bool _b) 
00131   {
00132     if (!_b)
00133     {
00134       std::cerr << "ModNormalFlippingT can only be used binary\n";
00135       exit(1);
00136     }
00137   }
00138 
00139 
00140 public: // specific methods
00141 
00166   bool write( const std::string& _ofname );
00168   const InfoList& infolist() const { return pmi_; }
00169 
00170 
00171 
00172   InfoList          pmi_;
00173   VPropHandleT<int> idx_;
00174 };
00175 
00176 
00177 //=============================================================================
00178 } // END_NS_DECIMATER
00179 } // END_NS_OPENMESH
00180 //=============================================================================
00181 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_DECIMATER_MODPROGMESH_CC)
00182 #define OSG_MODPROGMESH_TEMPLATES
00183 #include "ModProgMeshT.cc"
00184 #endif
00185 //=============================================================================
00186 #endif // OPENMESH_TOOLS_PROGMESHT_HH defined
00187 //=============================================================================
00188 

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