Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/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
41 class 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 
47 class SoSensor;
48 class 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 
58 public:
63 
64 public:
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 
87 protected:
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 
113  static void fieldSensorCB(void *, SoSensor *);
115 
116  void connectSeparatorFields( SoSeparator *dest, SbBool onOff );
117 
118 private:
119  class SoInteractionKitP * pimpl;
120  friend class SoInteractionKitP;
121 };
122 
123 #endif // !COIN_SOINTERACTIONKIT_H
The SoBase class is the top-level superclass for a number of class-hierarchies.
Definition: SoBase.h:45
The SoBaseKit class is the toplevel superclass for nodekits.
Definition: SoBaseKit.h:66
SoFieldSensor * fieldSensor
Definition: SoInteractionKit.h:112
virtual SbBool setPart(const SbName &partname, SoNode *from)
Definition: SoBaseKit.cpp:809
The SoFieldContainer class is a base class for all classes that contain fields.
Definition: SoFieldContainer.h:43
The SoNode class is the base class for nodes used in scene graphs.
Definition: SoNode.h:56
CacheEnabled
Definition: SoInteractionKit.h:68
The SoSFEnum class is a container for an enum value.
Definition: SoSFEnum.h:40
virtual void setDefaultOnNonWritingFields(void)
Definition: SoBaseKit.cpp:1293
The SoInteractionKit class is a base class for draggers.
Definition: SoInteractionKit.h:50
virtual void copyContents(const SoFieldContainer *fromfc, SbBool copyconnections)
Definition: SoBaseKit.cpp:1582
The SoPath class is a container class for traversal path descriptions.
Definition: SoPath.h:52
The SoSensor class is the abstract base class for all sensors.
Definition: SoSensor.h:43
virtual SbBool readInstance(SoInput *in, unsigned short flags)
Definition: SoBaseKit.cpp:2072
The SoFieldSensor class detects changes to a field.
Definition: SoFieldSensor.h:38
SoSFEnum boundingBoxCaching
Definition: SoInteractionKit.h:60
SoSFEnum pickCulling
Definition: SoInteractionKit.h:62
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways=FALSE)
Definition: SoBaseKit.cpp:2065
The SoInput class is an abstraction of file import functionality.
Definition: SoInput.h:61
SoSFEnum renderCulling
Definition: SoInteractionKit.h:61
The SoSeparator class is a state-preserving group node.
Definition: SoSeparator.h:44
SoSFEnum renderCaching
Definition: SoInteractionKit.h:59
SoSeparator * oldTopSep
Definition: SoInteractionKit.h:114
The SbName class stores strings by reference.
Definition: SbName.h:40