44 #define OPENMESHAPPS_MESHVIEWERWIDGET_CC 48 #include <OpenMesh/Apps/QtViewer/MeshViewerWidget.hh> 57 void MeshViewerWidget::open_mesh_gui(QString fname)
61 if ( fname.isEmpty() || !
open_mesh(fname.toLocal8Bit(), _options) )
63 QString msg =
"Cannot read mesh from file:\n '";
66 QMessageBox::critical( NULL, windowTitle(), msg);
69 std::cout <<
"Loaded mesh in ~" << t.
as_string() << std::endl;
73 void MeshViewerWidget::open_texture_gui(QString fname)
75 if ( fname.isEmpty() || !
open_texture( fname.toLocal8Bit() ) )
77 QString msg =
"Cannot load texture image from file:\n '";
79 msg +=
"'\n\nPossible reasons:\n";
80 msg +=
"- Mesh file didn't provide texture coordinates\n";
81 msg +=
"- Texture file does not exist\n";
82 msg +=
"- Texture file is not accessible.\n";
83 QMessageBox::warning( NULL, windowTitle(), msg );
87 void MeshViewerWidget::query_open_mesh_file() {
88 QString fileName = QFileDialog::getOpenFileName(
this,
91 tr(
"OBJ Files (*.obj);;" 95 if (!fileName.isEmpty())
96 open_mesh_gui(fileName);
99 void MeshViewerWidget::query_open_texture_file() {
100 QString fileName = QFileDialog::getOpenFileName(
this,
101 tr(
"Open texture file"),
103 tr(
"PNG Files (*.png);;" 104 "BMP Files (*.bmp);;" 105 "GIF Files (*.gif);;" 106 "JPEG Files (*.jpg);;" 107 "TIFF Files (*.tif);;" 109 if (!fileName.isEmpty())
110 open_texture_gui(fileName);
std::string as_string(Format format=Automatic)
MeshViewerWidget(QWidget *parent=0)
default constructor
bool open_mesh(const char *_filename, OpenMesh::IO::Options _opt)
open mesh
void start(void)
Start measurement.
void stop(void)
Stop measurement.
virtual bool open_texture(const char *_filename)
load texture