SmallChange  1.0.0
A collection of extensions to Coin3D
Loading...
Searching...
No Matches
SmDynamicObjectKit.h
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
50typedef int (*dok_elevation_cb_type)(double easting, double northing, float &elevation);
51
52class SmDynamicObjectKitP;
53class SoSensor;
54
55class 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
75public:
77
78 SoSFBool isThreadSafe;
79 SoSFBool hasRelativeElevation;
80 SoSFBool hasRelativePosition;
81 SoSFVec3d position;
82 SoSFFloat heading;
83 SoSFFloat pitch;
84 SoSFFloat roll;
85 SoSFString objectName;
86 SoSFName objectId;
87 SoSFVec3f cameraOffset;
88 SoSFRotation cameraRotation;
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);
98 SmDynamicObjectKit * removeObject(const SbName objectId);
99
100protected:
101 virtual ~SmDynamicObjectKit();
102
103public:
104
105 void preRender(SoAction * action);
106
107 virtual void getBoundingBox(SoGetBoundingBoxAction * action);
108 virtual void GLRender(SoGLRenderAction * action);
109 void reset(void);
110
111private:
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
Definition misc/SbList.h:69
Definition SmDynamicObjectKit.h:55