/
SoFCUnifiedSelection.h
199 lines (157 loc) · 6.03 KB
/
SoFCUnifiedSelection.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
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
/***************************************************************************
* Copyright (c) 2005 Jürgen Riegel <juergen.riegel@web.de> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef GUI_SOFCUNIFIEDSELECTION_H
#define GUI_SOFCUNIFIEDSELECTION_H
#include <Inventor/nodes/SoSubNode.h>
#include <Inventor/nodes/SoSeparator.h>
#include <Inventor/fields/SoSFBool.h>
#include <Inventor/fields/SoSFColor.h>
#include <Inventor/fields/SoSFEnum.h>
#include <Inventor/fields/SoSFString.h>
#include <Inventor/nodes/SoLightModel.h>
#include "View3DInventorViewer.h"
#include <list>
class SoFullPath;
class SoPickedPoint;
class SoDetail;
namespace Gui {
class Document;
/** Unified Selection node
* This is the new selection node for the 3D Viewer which will
* gradually remove all the low level selection nodes in the view
* provider. The handling of the highlighting and the selection will
* be unified here.
* \author Jürgen Riegel
*/
class GuiExport SoFCUnifiedSelection : public SoSeparator {
typedef SoSeparator inherited;
SO_NODE_HEADER(Gui::SoFCUnifiedSelection);
public:
static void initClass(void);
static void finish(void);
SoFCUnifiedSelection(void);
void applySettings();
enum HighlightModes {
AUTO, ON, OFF
};
const char* getFileFormatName(void) const;
void write(SoWriteAction * action);
SoSFColor colorHighlight;
SoSFColor colorSelection;
SoSFEnum highlightMode;
SoSFEnum selectionMode;
SoSFBool selectionRole;
virtual void doAction(SoAction *action);
//virtual void GLRender(SoGLRenderAction * action);
virtual void handleEvent(SoHandleEventAction * action);
virtual void GLRenderBelowPath(SoGLRenderAction * action);
//virtual void GLRenderInPath(SoGLRenderAction * action);
//static void turnOffCurrentHighlight(SoGLRenderAction * action);
bool checkSelectionStyle(int type, ViewProvider *vp);
friend class View3DInventorViewer;
protected:
virtual ~SoFCUnifiedSelection();
//virtual void redrawHighlighted(SoAction * act, SbBool flag);
//virtual SbBool readInstance(SoInput * in, unsigned short flags);
private:
//static void turnoffcurrent(SoAction * action);
//void setOverride(SoGLRenderAction * action);
//SbBool isHighlighted(SoAction *action);
//SbBool preRender(SoGLRenderAction *act, GLint &oldDepthFunc);
static int getPriority(const SoPickedPoint* p);
const SoPickedPoint* getPickedPoint(SoHandleEventAction*) const;
Gui::Document *pcDocument;
static SoFullPath * currenthighlight;
SbBool highlighted;
// -1 = not handled, 0 = not selected, 1 = selected
int32_t preSelection;
SoColorPacker colorpacker;
};
/**
* @author Werner Mayer
*/
class GuiExport SoHighlightElementAction : public SoAction
{
SO_ACTION_HEADER(SoHighlightElementAction);
public:
SoHighlightElementAction ();
~SoHighlightElementAction();
void setHighlighted(SbBool);
SbBool isHighlighted() const;
void setColor(const SbColor&);
const SbColor& getColor() const;
void setElement(const SoDetail*);
const SoDetail* getElement() const;
static void initClass();
protected:
virtual void beginTraversal(SoNode *node);
private:
static void callDoAction(SoAction *action,SoNode *node);
private:
SbBool _highlight;
SbColor _color;
const SoDetail* _det;
};
/**
* @author Werner Mayer
*/
class GuiExport SoSelectionElementAction : public SoAction
{
SO_ACTION_HEADER(SoSelectionElementAction);
public:
enum Type {None, Append, Remove, All};
SoSelectionElementAction (Type);
~SoSelectionElementAction();
Type getType() const;
void setColor(const SbColor&);
const SbColor& getColor() const;
void setElement(const SoDetail*);
const SoDetail* getElement() const;
static void initClass();
protected:
virtual void beginTraversal(SoNode *node);
private:
static void callDoAction(SoAction *action,SoNode *node);
private:
Type _type;
SbColor _color;
const SoDetail* _det;
};
/**
* @author Werner Mayer
*/
class GuiExport SoVRMLAction : public SoAction
{
SO_ACTION_HEADER(SoVRMLAction);
public:
SoVRMLAction();
~SoVRMLAction();
void setOverrideMode(SbBool);
SbBool isOverrideMode() const;
static void initClass();
private:
SbBool overrideMode;
std::list<int> bindList;
static void callDoAction(SoAction *action,SoNode *node);
};
} // namespace Gui
#endif // !GUI_SOFCUNIFIEDSELECTION_H