NutsnBolts  0.1.0
An extension library for Coin
Loading...
Searching...
No Matches
NbNavigationSystem.h
1#ifndef NB_NAVIGATIONSYSTEM_H
2#define NB_NAVIGATIONSYSTEM_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/SbName.h>
37#include <Inventor/SbVec3f.h>
38
39#include <NutsnBolts/Basic.h>
40
41class SbViewportRegion;
42class SoNode;
43class SoPath;
44class SoCamera;
45class SoEvent;
46
50
51#define NB_IDLER_SYSTEM "idler"
52#define NB_IDLER_IDLE_MODE "idler:idle"
53
54#define NB_EXAMINER_SYSTEM "examiner"
55#define NB_EXAMINER_IDLE_MODE "examiner:idle"
56#define NB_EXAMINER_ROTATE_MODE "examiner:rotate"
57#define NB_EXAMINER_WAITFORZOOM_MODE "examiner:wait_for_zoom"
58#define NB_EXAMINER_ZOOM_MODE "examiner:zoom"
59#define NB_EXAMINER_WAITFORPAN_MODE "examiner:wait_for_pan"
60#define NB_EXAMINER_PAN_MODE "examiner:pan"
61#define NB_EXAMINER_WAITFORCENTER_MODE "examiner:wait_for_center"
62#define NB_EXAMINER_CENTER_MODE "examiner:center"
63
64// some simple button1-modes
65#define NB_PANNER_SYSTEM "panner"
66#define NB_PANNER_IDLE_MODE "panner:idle"
67#define NB_PANNER_PAN_MODE "panner:pan"
68
69#define NB_ZOOMER_SYSTEM "zoomer"
70#define NB_ZOOMER_IDLE_MODE "zoomer:idle"
71#define NB_ZOOMER_ZOOM_MODE "zoomer:zoom"
72
73#define NB_ROTATER_SYSTEM "rotater"
74#define NB_ROTATER_IDLE_MODE "rotater:idle"
75#define NB_ROTATER_ROTATE_MODE "rotater:rotate"
76
77#define NB_CENTERER_SYSTEM "centerer"
78#define NB_CENTERER_IDLE_MODE "centerer:idle"
79#define NB_CENTERER_CENTER_MODE "centerer:center"
80
81#define NB_PICKER_SYSTEM "picker"
82#define NB_PICKER_IDLE_MODE "picker:idle"
83#define NB_PICKER_PICK_MODE "picker:pick"
84
85#define NB_DEFAULT_SYSTEM NB_EXAMINER_SYSTEM
86
87typedef
88 void NbNavigationModeChangeCB(void * closure, NbNavigationSystem * system);
89
90class NbNavigationSystemP;
91
92class NB_DLL_API NbNavigationSystem {
93public:
94 static void initClass(void);
95 static void cleanClass(void);
96
97 static SbBool registerSystem(NbNavigationSystem * system);
98 static SbBool unregisterSystem(NbNavigationSystem * system);
99 static SbBool isRegistered(NbNavigationSystem * system);
100
101 static NbNavigationSystem * getByName(SbName name);
102 static NbNavigationSystem * createByName(SbName name);
103
104public:
105 NbNavigationSystem(SbName name);
107
108 NbNavigationSystem * clone(void) const;
109
110 void addModeChangeCallback(NbNavigationModeChangeCB * cb, void * closure);
111 void removeModeChangeCallback(NbNavigationModeChangeCB * cb, void * closure);
112
113 void setSceneGraph(SoNode * scenegraph);
114 void setCamera(SoCamera * camera);
115 void setViewport(const SbViewportRegion & viewport);
116
117 void viewAll(void);
118 void viewPart(SoPath * path, const SbVec3f & in, const SbVec3f & up);
119 void viewPart(SoNode * node, const SbVec3f & in, const SbVec3f & up);
120
121 SbBool processEvent(const SoEvent * event);
122 NbNavigationControl * getNavigationControl(void) const;
123
124 SbName getName(void) const;
125
126 SbName getCurrentModeName(void) const;
127 NbNavigationMode * getMode(SbName name) const;
128 NbNavigationMode * getCurrentMode(void) const;
129
131 INITIAL,
132 STACK,
133 SWITCH,
134 FINISH,
135 ABORT
136 };
137
138 void addMode(NbNavigationMode * mode);
139 void addModeTransition(NbNavigationMode * mode,
140 TransitionType type,
141 const SoEvent * trigger = NULL,
142 const SoEvent * condition = NULL);
143 void addModeTransition(NbNavigationMode * mode1,
144 NbNavigationMode * mode2,
145 TransitionType type,
146 const SoEvent * trigger,
147 const SoEvent * condition = NULL);
148
149protected:
150 friend class NbSceneManager;
151 void invokeModeChangeCallbacks(void);
152
153private:
154 NbNavigationSystemP * pimpl;
155
156}; // NbNavigationSystem
157
158#endif // !NB_NAVIGATIONSYSTEM_H
Definition NbNavigationControl.h:50
Abstract base class for implementing a navigation submode.
Definition NbNavigationMode.h:59
Class for managing user-based viewer navigation.
Definition NbNavigationSystem.h:92
TransitionType
Definition NbNavigationSystem.h:130
Extends the SoSceneManager class with more high-level viewer related functionality.
Definition NbSceneManager.h:44