-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisplayElement.h
141 lines (121 loc) · 2.94 KB
/
DisplayElement.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
/**
* @file DisplayElement.h
* @author Dan R. Lipsa
* @date 4 March 2010
* @ingroup display
* @brief %Base classes for displaying an element (body, face, edge or vertex)
*/
#ifndef __DISPLAY_ELEMENT_H__
#define __DISPLAY_ELEMENT_H__
#include "Enums.h"
#include "PropertySetter.h"
class Settings;
class ViewSettings;
class Foam;
/**
* @brief %Base class for displaying an element (vertex, edge, ...)
*/
class DisplayElement
{
public:
enum FocusContext
{
FOCUS,
CONTEXT
};
enum TessellationEdgesDisplay
{
DISPLAY_TESSELLATION_EDGES,
DONT_DISPLAY_TESSELLATION_EDGES
};
public:
DisplayElement (
const Settings& settings, bool useZPos = false, double zPos = 0) :
m_settings (settings),
m_useZPos (useZPos),
m_zPos (zPos)
{
}
protected:
const Settings& m_settings;
bool m_useZPos;
double m_zPos;
};
/**
* @brief Base class for displaying an element with focus and context
*/
class DisplayElementFocus : public DisplayElement
{
public:
DisplayElementFocus (
const Settings& settings, ViewNumber::Enum viewNumber, bool is2D,
FocusContext focus = FOCUS, bool useZPos = false, double zPos = 0) :
DisplayElement (settings, useZPos, zPos),
m_viewNumber (viewNumber),
m_is2D (is2D),
m_focus (focus)
{
}
ViewNumber::Enum GetViewNumber () const
{
return m_viewNumber;
}
bool Is2D () const
{
return m_is2D;
}
const ViewSettings& GetViewSettings () const;
protected:
ViewNumber::Enum m_viewNumber;
const bool m_is2D;
FocusContext m_focus;
};
class SetterTextureCoordinate;
/**
* @brief Base class for displaying a bubble or bubble property with color
* based on a scalar property
*/
template<typename PropertySetter = SetterTextureCoordinate>
class DisplayElementProperty : public DisplayElement
{
public:
DisplayElementProperty (
const Settings& settings,
PropertySetter propertySetter,
bool useZPos = false, double zPos = 0) :
DisplayElement (settings, useZPos, zPos),
m_propertySetter (propertySetter)
{
}
ViewNumber::Enum GetViewNumber () const;
bool Is2D () const;
const ViewSettings& GetViewSettings () const;
protected:
PropertySetter m_propertySetter;
};
/**
* @brief Base class for displaying a bubble or bubble property with color
* based on a scalar property and focus and context control.
*/
template<typename PropertySetter = SetterTextureCoordinate>
class DisplayElementPropertyFocus :
public DisplayElementProperty<PropertySetter>
{
public:
DisplayElementPropertyFocus (
const Settings& settings,
PropertySetter setter,
DisplayElement::FocusContext focus = DisplayElement::FOCUS,
bool useZPos = false, double zPos = 0) :
DisplayElementProperty<PropertySetter> (
settings, setter, useZPos, zPos),
m_focus (focus)
{
}
protected:
DisplayElement::FocusContext m_focus;
};
#endif //__DISPLAY_ELEMENT_H__
// Local Variables:
// mode: c++
// End: