Visual Computing Library  devel
Loading...
Searching...
No Matches
mesh_viewer.h
1/*****************************************************************************
2 * VCLib *
3 * Visual Computing Library *
4 * *
5 * Copyright(C) 2021-2025 *
6 * Visual Computing Lab *
7 * ISTI - Italian National Research Council *
8 * *
9 * All rights reserved. *
10 * *
11 * This program is free software; you can redistribute it and/or modify *
12 * it under the terms of the Mozilla Public License Version 2.0 as published *
13 * by the Mozilla Foundation; either version 2 of the License, or *
14 * (at your option) any later version. *
15 * *
16 * This program is distributed in the hope that it will be useful, *
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
19 * Mozilla Public License Version 2.0 *
20 * (https://www.mozilla.org/en-US/MPL/2.0/) for more details. *
21 ****************************************************************************/
22
23#ifndef VCL_QT_MESH_VIEWER_H
24#define VCL_QT_MESH_VIEWER_H
25
26#include "gui/drawable_object_vector_tree.h"
27
28#include <vclib/qt/gui/text_edit_logger.h>
29#include <vclib/qt/mesh_viewer_render_app.h>
30#include <vclib/render/drawable/drawable_object_vector.h>
31
32#include <QWidget>
33
34namespace vcl::qt {
35
36namespace Ui {
37class MeshViewer;
38} // namespace Ui
39
40class KeyFilter : public QObject
41{
42 using QObject::QObject;
43
44protected:
45 bool eventFilter(QObject* obj, QEvent* event) override;
46};
47
48class MeshViewer : public QWidget
49{
51
52 Ui::MeshViewer* mUI;
53
54 std::shared_ptr<vcl::DrawableObjectVector> mDrawableObjectVector;
55
56 std::shared_ptr<vcl::DrawableObjectVector> mListedDrawableObjects;
57 std::shared_ptr<vcl::DrawableObjectVector> mUnlistedDrawableObjects;
58
59protected:
61
62 DrawableObjectVectorTree& drawableObjectVectorTree() const;
63
64 void keyPressEvent(QKeyEvent* event) override;
65
66public:
67 explicit MeshViewer(QWidget* parent = nullptr);
69
71 const std::shared_ptr<vcl::DrawableObjectVector>& v);
72
73 void setUnlistedDrawableObjectVector(
74 const std::shared_ptr<vcl::DrawableObjectVector>& v);
75
76 uint selectedDrawableObject() const;
77
78 TextEditLogger& logger();
79
80 void setDrawVectorIconFunction(
81 const DrawableObjectVectorTree::IconFunction& f);
82
83public slots:
85
87
89
90 void fitScene();
91
92 void updateGUI();
93};
94
95} // namespace vcl::qt
96
97#endif // VCL_QT_MESH_VIEWER_H
A class representing a box in N-dimensional space.
Definition box.h:46
Definition drawable_object_vector_tree.h:38
Definition mesh_viewer.h:41
Definition mesh_viewer.h:49
void renderSettingsUpdated()
Slot called every time that the MeshRenderSettingsFrame emits 'settingsUpdated()',...
Definition mesh_viewer.cpp:238
void visibilityDrawableObjectChanged()
Slot called when the user changed the visibility of an object in the DrawableObjectVectorTree.
Definition mesh_viewer.cpp:189
void selectedDrawableObjectChanged(uint i)
Slot called when the user selected a different DrawableObject in the DrawableObjectVectorFrame.
Definition mesh_viewer.cpp:211
MeshViewerRenderApp & viewer() const
Returns the MeshViewerRenderApp used by this MeshViewer.
Definition mesh_viewer.cpp:55
void setDrawableObjectVector(const std::shared_ptr< vcl::DrawableObjectVector > &v)
Sets the current DrawableObjectVector, and updates the GUI accordingly.
Definition mesh_viewer.cpp:133
Definition text_edit_logger.h:38