Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://coin3d.github.io
https://www.kongsberg.com/en/kogt/
SoExtSelection.h
1#ifndef COIN_SOEXTSELECTION_H
2#define COIN_SOEXTSELECTION_H
3
4/**************************************************************************\
5 * Copyright (c) Kongsberg Oil & Gas Technologies AS
6 * All rights reserved.
7 *
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted provided that the following conditions are
10 * met:
11 *
12 * Redistributions of source code must retain the above copyright notice,
13 * this list of conditions and the following disclaimer.
14 *
15 * Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
18 *
19 * Neither the name of the copyright holder nor the names of its
20 * contributors may be used to endorse or promote products derived from
21 * this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
29 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
30 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
31 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
32 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34\**************************************************************************/
35
36#include <Inventor/nodes/SoSubNode.h>
37#include <Inventor/nodes/SoSelection.h>
38#include <Inventor/fields/SoSFEnum.h>
39#include <cstddef> // NULL
40
41#ifndef COIN_INTERNAL
42#include <Inventor/actions/SoCallbackAction.h>
43#endif // !COIN_INTERNAL
44
45class SbColor;
46class SbVec3f;
47class SbVec2f;
48class SbVec2s;
51
52// This shouldn't strictly be necessary, but the OSF1/cxx compiler
53// complains if this is left out, while using the "friend class
54// SoExtSelectionP" statement in the class definition.
55class SoExtSelectionP;
56
57
58typedef SbBool SoExtSelectionTriangleCB(void * userdata,
59 SoCallbackAction * action,
60 const SoPrimitiveVertex * v1,
61 const SoPrimitiveVertex * v2,
62 const SoPrimitiveVertex * v3);
63
64typedef SbBool SoExtSelectionLineSegmentCB(void * userdata,
65 SoCallbackAction * action,
66 const SoPrimitiveVertex * v1,
67 const SoPrimitiveVertex * v2);
68
69typedef SbBool SoExtSelectionPointCB(void * userdata,
70 SoCallbackAction * action,
71 const SoPrimitiveVertex * v1);
72
73typedef SoPath * SoLassoSelectionFilterCB(void * userdata, const SoPath * path);
74
75
76class COIN_DLL_API SoExtSelection : public SoSelection {
77 typedef SoSelection inherited;
78
79 SO_NODE_HEADER(SoExtSelection);
80
81public:
82 static void initClass(void);
83 SoExtSelection(void);
84
88
92
97
101
102 void useOverlay(SbBool overlay = TRUE);
103 SbBool isUsingOverlay(void);
105 void setOverlayLassoColorIndex(const int index);
107 void setLassoColor(const SbColor & color);
108 const SbColor & getLassoColor(void);
109 void setLassoWidth(const float width);
110 float getLassoWidth(void);
111 void setOverlayLassoPattern(const unsigned short pattern);
112 unsigned short getOverlayLassoPattern(void);
113 void animateOverlayLasso(const SbBool animate = TRUE);
114 SbBool isOverlayLassoAnimated(void);
115
116 virtual void handleEvent(SoHandleEventAction * action);
117 virtual void GLRenderBelowPath(SoGLRenderAction * action);
118
119 void select(SoNode * root, int numcoords, SbVec2f * lasso,
120 const SbViewportRegion & vp, SbBool shiftpolicy);
121 void select(SoNode * root, int numcoords, SbVec3f * lasso,
122 const SbViewportRegion & vp, SbBool shiftkeypolicy);
123 const SbVec2s * getLassoCoordsDC(int & numCoords);
124 const SbVec3f * getLassoCoordsWC(int & numCoords);
125 const SoPathList & getSelectionPathList() const;
126
127 void setLassoFilterCallback(SoLassoSelectionFilterCB * f, void * userdata = NULL,
128 const SbBool callonlyifselectable = TRUE);
129
130 void setTriangleFilterCallback(SoExtSelectionTriangleCB * func,
131 void * userdata = NULL);
132 void setLineSegmentFilterCallback(SoExtSelectionLineSegmentCB * func,
133 void * userdata = NULL);
134 void setPointFilterCallback(SoExtSelectionPointCB * func,
135 void * userdata = NULL);
136 SbBool wasShiftDown(void) const;
137
138protected:
139 virtual ~SoExtSelection();
140
141private:
142 void draw(SoGLRenderAction * action);
143
144 friend class SoExtSelectionP;
145 class SoExtSelectionP * pimpl;
146};
147
148#endif // !COIN_SOEXTSELECTION_H
The SbColor class contains the red, green and blue components which make up a color value.
Definition SbColor.h:39
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:49
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:51
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:40
The SoCallbackAction class invokes callbacks at specific nodes.
Definition SoCallbackAction.h:80
SoSFEnum lassoPolicy
Definition SoExtSelection.h:99
SbBool isUsingOverlay(void)
Definition SoExtSelection.cpp:855
LassoPolicy
Definition SoExtSelection.h:89
@ FULL
Definition SoExtSelection.h:90
@ FULL_BBOX
Definition SoExtSelection.h:90
@ PART
Definition SoExtSelection.h:90
@ PART_BBOX
Definition SoExtSelection.h:90
void setLassoColor(const SbColor &color)
Definition SoExtSelection.cpp:906
void setOverlayLassoColorIndex(const int index)
Definition SoExtSelection.cpp:882
SoSFEnum lassoMode
Definition SoExtSelection.h:100
void setOverlayLassoPattern(const unsigned short pattern)
Definition SoExtSelection.cpp:946
const SbVec3f * getLassoCoordsWC(int &numCoords)
Definition SoExtSelection.cpp:1295
float getLassoWidth(void)
Definition SoExtSelection.cpp:935
void setPointFilterCallback(SoExtSelectionPointCB *func, void *userdata=NULL)
Definition SoExtSelection.cpp:1387
SbBool isOverlayLassoAnimated(void)
Definition SoExtSelection.cpp:976
unsigned short getOverlayLassoPattern(void)
Definition SoExtSelection.cpp:955
const SbVec2s * getLassoCoordsDC(int &numCoords)
Definition SoExtSelection.cpp:1282
SoExtSelection(void)
Definition SoExtSelection.cpp:735
const SbColor & getLassoColor(void)
Definition SoExtSelection.cpp:915
SoSeparator * getOverlaySceneGraph(void)
Definition SoExtSelection.cpp:870
void animateOverlayLasso(const SbBool animate=TRUE)
Definition SoExtSelection.cpp:967
void setTriangleFilterCallback(SoExtSelectionTriangleCB *func, void *userdata=NULL)
Definition SoExtSelection.cpp:1351
void setLassoFilterCallback(SoLassoSelectionFilterCB *f, void *userdata=NULL, const SbBool callonlyifselectable=TRUE)
Definition SoExtSelection.cpp:1332
LassoMode
Definition SoExtSelection.h:93
@ VISIBLE_SHAPES
Definition SoExtSelection.h:95
@ ALL_SHAPES
Definition SoExtSelection.h:94
const SoPathList & getSelectionPathList() const
Definition SoExtSelection.cpp:1308
int getOverlayLassoColorIndex(void)
Definition SoExtSelection.cpp:893
SoSFEnum lassoType
Definition SoExtSelection.h:98
void setLassoWidth(const float width)
Definition SoExtSelection.cpp:926
void setLineSegmentFilterCallback(SoExtSelectionLineSegmentCB *func, void *userdata=NULL)
Definition SoExtSelection.cpp:1369
LassoType
Definition SoExtSelection.h:85
@ RECTANGLE
Definition SoExtSelection.h:86
@ NOLASSO
Definition SoExtSelection.h:86
@ LASSO
Definition SoExtSelection.h:86
SbBool wasShiftDown(void) const
Definition SoExtSelection.cpp:1402
void useOverlay(SbBool overlay=TRUE)
Definition SoExtSelection.cpp:844
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:50
The SoHandleEventAction class distributes user events to the scene.
Definition SoHandleEventAction.h:46
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
The SoPathList class is a container for pointers to SoPath objects.
Definition SoPathList.h:40
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:52
The SoPrimitiveVertex class represents a single vertex of a generated primitive.
Definition SoPrimitiveVertex.h:43
The SoSFEnum class is a container for an enum value.
Definition SoSFEnum.h:40
virtual void handleEvent(SoHandleEventAction *action)
Definition SoSelection.cpp:856
static void initClass(void)
Sets up initialization for data common to all instances of this class, like submitting necessary info...
Definition SoSelection.cpp:330
SoSelection(void)
Definition SoSelection.cpp:294
void select(const SoPath *path)
Definition SoSelection.cpp:371
virtual void GLRenderBelowPath(SoGLRenderAction *action)
Definition SoSeparator.cpp:653
SoSeparator(void)
Definition SoSeparator.cpp:383