OpenMesh

- Main Page
- Related Pages
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
ModProgMeshT.hh
Go to the documentation of this file.
1 /*===========================================================================*\
2 * *
3 * OpenMesh *
4 * Copyright (C) 2001-2012 by Computer Graphics Group, RWTH Aachen *
5 * www.openmesh.org *
6 * *
7 *---------------------------------------------------------------------------*
8 * This file is part of OpenMesh. *
9 * *
10 * OpenMesh is free software: you can redistribute it and/or modify *
11 * it under the terms of the GNU Lesser General Public License as *
12 * published by the Free Software Foundation, either version 3 of *
13 * the License, or (at your option) any later version with the *
14 * following exceptions: *
15 * *
16 * If other files instantiate templates or use macros *
17 * or inline functions from this file, or you compile this file and *
18 * link it with other files to produce an executable, this file does *
19 * not by itself cause the resulting executable to be covered by the *
20 * GNU Lesser General Public License. This exception does not however *
21 * invalidate any other reasons why the executable file might be *
22 * covered by the GNU Lesser General Public License. *
23 * *
24 * OpenMesh is distributed in the hope that it will be useful, *
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
27 * GNU Lesser General Public License for more details. *
28 * *
29 * You should have received a copy of the GNU LesserGeneral Public *
30 * License along with OpenMesh. If not, *
31 * see <http://www.gnu.org/licenses/>. *
32 * *
33 \*===========================================================================*/
34
35 /*===========================================================================*\
36 * *
37 * $Revision: 737 $ *
38 * $Date: 2012-10-08 09:33:20 +0200 (Mo, 08 Okt 2012) $ *
39 * *
40 \*===========================================================================*/
41
46 //=============================================================================
47 //
48 // CLASS ModProgMeshT
49 //
50 //=============================================================================
51
52 #ifndef OPENMESH_TOOLS_MODPROGMESHT_HH
53 #define OPENMESH_TOOLS_MODPROGMESHT_HH
54
55
56 //== INCLUDES =================================================================
57
58 #include <OpenMesh/Tools/Decimater/ModBaseT.hh>
59 #include <OpenMesh/Core/Utils/Property.hh>
60
61
62 //== NAMESPACE ================================================================
63
64 namespace OpenMesh {
65 namespace Decimater {
66
67
68 //== CLASS DEFINITION =========================================================
69
70
77 template <class MeshT>
78 class ModProgMeshT : public ModBaseT<MeshT>
79 {
80 public:
81
82 DECIMATING_MODULE( ModProgMeshT, MeshT, ProgMesh );
83
87 struct Info
88 {
91 Info( const CollapseInfo& _ci )
92 : v0(_ci.v0), v1(_ci.v1), vl(_ci.vl),vr(_ci.vr)
93 {}
94
95 typename Mesh::VertexHandle v0;
96 typename Mesh::VertexHandle v1;
97 typename Mesh::VertexHandle vl;
98 typename Mesh::VertexHandle vr;
99
100 };
101
103 typedef std::vector<Info> InfoList;
104
105
106 public:
107
109 ModProgMeshT( MeshT &_mesh ) : Base(_mesh, true)
110 {
111 Base::mesh().add_property( idx_ );
112 }
113
114
116 ~ModProgMeshT()
117 {
118 Base::mesh().remove_property( idx_ );
119 }
120
121 const InfoList& pmi() const
122 {
123 return pmi_;
124 }
125
126 public: // inherited
127
128
131 void postprocess_collapse(const CollapseInfo& _ci)
132 {
133 pmi_.push_back( Info( _ci ) );
134 }
135
136
137 bool is_binary(void) const { return true; }
138
139
140 public: // specific methods
141
166 bool write( const std::string& _ofname );
168 const InfoList& infolist() const { return pmi_; }
169
170 private:
171
172 // hide this method form user
173 void set_binary(bool _b) {}
174
175 InfoList pmi_;
176 VPropHandleT<int> idx_;
177 };
178
179
180 //=============================================================================
181 } // END_NS_DECIMATER
182 } // END_NS_OPENMESH
183 //=============================================================================
184 #if defined(OM_INCLUDE_TEMPLATES) && !defined(OPENMESH_DECIMATER_MODPROGMESH_CC)
185 #define OSG_MODPROGMESH_TEMPLATES
186 #include "ModProgMeshT.cc"
187 #endif
188 //=============================================================================
189 #endif // OPENMESH_TOOLS_PROGMESHT_HH defined
190 //=============================================================================
191