42 #ifndef OPENMESHAPPS_VIEWERWIDGET_HH
43 #define OPENMESHAPPS_VIEWERWIDGET_HH
49 #include <QMessageBox>
50 #include <QFileDialog>
51 #include <OpenMesh/Tools/Utils/getopt.h>
53 #include <OpenMesh/Apps/QtViewer/MeshViewerWidgetT.hh>
54 #include <OpenMesh/Core/Mesh/TriMesh_ArrayKernelT.hh>
84 void open_mesh_gui(QString fname)
88 if ( fname.isEmpty() || !open_mesh(fname.toLocal8Bit(), _options) )
90 QString msg =
"Cannot read mesh from file:\n '";
93 QMessageBox::critical( NULL, windowTitle(), msg);
96 std::cout <<
"Loaded mesh in ~" << t.
as_string() << std::endl;
98 void open_texture_gui(QString fname)
100 if ( fname.isEmpty() || !open_texture( fname.toLocal8Bit() ) )
102 QString msg =
"Cannot load texture image from file:\n '";
104 msg +=
"'\n\nPossible reasons:\n";
105 msg +=
"- Mesh file didn't provide texture coordinates\n";
106 msg +=
"- Texture file does not exist\n";
107 msg +=
"- Texture file is not accessible.\n";
108 QMessageBox::warning( NULL, windowTitle(), msg );
113 void query_open_mesh_file() {
114 QString fileName = QFileDialog::getOpenFileName(
this,
115 tr(
"Open mesh file"),
117 tr(
"OBJ Files (*.obj);;"
118 "OFF Files (*.off);;"
119 "STL Files (*.stl);;"
121 if (!fileName.isEmpty())
122 open_mesh_gui(fileName);
124 void query_open_texture_file() {
125 QString fileName = QFileDialog::getOpenFileName(
this,
126 tr(
"Open texture file"),
128 tr(
"PNG Files (*.png);;"
129 "BMP Files (*.bmp);;"
130 "GIF Files (*.gif);;"
131 "JPEG Files (*.jpg);;"
132 "TIFF Files (*.tif);;"
134 if (!fileName.isEmpty())
135 open_texture_gui(fileName);
#define HalfedgeAttributes(_i)
Macro for defining the halfedge attributes. See Specifying your MyMesh.
Definition: Traits.hh:80
void stop(void)
Stop measurement.
Set options for reader/writer modules.
Definition: Options.hh:88
Base class for all traits.
Definition: Traits.hh:119
MeshViewerWidget(QWidget *parent=0)
default constructor
Definition: MeshViewerWidget.hh:78
Contains all the mesh ingredients like the polygonal mesh, the triangle mesh, different mesh kernels ...
Definition: MeshItems.hh:56
Definition: MeshViewerWidget.hh:73
Add storage for previous halfedge (halfedges). The bit is set by default in the DefaultTraits.
Definition: Attributes.hh:82
Timer class.
Definition: Timer.hh:80
std::string as_string(Format format=Automatic)
Returns the measured time as a string.
void start(void)
Start measurement.
Triangle mesh based on the ArrayKernel.
Definition: TriMesh_ArrayKernelT.hh:91
Polygonal mesh based on the ArrayKernel.
Definition: PolyMesh_ArrayKernelT.hh:91
This namespace holds per item attributes like normal/color.
Definition: MeshViewerWidgetT.hh:69