Easy3D 2.6.1
|
A viewer that supports multiple views (arranged in a grid layout). More...
#include <easy3d/viewer/multi_viewer.h>
Public Member Functions | |
MultiViewer (int rows, int cols, const std::string &title="untitled") | |
Constructor. | |
~MultiViewer () override | |
Destructor. | |
void | assign (int row, int col, const Model *m) |
Assigns the model m to the view at position (row , col ). | |
void | assign (int row, int col, const Drawable *d) |
Assigns the drawable d to the view at position (row , col ). | |
void | set_division_visible (bool b) |
Sets the visibility of the splitting lines of the views. | |
bool | division_visible () const |
Returns if the splitting lines of the views are visible. | |
vec3 | point_under_pixel (int x, int y, bool &found) const override |
Query the XYZ coordinates of the surface point under the cursor. | |
int | rows () const |
Return the number of rows (of the grid-like layout) of the viewer. | |
int | columns () const |
Return the number of columns (of the grid-like layout) of the viewer. | |
void | set_layout (int rows, int cols) |
Set/Change the layout of the viewer. | |
bool | snapshot () const override |
Take a snapshot of the screen and save it to a file. | |
![]() | |
Viewer (const std::string &title="Easy3D Viewer", int samples=4, int gl_major=3, int gl_minor=2, bool full_screen=false, bool resizable=true, int depth_bits=24, int stencil_bits=8, int width=800, int height=600) | |
Constructor. | |
virtual | ~Viewer () |
The destructor. | |
int | run (bool see_all=true) |
Run the viewer. | |
virtual void | exit () |
Terminate the viewer. | |
void | set_title (const std::string &title) |
Set the window title of the viewer. | |
const std::string & | title () const |
Query the window title of the viewer. | |
void | resize (int w, int h) |
Set/Change the viewer size. | |
int | width () const |
Returns the width of the viewer/window. | |
int | height () const |
Returns the height of the viewer/window. | |
void | viewer_size (int &w, int &h) const |
Queries the size of the viewer/window. | |
int | framebuffer_width () const |
Returns the width of the framebuffer, which is identical to: width() * dpi_scaling(). | |
int | framebuffer_height () const |
Returns the height of the framebuffer, which is identical to: height() * dpi_scaling(). | |
void | framebuffer_size (int &w, int &h) const |
Queries the size of the framebuffer. | |
void | set_position (int xpos, int ypos) |
Sets the position of the content area of the viewer. | |
int | samples () const |
Query the actual samples of the viewer. | |
float | dpi_scaling () const |
Query the scaling factor for high DPI devices (e.g., MackBook pro). | |
void | set_background_color (const vec4 &color) |
Set the background color of the viewer. | |
const vec4 & | background_color () const |
Query the background color of the viewer. | |
Camera * | camera () |
Returns the camera used by the viewer. See Camera . | |
const Camera * | camera () const |
Returns the camera used by the viewer. See Camera . | |
virtual bool | open () |
Open a model (PointCloud/SurfaceMesh/Graph) from a file into the viewer. On success, the viewer will be in charge of the memory management of the model. | |
virtual bool | save () const |
Save the active model (if exists) to a file. | |
Drawable * | add_drawable (std::shared_ptr< Drawable > drawable) |
Add a drawable to the viewer to be visualized. On success, the viewer will be in charge of the memory management of the drawable. | |
Drawable * | add_drawable (Drawable *drawable) |
Add a drawable to the viewer to be visualized. On success, the viewer will be in charge of the memory management of the drawable. | |
bool | delete_drawable (Drawable *drawable) |
const std::vector< std::shared_ptr< Drawable > > & | drawables () const |
Query the drawables managed by this viewer. | |
void | clear_scene () |
Delete all visual contents of the viewer (all models and drawables). | |
void | update () const |
Update the display (i.e., repaint). | |
void | fit_screen (const Model *model=nullptr) |
Moves the camera so that the entire scene or the active model is centered on the screen at a proper scale. | |
bool | snapshot (const std::string &file_name, float scaling=1.0f, int samples=4, int back_ground=1, bool expand=true) const |
Take a snapshot of the screen and save it to an image file. Supported image format: png, jpg, bmp, and tga. | |
void | set_usage (const std::string &manual="default", const std::string &screen_hint="") |
The usage information of the viewer. | |
void | bind (const Function &func, Model *model, Key key, Modifier modifier=MODIF_NONE) |
Bind a function that will be triggered by the shortcut 'modifier + key'. | |
void | set_animation (bool b) |
Enable/Disable animation. | |
bool | is_animating () const |
Is animation currently being performed. | |
Model * | add_model (Model *model, bool create_default_drawables=true) |
Add an existing model to the viewer to be visualized. On success, the viewer will be in charge of the memory management of the model. | |
virtual bool | delete_model (Model *model) |
Delete a model. The memory of the model will be released and its existing drawables also be deleted. | |
const std::vector< std::shared_ptr< Model > > & | models () const |
Query the models managed by this viewer. | |
Model * | current_model () const |
Query the active model. | |
Additional Inherited Members | |
![]() | |
enum | Key { KEY_UNKNOWN = -1 , KEY_0 = 48 , KEY_1 = 49 , KEY_2 = 50 , KEY_3 = 51 , KEY_4 = 52 , KEY_5 = 53 , KEY_6 = 54 , KEY_7 = 55 , KEY_8 = 56 , KEY_9 = 57 , KEY_A = 65 , KEY_B = 66 , KEY_C = 67 , KEY_D = 68 , KEY_E = 69 , KEY_F = 70 , KEY_G = 71 , KEY_H = 72 , KEY_I = 73 , KEY_J = 74 , KEY_K = 75 , KEY_L = 76 , KEY_M = 77 , KEY_N = 78 , KEY_O = 79 , KEY_P = 80 , KEY_Q = 81 , KEY_R = 82 , KEY_S = 83 , KEY_T = 84 , KEY_U = 85 , KEY_V = 86 , KEY_W = 87 , KEY_X = 88 , KEY_Y = 89 , KEY_Z = 90 , KEY_RIGHT = 262 , KEY_LEFT = 263 , KEY_DOWN = 264 , KEY_UP = 265 , KEY_F1 = 290 , KEY_F2 = 291 , KEY_F3 = 292 , KEY_F4 = 293 , KEY_F5 = 294 , KEY_F6 = 295 , KEY_F7 = 296 , KEY_F8 = 297 , KEY_F9 = 298 , KEY_SPACE = 32 , KEY_COMMA = 44 , KEY_MINUS = 45 , KEY_PERIOD = 46 , KEY_SLASH = 47 , KEY_SEMICOLON = 59 , KEY_EQUAL = 61 , KEY_LEFT_BRACKET = 91 , KEY_BACKSLASH = 92 , KEY_RIGHT_BRACKET = 93 } |
The keys. Currently only a limited number of commonly used keys are supported. | |
enum | Modifier { MODIF_NONE = 0x0000 , MODIF_SHIFT = 0x0001 , MODIF_CTRL = 0x0002 , MODIF_ALT = 0x0004 } |
The key modifiers. Currently only Shift, Ctrl, and Alt are supported. | |
enum | Button { BUTTON_LEFT = 0 , BUTTON_RIGHT = 1 , BUTTON_MIDDLE = 2 } |
Mouse buttons. | |
using | Function = std::function<bool(Viewer* viewer, Model* model)> |
std::function< bool(Viewer *viewer)> | animation_func_ |
Function called at an equal interval for animation. | |
virtual Model * | add_model (const std::string &file_name, bool create_default_drawables=true) |
Add a model from a file to the viewer to be visualized. On success, the viewer will be in charge of the memory management of the model. The loaded model can be accessed by the 'current_model()' method. | |
Model * | add_model (std::shared_ptr< Model > model, bool create_default_drawables=true) |
Add an existing model to the viewer to be visualized. On success, the viewer will be in charge of the memory management of the model. | |
A viewer that supports multiple views (arranged in a grid layout).
MultiViewer | ( | int | rows, |
int | cols, | ||
const std::string & | title = "untitled" ) |
Constructor.
rows | The number of rows (of the grid-like layout). |
cols | The number of columns (of the grid-like layout). |
title | The title of the viewer window. |
void assign | ( | int | row, |
int | col, | ||
const Drawable * | d ) |
Assigns the drawable d
to the view at position (row
, col
).
This function assigns the drawable d
to the view at position (row
, col
). After that, the drawable will be visualized in this view (regardless of other views visualizing the same drawable).
row | The row index of the view. |
col | The column index of the view. |
d | The drawable to assign. |
void assign | ( | int | row, |
int | col, | ||
const Model * | m ) |
Assigns the model m
to the view at position (row
, col
).
This function assigns the model m
to the view at position (row
, col
). After that, the model will be visualized in this view (regardless of other views visualizing the same model).
row | The row index of the view. |
col | The column index of the view. |
m | The model to assign. |
|
inline |
Return the number of columns (of the grid-like layout) of the viewer.
bool division_visible | ( | ) | const |
Returns if the splitting lines of the views are visible.
true
if the splitting lines are visible, false
otherwise.
|
overridevirtual |
Query the XYZ coordinates of the surface point under the cursor.
x | The cursor x-coordinate, relative to the left edge of the content area. |
y | The cursor y-coordinate, relative to the top edge of the content area. |
found | Indicates whether the point was found or not. |
found
is true
. Reimplemented from Viewer.
|
inline |
Return the number of rows (of the grid-like layout) of the viewer.
void set_division_visible | ( | bool | b | ) |
Sets the visibility of the splitting lines of the views.
b | Whether the splitting lines are visible. |
void set_layout | ( | int | rows, |
int | cols ) |
Set/Change the layout of the viewer.
rows | The number of rows (of the grid-like layout). |
cols | The number of columns (of the grid-like layout). |
|
overridevirtual |
Take a snapshot of the screen and save it to a file.
This method takes a snapshot of the screen and saves the snapshot into an image file. Internally, it will pop up a file dialog for specifying the file name.
true
on success and false
otherwise. Reimplemented from Viewer.