Coin: SoInteractionKit.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/kogt/

SoInteractionKit.h
1#ifndef COIN_SOINTERACTIONKIT_H
2#define COIN_SOINTERACTIONKIT_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/nodekits/SoSubKit.h>
37#include <Inventor/nodekits/SoBaseKit.h>
38#include <Inventor/fields/SoSFEnum.h>
39
40#ifdef COIN_INTERNAL
41class SoFieldSensor;
42#else // !COIN_INTERNAL
43// Include this header file for better Open Inventor compatibility.
44#include <Inventor/sensors/SoFieldSensor.h>
45#endif // !COIN_INTERNAL
46
47class SoSensor;
48class SoSeparator;
49
50 class COIN_DLL_API SoInteractionKit : public SoBaseKit {
51 typedef SoBaseKit inherited;
52
53 SO_KIT_HEADER(SoInteractionKit);
54
55 SO_KIT_CATALOG_ENTRY_HEADER(geomSeparator);
56 SO_KIT_CATALOG_ENTRY_HEADER(topSeparator);
57
58public:
59 SoSFEnum renderCaching;
60 SoSFEnum boundingBoxCaching;
61 SoSFEnum renderCulling;
62 SoSFEnum pickCulling;
63
64public:
65 SoInteractionKit(void);
66 static void initClass(void);
67
68 enum CacheEnabled { OFF, ON, AUTO };
69
70 virtual SbBool setPartAsPath(const SbName &partname,
71 SoPath *path);
72 virtual SbBool setPartAsDefault(const SbName &partname,
73 SoNode *node,
74 SbBool onlyifdefault = TRUE);
75 virtual SbBool setPartAsDefault(const SbName &partname,
76 const SbName &nodename,
77 SbBool onlyifdefault = TRUE);
78 SbBool isPathSurrogateInMySubgraph(const SoPath *path,
79 SoPath *&pathToOwner,
80 SbName &surrogatename,
81 SoPath *&surrogatepath,
82 SbBool fillargs = TRUE);
83 SbBool isPathSurrogateInMySubgraph(const SoPath *path);
84 static void setSwitchValue(SoNode *node, const int newVal);
85 virtual SbBool setPart(const SbName & partname, SoNode * from);
86
87protected:
88 virtual ~SoInteractionKit();
89 virtual void copyContents(const SoFieldContainer *fromFC,
90 SbBool copyConnections);
91
92 virtual SbBool setPart(const int partNum, SoNode *node);
93 virtual SbBool readInstance(SoInput *in, unsigned short flags);
94 static void readDefaultParts(const char *fileName,
95 const char defaultBuffer[],
96 int defBufSize);
97 virtual SbBool setAnyPartAsDefault(const SbName &partname,
98 SoNode *node,
99 SbBool anypart = TRUE,
100 SbBool onlyifdefault = TRUE);
101 virtual SbBool setAnyPartAsDefault(const SbName &partname,
102 const SbName &nodename,
103 SbBool anypart = TRUE,
104 SbBool onlyifdefault = TRUE);
105 SbBool setAnySurrogatePath(const SbName &name,
106 SoPath *path,
107 SbBool leafcheck = FALSE,
108 SbBool publiccheck = FALSE);
109 virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
110 virtual void setDefaultOnNonWritingFields();
111
112 SoFieldSensor *fieldSensor;
113 static void fieldSensorCB(void *, SoSensor *);
114 SoSeparator *oldTopSep;
115
116 void connectSeparatorFields( SoSeparator *dest, SbBool onOff );
117
118private:
119 class SoInteractionKitP * pimpl;
120 friend class SoInteractionKitP;
121};
122
123#endif // !COIN_SOINTERACTIONKIT_H
SbName
The SbName class stores strings by reference.
Definition SbName.h:40
SoBaseKit::initClass
static void initClass(void)
Definition SoBaseKit.cpp:678
SoBaseKit::SoBaseKit
SoBaseKit(void)
Definition SoBaseKit.cpp:630
SoBaseKit::setDefaultOnNonWritingFields
virtual void setDefaultOnNonWritingFields(void)
Definition SoBaseKit.cpp:1278
SoBaseKit::setPart
virtual SbBool setPart(const SbName &partname, SoNode *from)
Definition SoBaseKit.cpp:794
SoBaseKit::setUpConnections
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways=FALSE)
Definition SoBaseKit.cpp:2050
SoBaseKit::readInstance
virtual SbBool readInstance(SoInput *in, unsigned short flags)
Definition SoBaseKit.cpp:2057
SoBaseKit::copyContents
virtual void copyContents(const SoFieldContainer *fromfc, SbBool copyconnections)
Definition SoBaseKit.cpp:1567
SoFieldContainer
The SoFieldContainer class is a base class for all classes that contain fields.
Definition SoFieldContainer.h:43
SoFieldSensor
The SoFieldSensor class detects changes to a field.
Definition SoFieldSensor.h:38
SoInput
The SoInput class is an abstraction of file import functionality.
Definition SoInput.h:61
SoInteractionKit
The SoInteractionKit class is a base class for draggers.
Definition SoInteractionKit.h:50
SoInteractionKit::renderCaching
SoSFEnum renderCaching
Definition SoInteractionKit.h:59
SoInteractionKit::connectSeparatorFields
void connectSeparatorFields(SoSeparator *dest, SbBool onOff)
Definition SoInteractionKit.cpp:763
SoInteractionKit::fieldSensor
SoFieldSensor * fieldSensor
Definition SoInteractionKit.h:112
SoInteractionKit::CacheEnabled
CacheEnabled
Definition SoInteractionKit.h:68
SoInteractionKit::boundingBoxCaching
SoSFEnum boundingBoxCaching
Definition SoInteractionKit.h:60
SoInteractionKit::renderCulling
SoSFEnum renderCulling
Definition SoInteractionKit.h:61
SoInteractionKit::SoInteractionKit
SoInteractionKit(void)
Definition SoInteractionKit.cpp:218
SoInteractionKit::pickCulling
SoSFEnum pickCulling
Definition SoInteractionKit.h:62
SoInteractionKit::oldTopSep
SoSeparator * oldTopSep
Definition SoInteractionKit.h:114
SoInteractionKit::fieldSensorCB
static void fieldSensorCB(void *, SoSensor *)
Definition SoInteractionKit.cpp:754
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
SoPath
The SoPath class is a container class for traversal path descriptions.
Definition SoPath.h:52
SoSFEnum
The SoSFEnum class is a container for an enum value.
Definition SoSFEnum.h:40
SoSensor
The SoSensor class is the abstract base class for all sensors.
Definition SoSensor.h:43
SoSeparator
The SoSeparator class is a state-preserving group node.
Definition SoSeparator.h:44