-
Notifications
You must be signed in to change notification settings - Fork 0
/
DisplayFaceFunctors.h
182 lines (152 loc) · 4.72 KB
/
DisplayFaceFunctors.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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
/**
* @file DisplayFaceFunctors.h
* @author Dan R. Lipsa
* @date 3 March 2010
* @ingroup display
* @brief Functors for displaying a face
*/
#ifndef __DISPLAY_FACE_FUNCTORS_H__
#define __DISPLAY_FACE_FUNCTORS_H__
#include "DisplayElement.h"
#include "DisplayEdgeFunctors.h"
#include "Enums.h"
class Face;
class OrientedFace;
class DisplayFaceLineStrip;
/**
* @brief Displays a face using a triangle fan (for convex faces)
*/
class DisplayFaceTriangleFan : public DisplayElementFocus
{
public:
DisplayFaceTriangleFan (
const Settings& settings, ViewNumber::Enum viewNumber, bool is2D,
FocusContext focus = FOCUS,
bool useZPos = false, double zPos = 0) :
DisplayElementFocus (settings, viewNumber, is2D, focus, useZPos, zPos)
{
}
void operator () (const boost::shared_ptr<Face>& f) const;
void operator () (const boost::shared_ptr<const OrientedFace>& of) const
{
operator () (of.get ());
}
void operator () (const OrientedFace* of) const;
};
/**
* @brief Displays a face using a color map highlight color
*/
template <HighlightNumber::Enum color, typename displayEdges,
typename PropertySetter = SetterTextureCoordinate>
class DisplayFaceHighlightColor :
public DisplayElementPropertyFocus<PropertySetter>
{
public:
/**
* Constructor
*/
DisplayFaceHighlightColor (
const Settings& settings, bool is2D,
typename DisplayElement::FocusContext focus = DisplayElement::FOCUS,
ViewNumber::Enum viewNumber = ViewNumber::VIEW0,
bool useZPos = false,
double zPos = 0);
DisplayFaceHighlightColor (
const Settings& settings,
PropertySetter propertySetter,
typename DisplayElement::FocusContext focus = DisplayElement::FOCUS,
bool useZPos = false,
double zPos = 0);
/**
* Functor that displays a face
*/
void operator() (const boost::shared_ptr<OrientedFace>& of);
void operator () (const boost::shared_ptr<Face>& f);
};
/**
* @brief Displays a face using the color specified in the DMP file or
* a color mapped body property value
*
* @todo %Color by the number of edges of a face in 3D
*/
template<typename PropertySetter = SetterTextureCoordinate>
class DisplayFaceBodyScalarColor :
public DisplayFaceHighlightColor<HighlightNumber::H0,
DisplayFaceTriangleFan, PropertySetter>
{
public:
DisplayFaceBodyScalarColor (
const Settings& settings, bool is2D,
typename DisplayElement::FocusContext focus = DisplayElement::FOCUS,
ViewNumber::Enum view = ViewNumber::VIEW0,
bool useZPos = false,
double zPos = 0);
DisplayFaceBodyScalarColor (
const Settings& settings,
PropertySetter propertySetter,
typename DisplayElement::FocusContext focus = DisplayElement::FOCUS,
bool useZPos = false,
double zPos = 0);
void operator () (const boost::shared_ptr<OrientedFace>& of);
private:
void setColorOrTexture (const boost::shared_ptr<OrientedFace>& of,
bool* useColor);
};
/**
* @brief Displays a face colored using highlight 0.
*/
template<typename PropertySetter = SetterTextureCoordinate>
class DisplayFaceH0Color :
public DisplayFaceHighlightColor<HighlightNumber::H0,
DisplayFaceTriangleFan, PropertySetter>
{
public:
DisplayFaceH0Color (
const Settings& settings,
typename DisplayElement::FocusContext focus = DisplayElement::FOCUS,
ViewNumber::Enum view = ViewNumber::VIEW0,
bool useZPos = false,
double zPos = 0);
DisplayFaceH0Color (
const Settings& settings,
PropertySetter propertySetter,
typename DisplayElement::FocusContext focus = DisplayElement::FOCUS,
bool useZPos = false,
double zPos = 0);
void operator () (const boost::shared_ptr<Face>& f);
};
/**
* @brief Display all edges of a face using a line strip
*/
class DisplayFaceLineStrip : public DisplayElementFocus
{
public:
DisplayFaceLineStrip (
const Settings& settings, ViewNumber::Enum viewNumber, bool is2D,
FocusContext focus = FOCUS,
bool useZPos = false, double zPos = 0) :
DisplayElementFocus (settings, viewNumber, is2D, focus, useZPos, zPos)
{
}
void operator() (const boost::shared_ptr<OrientedFace>& of);
void operator() (const boost::shared_ptr<Face>& f);
};
/**
* @brief Display all edges of a face using a parameter function that
* displays an edge.
*/
template<typename displayEdge>
class DisplayFaceEdges : public DisplayElementFocus
{
public:
DisplayFaceEdges (
const Settings& settings, ViewNumber::Enum viewNumber, bool is2D,
FocusContext focus,
bool useZPos = false, double zPos = 0);
void operator() (const boost::shared_ptr<OrientedFace> f);
void operator () (const boost::shared_ptr<Face> f);
};
#endif //__DISPLAY_FACE_FUNCTORS_H__
// Local Variables:
// mode: c++
// End: