1 |
francois |
1061 |
// nUtil - An utility Library for gnurbs |
2 |
|
|
// Copyright (C) 2008-2019 Eric Bechet |
3 |
|
|
// |
4 |
|
|
// See the LICENSE file for contributions and license information. |
5 |
|
|
// Please report all bugs and problems to <bechet@cadxfem.org>. |
6 |
|
|
// |
7 |
|
|
|
8 |
|
|
#ifndef __VTKDISPLAY_H |
9 |
|
|
#define __VTKDISPLAY_H |
10 |
|
|
|
11 |
|
|
#include <vector> |
12 |
|
|
|
13 |
|
|
#include <vtkSmartPointer.h> |
14 |
|
|
#include <vtkActor.h> |
15 |
|
|
#include <vtkRenderWindow.h> |
16 |
|
|
#include <vtkRenderer.h> |
17 |
|
|
#include <vtkRenderWindowInteractor.h> |
18 |
|
|
#include <vtkInteractorStyleTrackballCamera.h> |
19 |
|
|
#include "ndata.h" |
20 |
|
|
|
21 |
|
|
/// Display class. |
22 |
|
|
class vtkdisplay// : public ndisplay_base |
23 |
|
|
{ |
24 |
|
|
protected : |
25 |
|
|
vtkSmartPointer<vtkRenderer> renderer; |
26 |
|
|
vtkSmartPointer<vtkRenderWindow> renderWindow; |
27 |
|
|
vtkSmartPointer<vtkRenderWindowInteractor> renderWindowInteractor; |
28 |
|
|
vtkSmartPointer<vtkInteractorStyleTrackballCamera> interactorObserver; |
29 |
|
|
|
30 |
|
|
public: |
31 |
|
|
/// \brief Constructor. |
32 |
|
|
vtkdisplay(color c=color(25, 51, 102,255),const char *nom=NULL); |
33 |
|
|
|
34 |
|
|
/// \brief Destructor. |
35 |
|
|
virtual ~vtkdisplay() {} |
36 |
|
|
|
37 |
|
|
/// \brief Adds all data for display. |
38 |
|
|
/// \param[in] data data to display. |
39 |
|
|
virtual void init_data(const data_container &data); |
40 |
|
|
|
41 |
|
|
/// \brief Adds all data for display. |
42 |
|
|
/// \param[in] data vector of data to display. |
43 |
|
|
virtual void init_data(const std::vector<data_container> &data); // all |
44 |
|
|
|
45 |
|
|
|
46 |
|
|
virtual void init_data() {}; |
47 |
|
|
virtual data_container* get_data() { return 0x0;} |
48 |
|
|
|
49 |
|
|
/// \brief Display loop. |
50 |
|
|
virtual void display(); |
51 |
|
|
// self created |
52 |
|
|
virtual void test(void); |
53 |
|
|
virtual void resetCamera(); |
54 |
|
|
virtual void kbCallback(int); |
55 |
|
|
virtual void mousewheelforwardCall(int x,int y); |
56 |
|
|
virtual void mousewheelbackwardCall(int x,int y); |
57 |
|
|
private : |
58 |
|
|
|
59 |
|
|
/// \brief Adds only vertices data for display. |
60 |
|
|
/// \param[in] data data to display. |
61 |
|
|
virtual void init_data_vertices(const data_container & data); |
62 |
|
|
|
63 |
|
|
/// \brief Adds only lines data for display. |
64 |
|
|
/// \param[in] data data to display. |
65 |
|
|
virtual void init_data_lines(const data_container & data); |
66 |
|
|
|
67 |
|
|
/// \brief Adds only triangles data for display. |
68 |
|
|
/// \param[in] data data to display. |
69 |
|
|
virtual void init_data_triangles(const data_container & data); |
70 |
|
|
|
71 |
|
|
/// \brief Adds only quads data for display. |
72 |
|
|
/// \param[in] data data to display. |
73 |
|
|
virtual void init_data_quads(const data_container & data); |
74 |
|
|
|
75 |
|
|
/// \brief Adds only text data for display. |
76 |
|
|
/// \param[in] data data to display. |
77 |
|
|
virtual void init_data_texts(const data_container & data); |
78 |
|
|
|
79 |
|
|
std::vector<vtkSmartPointer<vtkActor> > list_numero[3]; |
80 |
|
|
bool numero[3]; |
81 |
|
|
std::vector<vtkSmartPointer<vtkActor> > list_triangle; |
82 |
|
|
bool triangle; |
83 |
|
|
std::vector<vtkSmartPointer<vtkActor> > list_vertice; |
84 |
|
|
bool vertice; |
85 |
|
|
std::vector<vtkSmartPointer<vtkActor> > list_line; |
86 |
|
|
bool line; |
87 |
|
|
std::vector<vtkSmartPointer<vtkActor> > list_quad; |
88 |
|
|
bool quad; |
89 |
|
|
void saveCameraDefault(); |
90 |
|
|
double cameraDefPosition [3]; |
91 |
|
|
double cameraDefFocalPoint [3]; |
92 |
|
|
double cameraDefViewUp [3]; |
93 |
|
|
double scaleactif; |
94 |
|
|
}; |
95 |
|
|
|
96 |
|
|
|
97 |
|
|
#endif// __VTKDISPLAY_H |