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