Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
SmDynamicObjectKit.h
Go to the documentation of this file.
1 /**************************************************************************\
2  * Copyright (c) Kongsberg Oil & Gas Technologies AS
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions are
7  * met:
8  *
9  * Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  *
12  * Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the distribution.
15  *
16  * Neither the name of the copyright holder nor the names of its
17  * contributors may be used to endorse or promote products derived from
18  * this software without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 \**************************************************************************/
32 
33 #ifndef DYNAMIC_OBJECT_H
34 #define DYNAMIC_OBJECT_H
35 
36 #include <Inventor/nodekits/SoSubKit.h>
37 #include <Inventor/nodekits/SoBaseKit.h>
38 #include <Inventor/fields/SoSFBool.h>
39 #include <Inventor/fields/SoSFString.h>
40 #include <Inventor/fields/SoSFName.h>
41 #include <Inventor/fields/SoSFVec3d.h>
42 #include <Inventor/fields/SoSFVec3f.h>
43 #include <Inventor/fields/SoSFFloat.h>
44 #include <Inventor/fields/SoSFRotation.h>
45 #include <Inventor/C/basic.h>
46 #include <Inventor/SbVec3f.h>
47 #include <SmallChange/basic.h>
48 
49 // Application must set this cb
50 typedef int (*dok_elevation_cb_type)(double easting, double northing, float &elevation);
51 
52 class SmDynamicObjectKitP;
53 class SoSensor;
54 
55 class SMALLCHANGE_DLL_API SmDynamicObjectKit : public SoBaseKit {
56  typedef SoBaseKit inherited;
57 
58  SO_KIT_HEADER(SmDynamicObjectKit);
59 
60  SO_KIT_CATALOG_ENTRY_HEADER(topSeparator);
61  SO_KIT_CATALOG_ENTRY_HEADER(utmPosition);
62  SO_KIT_CATALOG_ENTRY_HEADER(relativePosition);
63  SO_KIT_CATALOG_ENTRY_HEADER(rotation);
64  SO_KIT_CATALOG_ENTRY_HEADER(geometry);
65  SO_KIT_CATALOG_ENTRY_HEADER(shape);
66  SO_KIT_CATALOG_ENTRY_HEADER(fileShape);
67  SO_KIT_CATALOG_ENTRY_HEADER(stdRotation);
68  SO_KIT_CATALOG_ENTRY_HEADER(target);
69  SO_KIT_CATALOG_ENTRY_HEADER(modelRotation);
70  SO_KIT_CATALOG_ENTRY_HEADER(scale);
71  SO_KIT_CATALOG_ENTRY_HEADER(offset);
72  SO_KIT_CATALOG_ENTRY_HEADER(file);
73  SO_KIT_CATALOG_ENTRY_HEADER(childList);
74 
75 public:
76  SmDynamicObjectKit(void);
77 
89 
90  static void initClass(void);
91  static void setElevationCallback(dok_elevation_cb_type cbfunc);
92 
93  void setOrientation(float heading, float pitch, float roll);
94  void setGeometryVisibility(SbBool visibility);
95  SbBool getGeometryVisibility(void);
96  SmDynamicObjectKit * getObjectByObjectId(const SbName objectId);
97  SmDynamicObjectKit * addObject(SmDynamicObjectKit * newObject, const SbName parentId);
98  SmDynamicObjectKit * removeObject(const SbName objectId);
99 
100 protected:
101  virtual ~SmDynamicObjectKit();
102 
103 public:
104 
105  void preRender(SoAction * action);
106 
107  virtual void getBoundingBox(SoGetBoundingBoxAction * action);
108  virtual void GLRender(SoGLRenderAction * action);
109  void reset(void);
110 
111 private:
112 
113  static void field_change_cb(void * closure, SoSensor *);
114  void updateScene(void);
115  SmDynamicObjectKitP * pimpl;
116 
117 };
118 
119 #endif // !DYNAMIC_OBJECT_H
SoSFString objectName
Definition: SmDynamicObjectKit.h:85
SoSFFloat pitch
Definition: SmDynamicObjectKit.h:83
SoSFBool isThreadSafe
Definition: SmDynamicObjectKit.h:78
SoSFBool hasRelativePosition
Definition: SmDynamicObjectKit.h:80
SoSFVec3d position
Definition: SmDynamicObjectKit.h:81
SoSFRotation cameraRotation
Definition: SmDynamicObjectKit.h:88
virtual void GLRender(SoGLRenderAction *action)
SoSFName objectId
Definition: SmDynamicObjectKit.h:86
int(* dok_elevation_cb_type)(double easting, double northing, float &elevation)
Definition: SmDynamicObjectKit.h:50
static void initClass(void)
SoSFFloat heading
Definition: SmDynamicObjectKit.h:82
SoSFBool hasRelativeElevation
Definition: SmDynamicObjectKit.h:79
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
SoSFVec3f cameraOffset
Definition: SmDynamicObjectKit.h:87
SoSFFloat roll
Definition: SmDynamicObjectKit.h:84
Definition: SmDynamicObjectKit.h:55