Open Inventor Release 2024.1.3
 
Loading...
Searching...
No Matches
SoInteractiveComplexity.h
1/*=======================================================================
2 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), ***
3 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. ***
4 *** ***
5 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS ***
6 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR ***
7 *** WRITTEN AUTHORIZATION OF FEI S.A.S. ***
8 *** ***
9 *** RESTRICTED RIGHTS LEGEND ***
10 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS ***
11 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN ***
12 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT ***
13 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN ***
14 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. ***
15 *** ***
16 *** COPYRIGHT (C) 1996-2017 BY FEI S.A.S, ***
17 *** BORDEAUX, FRANCE ***
18 *** ALL RIGHTS RESERVED ***
19**=======================================================================*/
20/*=======================================================================
21** Author : VSG (MMM YYYY)
22**=======================================================================*/
23#ifndef SO_INTERACTIVE_COMPLEXITY_H
24#define SO_INTERACTIVE_COMPLEXITY_H
25
26#include <Inventor/nodes/SoNode.h>
27#include <Inventor/fields/SoMFString.h>
28#include <Inventor/fields/SoSFEnum.h>
29#include <Inventor/fields/SoSFBool.h>
30#include <Inventor/fields/SoSFFloat.h>
31
32#include <Inventor/STL/map>
33#include <Inventor/sensors/SoAlarmSensor.h>
34
35#ifdef _WIN32
36#pragma warning( push )
37#pragma warning(disable:4251) // disable warning 4251 "needs to have dll-interface to be used by clients of class..." caused by ScalarBoundsMap
38#endif
39
153{
154 SO_NODE_HEADER(SoInteractiveComplexity);
155
156public:
158
170
221
226
234
235private:
236 virtual void doAction(SoAction *action);
237 virtual void GLRender(SoGLRenderAction *action);
238
239private:
243 virtual void notify(SoNotList *list);
244
245 static void initClass();
246 static void exitClass();
247
249 double getScalarFieldValue(SoState* state, const SoSField* field);
250 SbBool getBooleanFieldValue(SoState* state, const SoSFBool* field);
251 int getEnumFieldValue(SoState* state, const SoSFEnum* field);
252
254 bool isBounded(const SoField* field) const;
255
256private:
257 struct ScalarBounds
258 {
259 double startBound;
260 double endBound;
261 double increment;
262 // used to return the previous val during delayed pass
263 double currentVal;
264 bool immediate;
265 };
266 typedef std::map<SbString, ScalarBounds> ScalarBoundsMap;
267
268 virtual ~SoInteractiveComplexity();
269
271 static SbBool isScalarField(const SoField* field);
272
274 void updateFieldList();
275 void addParameters(const SbString& paramString);
276
278 void handleScalarParam(const SbString& paramString, const std::vector<SbString>& token);
279 void handleBoolParam(const SbString& paramString, const std::vector<SbString>& token);
280 void handleEnumParam(const SbString& paramString, const std::vector<SbString>& token,
281 const SoField* field);
282
284 bool checkParamNumber(size_t numParam, size_t expected, const SbString& fieldName) const;
285
287 void getClassAndFieldName(const SoField* field, SbString& className, SbString& fieldName) const;
288
290 double getScalarFieldValue(SoState* state, const SoSField* field,
291 const SbString& classAndFieldName, bool updateValue = false);
292
294 void updateAllFieldsValue(SoState* state);
295
298 static void sensorCB(void *data, SoSensor *sensor);
299
301 ScalarBoundsMap m_scalarBounds;
302
304 SoAlarmSensor m_redrawSensor;
305};
306
307#if defined(_WIN32)
308#pragma warning( pop )
309#endif
310
311#endif //SO_INTERACTIVE_COMPLEXITY_H
Class for smart character strings.
Definition SbString.h:202
Abstract base class for all actions.
Definition SoAction.h:132
Triggers a delegate once sometime in the future.
Base class for all fields.
Definition SoField.h:234
Renders a scene graph using Open Inventor's Render Engine.
Field interactive complexity node.
SoSFFloat refinementDelay
Time in seconds after interaction stops before field values start to be increased.
SoSFEnum interactiveMode
Interactive mode.
@ AUTO
Automatically detect when a user interaction is occurring (default)
@ DISABLED
Behave like there isn't any SoInteractiveComplexity node.
@ FORCE_INTERACTION
Behave like a user interaction is occurring (always use InteractionValue)
@ FORCE_STILL
Behave like there isn't any interaction (always use StillValue)
SoMFString fieldSettings
Each string in this field specifies the interactionValue and stillValue for a specific field of a spe...
Multiple-value field containing any number of strings.
Definition SoMFString.h:116
Abstract base class for all database nodes.
Definition SoNode.h:145
Field containing a single Boolean value.
Definition SoSFBool.h:79
Field containing an enumerated value.
Definition SoSFEnum.h:89
Field containing a floating-point value.
Definition SoSFFloat.h:78
Abstract base class for all single-value fields.
Definition SoSField.h:93
Abstract base class for Open Inventor sensors.
Definition SoSensor.h:100
Traversal state.
Definition SoState.h:74
int SbBool
Boolean type.
Definition SbBase.h:87