OpenMesh
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
ProgViewerWidget.hh
1 /* ========================================================================= *
2  * *
3  * OpenMesh *
4  * Copyright (c) 2001-2015, RWTH-Aachen University *
5  * Department of Computer Graphics and Multimedia *
6  * All rights reserved. *
7  * www.openmesh.org *
8  * *
9  *---------------------------------------------------------------------------*
10  * This file is part of OpenMesh. *
11  *---------------------------------------------------------------------------*
12  * *
13  * Redistribution and use in source and binary forms, with or without *
14  * modification, are permitted provided that the following conditions *
15  * are met: *
16  * *
17  * 1. Redistributions of source code must retain the above copyright notice, *
18  * this list of conditions and the following disclaimer. *
19  * *
20  * 2. Redistributions in binary form must reproduce the above copyright *
21  * notice, this list of conditions and the following disclaimer in the *
22  * documentation and/or other materials provided with the distribution. *
23  * *
24  * 3. Neither the name of the copyright holder nor the names of its *
25  * contributors may be used to endorse or promote products derived from *
26  * this software without specific prior written permission. *
27  * *
28  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS *
29  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED *
30  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A *
31  * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER *
32  * OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, *
33  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, *
34  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR *
35  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF *
36  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING *
37  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS *
38  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
39  * *
40  * ========================================================================= */
41 
42 /*===========================================================================*\
43  * *
44  * $Revision$ *
45  * $Date$ *
46  * *
47 \*===========================================================================*/
48 
49 
50 #ifndef OPENMESHAPPS_PROGVIEWERWIDGET_HH
51 #define OPENMESHAPPS_PROGVIEWERWIDGET_HH
52 
53 
54 //== INCLUDES =================================================================
55 
56 #include <QTimer>
57 #include <OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh>
58 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
60 #include <string>
61 
62 
63 
64 //== CLASS DEFINITION =========================================================
65 
66 
67 using namespace OpenMesh;
68 using namespace OpenMesh::Attributes;
69 
70 
71 struct MyTraits : public OpenMesh::DefaultTraits
72 {
79 };
80 
81 
84 
85 
86 //== CLASS DEFINITION =========================================================
87 
88 
89 
91 {
92  Q_OBJECT
93 
94 public:
95 
96  typedef MeshViewerWidget Base;
97  typedef ProgViewerWidget This;
98 
99 
100 public:
102  ProgViewerWidget(QWidget* _parent=0)
103  : MeshViewerWidget(_parent)
104  {
105  timer_ = new QTimer(this);
106 
107  connect( timer_, SIGNAL(timeout()), SLOT(animate()) );
108  }
109 
112  {
113  delete timer_;
114  }
115 
117  void open_prog_mesh(const char* _filename);
118 
119 protected slots:
120 
121 void animate( void );
122 
123 private:
124 
125  QTimer *timer_;
126 
127  struct PMInfo
128  {
129  MyMesh::Point p0;
130  MyMesh::VertexHandle v0, v1, vl, vr;
131  };
132  typedef std::vector<PMInfo> PMInfoContainer;
133  typedef PMInfoContainer::iterator PMInfoIter;
134 
136  void refine(unsigned int _n);
137 
139  void coarsen(unsigned int _n);
140 
141  virtual void keyPressEvent(QKeyEvent* _event);
142 
143  // mesh data
144  bool animateRefinement_;
145  PMInfoContainer pminfos_;
146  PMInfoIter pmiter_;
147  size_t n_base_vertices_, n_base_faces_, n_detail_vertices_;
148  size_t n_max_vertices_;
149 };
150 
151 
152 //=============================================================================
153 #endif // OPENMESHAPPS_PROGVIEWERWIDGET_HH defined
154 //=============================================================================
155 
Add normals to mesh item (vertices/faces)
Definition: Attributes.hh:87
~ProgViewerWidget()
destructor
Definition: ProgViewerWidget.hh:111
Kernel::Point Point
Coordinate type.
Definition: PolyMeshT.hh:115
This file provides some macros containing attribute usage.
#define EdgeAttributes(_i)
Macro for defining the edge attributes. See Specifying your MyMesh.
Definition: Traits.hh:90
This namespace holds per item attributes like normal/color.
Add status to mesh item (all items)
Definition: Attributes.hh:90
Add storage for previous halfedge (halfedges). The bit is set by default in the DefaultTraits.
Definition: Attributes.hh:89
#define HalfedgeAttributes(_i)
Macro for defining the halfedge attributes. See Specifying your MyMesh.
Definition: Traits.hh:87
Kernel::VertexHandle VertexHandle
Handle for referencing the corresponding item.
Definition: PolyMeshT.hh:139
Definition: MeshViewerWidget.hh:80
Triangle mesh based on the ArrayKernel.
Definition: TriMesh_ArrayKernelT.hh:98
#define FaceAttributes(_i)
Macro for defining the face attributes. See Specifying your MyMesh.
Definition: Traits.hh:93
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:64
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:98
ProgViewerWidget(QWidget *_parent=0)
default constructor
Definition: ProgViewerWidget.hh:102
#define VertexAttributes(_i)
Macro for defining the vertex attributes. See Specifying your MyMesh.
Definition: Traits.hh:84
Base class for all traits.
Definition: Traits.hh:126
Definition: ProgViewerWidget.hh:90

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