Coin Logo http://www.sim.no
http://www.coin3d.org

SoHandleBoxDragger.h
1 #ifndef COIN_SOHANDLEBOXDRAGGER_H
2 #define COIN_SOHANDLEBOXDRAGGER_H
3 
4 /**************************************************************************\
5  *
6  * This file is part of the Coin 3D visualization library.
7  * Copyright (C) 1998-2007 by Systems in Motion. All rights reserved.
8  *
9  * This library is free software; you can redistribute it and/or
10  * modify it under the terms of the GNU General Public License
11  * ("GPL") version 2 as published by the Free Software Foundation.
12  * See the file LICENSE.GPL at the root directory of this source
13  * distribution for additional information about the GNU GPL.
14  *
15  * For using Coin with software that can not be combined with the GNU
16  * GPL, and for taking advantage of the additional benefits of our
17  * support services, please contact Systems in Motion about acquiring
18  * a Coin Professional Edition License.
19  *
20  * See http://www.coin3d.org/ for more information.
21  *
22  * Systems in Motion, Postboks 1283, Pirsenteret, 7462 Trondheim, NORWAY.
23  * http://www.sim.no/ sales@sim.no coin-support@coin3d.org
24  *
25 \**************************************************************************/
26 
27 #include <Inventor/draggers/SoDragger.h>
28 #include <Inventor/fields/SoSFVec3f.h>
29 
30 class SoSensor;
31 class SoFieldSensor;
32 class SbPlaneProjector;
33 class SbLineProjector;
34 
35 class COIN_DLL_API SoHandleBoxDragger : public SoDragger {
36  typedef SoDragger inherited;
37 
38  SO_KIT_HEADER(SoHandleBoxDragger);
39 
40  SO_KIT_CATALOG_ENTRY_HEADER(arrow1);
41  SO_KIT_CATALOG_ENTRY_HEADER(arrow1Switch);
42  SO_KIT_CATALOG_ENTRY_HEADER(arrow2);
43  SO_KIT_CATALOG_ENTRY_HEADER(arrow2Switch);
44  SO_KIT_CATALOG_ENTRY_HEADER(arrow3);
45  SO_KIT_CATALOG_ENTRY_HEADER(arrow3Switch);
46  SO_KIT_CATALOG_ENTRY_HEADER(arrow4);
47  SO_KIT_CATALOG_ENTRY_HEADER(arrow4Switch);
48  SO_KIT_CATALOG_ENTRY_HEADER(arrow5);
49  SO_KIT_CATALOG_ENTRY_HEADER(arrow5Switch);
50  SO_KIT_CATALOG_ENTRY_HEADER(arrow6);
51  SO_KIT_CATALOG_ENTRY_HEADER(arrow6Switch);
52  SO_KIT_CATALOG_ENTRY_HEADER(arrowTranslation);
53  SO_KIT_CATALOG_ENTRY_HEADER(drawStyle);
54  SO_KIT_CATALOG_ENTRY_HEADER(extruder1);
55  SO_KIT_CATALOG_ENTRY_HEADER(extruder1Active);
56  SO_KIT_CATALOG_ENTRY_HEADER(extruder1Switch);
57  SO_KIT_CATALOG_ENTRY_HEADER(extruder2);
58  SO_KIT_CATALOG_ENTRY_HEADER(extruder2Active);
59  SO_KIT_CATALOG_ENTRY_HEADER(extruder2Switch);
60  SO_KIT_CATALOG_ENTRY_HEADER(extruder3);
61  SO_KIT_CATALOG_ENTRY_HEADER(extruder3Active);
62  SO_KIT_CATALOG_ENTRY_HEADER(extruder3Switch);
63  SO_KIT_CATALOG_ENTRY_HEADER(extruder4);
64  SO_KIT_CATALOG_ENTRY_HEADER(extruder4Active);
65  SO_KIT_CATALOG_ENTRY_HEADER(extruder4Switch);
66  SO_KIT_CATALOG_ENTRY_HEADER(extruder5);
67  SO_KIT_CATALOG_ENTRY_HEADER(extruder5Active);
68  SO_KIT_CATALOG_ENTRY_HEADER(extruder5Switch);
69  SO_KIT_CATALOG_ENTRY_HEADER(extruder6);
70  SO_KIT_CATALOG_ENTRY_HEADER(extruder6Active);
71  SO_KIT_CATALOG_ENTRY_HEADER(extruder6Switch);
72  SO_KIT_CATALOG_ENTRY_HEADER(surroundScale);
73  SO_KIT_CATALOG_ENTRY_HEADER(translator1);
74  SO_KIT_CATALOG_ENTRY_HEADER(translator1Active);
75  SO_KIT_CATALOG_ENTRY_HEADER(translator1Switch);
76  SO_KIT_CATALOG_ENTRY_HEADER(translator2);
77  SO_KIT_CATALOG_ENTRY_HEADER(translator2Active);
78  SO_KIT_CATALOG_ENTRY_HEADER(translator2Switch);
79  SO_KIT_CATALOG_ENTRY_HEADER(translator3);
80  SO_KIT_CATALOG_ENTRY_HEADER(translator3Active);
81  SO_KIT_CATALOG_ENTRY_HEADER(translator3Switch);
82  SO_KIT_CATALOG_ENTRY_HEADER(translator4);
83  SO_KIT_CATALOG_ENTRY_HEADER(translator4Active);
84  SO_KIT_CATALOG_ENTRY_HEADER(translator4Switch);
85  SO_KIT_CATALOG_ENTRY_HEADER(translator5);
86  SO_KIT_CATALOG_ENTRY_HEADER(translator5Active);
87  SO_KIT_CATALOG_ENTRY_HEADER(translator5Switch);
88  SO_KIT_CATALOG_ENTRY_HEADER(translator6);
89  SO_KIT_CATALOG_ENTRY_HEADER(translator6Active);
90  SO_KIT_CATALOG_ENTRY_HEADER(translator6Switch);
91  SO_KIT_CATALOG_ENTRY_HEADER(uniform1);
92  SO_KIT_CATALOG_ENTRY_HEADER(uniform1Active);
93  SO_KIT_CATALOG_ENTRY_HEADER(uniform1Switch);
94  SO_KIT_CATALOG_ENTRY_HEADER(uniform2);
95  SO_KIT_CATALOG_ENTRY_HEADER(uniform2Active);
96  SO_KIT_CATALOG_ENTRY_HEADER(uniform2Switch);
97  SO_KIT_CATALOG_ENTRY_HEADER(uniform3);
98  SO_KIT_CATALOG_ENTRY_HEADER(uniform3Active);
99  SO_KIT_CATALOG_ENTRY_HEADER(uniform3Switch);
100  SO_KIT_CATALOG_ENTRY_HEADER(uniform4);
101  SO_KIT_CATALOG_ENTRY_HEADER(uniform4Active);
102  SO_KIT_CATALOG_ENTRY_HEADER(uniform4Switch);
103  SO_KIT_CATALOG_ENTRY_HEADER(uniform5);
104  SO_KIT_CATALOG_ENTRY_HEADER(uniform5Active);
105  SO_KIT_CATALOG_ENTRY_HEADER(uniform5Switch);
106  SO_KIT_CATALOG_ENTRY_HEADER(uniform6);
107  SO_KIT_CATALOG_ENTRY_HEADER(uniform6Active);
108  SO_KIT_CATALOG_ENTRY_HEADER(uniform6Switch);
109  SO_KIT_CATALOG_ENTRY_HEADER(uniform7);
110  SO_KIT_CATALOG_ENTRY_HEADER(uniform7Active);
111  SO_KIT_CATALOG_ENTRY_HEADER(uniform7Switch);
112  SO_KIT_CATALOG_ENTRY_HEADER(uniform8);
113  SO_KIT_CATALOG_ENTRY_HEADER(uniform8Active);
114  SO_KIT_CATALOG_ENTRY_HEADER(uniform8Switch);
115 
116 public:
117  static void initClass(void);
118  SoHandleBoxDragger(void);
119 
122 
123 protected:
125  virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
126  virtual void setDefaultOnNonWritingFields(void);
127 
128  static void startCB(void * f, SoDragger * d);
129  static void motionCB(void * f, SoDragger * d);
130  static void finishCB(void * f, SoDragger * d);
131  static void metaKeyChangeCB(void * f, SoDragger * d);
132  static void fieldSensorCB(void * f, SoSensor * s);
133  static void valueChangedCB(void * f, SoDragger * d);
134 
135  void dragStart(void);
136  void drag(void);
137  void dragFinish(void);
138  void setAllPartsActive(SbBool onoroff);
139 
142 
143 private:
144 
145  void updateSwitches();
146  void updateArrows();
147  SoNode *getNodeFieldNode(const char *fieldname);
148  SbPlaneProjector *planeProj;
149  SbLineProjector *lineProj;
150  int whatkind;
151  int whatnum;
152  int constraintState;
153  SbBool ctrlDown;
154  SbVec3f worldRestartPt;
155  SbVec3f ctrlOffset;
156 
157  void getSurroundScaleMatrices(SbMatrix &matrix, SbMatrix &inv);
158  SbVec3f getDraggerCenter();
159  SbVec3f calcCtrlOffset(const SbVec3f startpt);
160 };
161 
162 #endif // !COIN_SOHANDLEBOXDRAGGER_H
SoSFVec3f
The SoSFVec3f class is a container for an SbVec3f vector.
Definition: SoSFVec3f.h:31
SbRotation
The SbRotation class represents a rotation in 3D space.
Definition: SbRotation.h:33
SoDragger::workFieldsIntoTransform
void workFieldsIntoTransform(SbMatrix &mtx)
Definition: SoDragger.cpp:1123
SoFieldContainer::getField
virtual SoField * getField(const SbName &name) const
Definition: SoFieldContainer.cpp:364
SoHandleBoxDragger::~SoHandleBoxDragger
~SoHandleBoxDragger()
Definition: SoHandleBoxDragger.cpp:479
SoDragger::appendTranslation
static SbMatrix appendTranslation(const SbMatrix &mtx, const SbVec3f &translation, const SbMatrix *conversion=NULL)
Definition: SoDragger.cpp:1252
SoDragger::getLocalStartingPoint
SbVec3f getLocalStartingPoint(void)
Definition: SoDragger.cpp:805
SbLine::getClosestPoint
SbVec3f getClosestPoint(const SbVec3f &point) const
Definition: SbLine.cpp:263
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition: SbMatrix.h:37
SbPlaneProjector
The SbPlaneProjector class projects 2D points to 3D points in a plane.
Definition: SbPlaneProjector.h:31
SoSensor
The SoSensor class is the abstract base class for all sensors.
Definition: SoSensor.h:34
SoDragger::isAdequateConstraintMotion
SbBool isAdequateConstraintMotion(void)
Definition: SoDragger.cpp:1462
SoBaseKit::getPart
virtual SoNode * getPart(const SbName &partname, SbBool makeifneeded)
Definition: SoBaseKit.cpp:699
SoHandleBoxDragger::translFieldSensor
SoFieldSensor * translFieldSensor
Definition: SoHandleBoxDragger.h:140
SoDragger::getEvent
const SoEvent * getEvent(void) const
Definition: SoDragger.cpp:962
SbMatrix::multVecMatrix
void multVecMatrix(const SbVec3f &src, SbVec3f &dst) const
Definition: SbMatrix.cpp:1357
SoHandleBoxDragger::metaKeyChangeCB
static void metaKeyChangeCB(void *f, SoDragger *d)
Definition: SoHandleBoxDragger.cpp:586
SoFieldSensor::getAttachedField
SoField * getAttachedField(void) const
Definition: SoFieldSensor.cpp:107
SoDragger::addOtherEventCallback
void addOtherEventCallback(SoDraggerCB *func, void *data=NULL)
Definition: SoDragger.cpp:702
SoEvent::wasCtrlDown
SbBool wasCtrlDown(void) const
Definition: SoEvent.cpp:259
SoSurroundScale
The SoSurroundScale class is used to automatically scale geometry to surround other geometry.
Definition: SoSurroundScale.h:34
SoSwitch
The SoSwitch class is a group node which selects one child subgraph for traversal.
Definition: SoSwitch.h:37
SoInteractionKit::setSwitchValue
static void setSwitchValue(SoNode *node, const int newVal)
Definition: SoInteractionKit.cpp:358
SoDelayQueueSensor::setPriority
void setPriority(uint32_t pri)
Definition: SoDelayQueueSensor.cpp:108
SoHandleBoxDragger::dragFinish
void dragFinish(void)
Definition: SoHandleBoxDragger.cpp:820
SoDragger
The SoDragger class is the base class for all draggers.
Definition: SoDragger.h:53
SoDrawStyle
The SoDrawStyle class specificies common rendering properties for shapes.
Definition: SoDrawStyle.h:33
SbString
The SbString class is a string class with convenience functions for string operations.
Definition: SbString.h:42
SoHandleBoxDragger::setUpConnections
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways=0)
Definition: SoHandleBoxDragger.cpp:489
SoInteractionKit::readDefaultParts
static void readDefaultParts(const char *fileName, const char defaultBuffer[], int defBufSize)
Definition: SoInteractionKit.cpp:433
SoHandleBoxDragger::setDefaultOnNonWritingFields
virtual void setDefaultOnNonWritingFields(void)
Definition: SoHandleBoxDragger.cpp:520
SoDragger::addFinishCallback
void addFinishCallback(SoDraggerCB *func, void *data=NULL)
Definition: SoDragger.cpp:611
SoFieldSensor::detach
void detach(void)
Definition: SoFieldSensor.cpp:92
SoInteractionKit::setUpConnections
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways=0)
Definition: SoInteractionKit.cpp:648
SoSurroundScale::invalidate
void invalidate(void)
Definition: SoSurroundScale.cpp:270
SoDragger::getViewVolume
const SbViewVolume & getViewVolume(void)
Definition: SoDragger.cpp:1032
SbProjector::setWorkingSpace
virtual void setWorkingSpace(const SbMatrix &space)
Definition: SbProjector.cpp:133
SoDragger::addValueChangedCallback
void addValueChangedCallback(SoDraggerCB *func, void *data=NULL)
Definition: SoDragger.cpp:634
SoDragger::setMotionMatrix
void setMotionMatrix(const SbMatrix &newmatrix)
Definition: SoDragger.cpp:905
SoPath::findNode
int findNode(const SoNode *const node) const
Definition: SoPath.cpp:587
SoField
The SoField class is the top-level abstract base class for fields.
Definition: SoField.h:38
SoPath
The SoPath class is a container class for traversal path descriptions.
Definition: SoPath.h:43
SoField::setDefault
void setDefault(SbBool def)
Definition: SoField.cpp:650
SoHandleBoxDragger::dragStart
void dragStart(void)
Definition: SoHandleBoxDragger.cpp:621
SoHandleBoxDragger::scaleFactor
SoSFVec3f scaleFactor
Definition: SoHandleBoxDragger.h:120
SoHandleBoxDragger::finishCB
static void finishCB(void *f, SoDragger *d)
Definition: SoHandleBoxDragger.cpp:578
SbLineProjector::setLine
void setLine(const SbLine &line)
Definition: SbLineProjector.cpp:131
SbMatrix::getTransform
void getTransform(SbVec3f &t, SbRotation &r, SbVec3f &s, SbRotation &so) const
Definition: SbMatrix.cpp:997
SbProjector::setViewVolume
virtual void setViewVolume(const SbViewVolume &vol)
Definition: SbProjector.cpp:112
SoHandleBoxDragger::valueChangedCB
static void valueChangedCB(void *f, SoDragger *d)
Definition: SoHandleBoxDragger.cpp:541
SoDragger::getWorldToLocalMatrix
SbMatrix getWorldToLocalMatrix(void)
Definition: SoDragger.cpp:791
SoDragger::appendScale
static SbMatrix appendScale(const SbMatrix &mtx, const SbVec3f &scale, const SbVec3f &scalecenter, const SbMatrix *conversion=NULL)
Definition: SoDragger.cpp:1271
SoDragger::isActive
SoSFBool isActive
Definition: SoDragger.h:61
SoTranslation::translation
SoSFVec3f translation
Definition: SoTranslation.h:40
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:37
SoHandleBoxDragger::SoHandleBoxDragger
SoHandleBoxDragger(void)
Definition: SoHandleBoxDragger.cpp:306
SoDragger::setDefaultOnNonWritingFields
virtual void setDefaultOnNonWritingFields(void)
Definition: SoDragger.cpp:1743
SoHandleBoxDragger::setAllPartsActive
void setAllPartsActive(SbBool onoroff)
Definition: SoHandleBoxDragger.cpp:833
SbString::sprintf
SbString & sprintf(const char *formatstr,...)
Definition: SbString.h:105
SoBaseKit::connectionsSetUp
SbBool connectionsSetUp
Definition: SoBaseKit.h:142
SoHandleBoxDragger::drag
void drag(void)
Definition: SoHandleBoxDragger.cpp:725
SoFieldSensor::attach
void attach(SoField *field)
Definition: SoFieldSensor.cpp:77
SoDragger::getMotionMatrix
const SbMatrix & getMotionMatrix(void)
Definition: SoDragger.cpp:688
SoDragger::getPartToLocalMatrix
void getPartToLocalMatrix(const SbName &partname, SbMatrix &parttolocalmatrix, SbMatrix &localtopartmatrix)
Definition: SoDragger.cpp:826
SoHandleBoxDragger::motionCB
static void motionCB(void *f, SoDragger *d)
Definition: SoHandleBoxDragger.cpp:570
SoFieldSensor
The SoFieldSensor class detects changes to a field.
Definition: SoFieldSensor.h:29
SoInteractionKit
The SoInteractionKit class is a base class for draggers.
Definition: SoInteractionKit.h:41
SoSFNode
The SoSFNode class is a container for a single node.
Definition: SoSFNode.h:38
SbLine
The SbLine class represents a line in 3D space.
Definition: SbLine.h:32
SoSeparator
The SoSeparator class is a state-preserving group node.
Definition: SoSeparator.h:34
SoDragger::getNormalizedLocaterPosition
SbVec2f getNormalizedLocaterPosition(void)
Definition: SoDragger.cpp:1408
SoDragger::getPickPath
const SoPath * getPickPath(void) const
Definition: SoDragger.cpp:953
SoHandleBoxDragger::fieldSensorCB
static void fieldSensorCB(void *f, SoSensor *s)
Definition: SoHandleBoxDragger.cpp:531
SbLineProjector::project
virtual SbVec3f project(const SbVec2f &point)
Definition: SbLineProjector.cpp:67
SoDragger::getStartMotionMatrix
const SbMatrix & getStartMotionMatrix(void)
Definition: SoDragger.cpp:930
SoHandleBoxDragger::startCB
static void startCB(void *f, SoDragger *d)
Definition: SoHandleBoxDragger.cpp:562
SoBaseKit
The SoBaseKit class is the toplevel superclass for nodekits.
Definition: SoBaseKit.h:57
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition: SoNode.h:47
SoTranslation
The SoTranslation class is a node type for specifying geometry translations.
Definition: SoTranslation.h:31
SoHandleBoxDragger
The SoHandleBoxDragger class provides support for interactive scaling and translation.
Definition: SoHandleBoxDragger.h:35
SoDragger::addStartCallback
void addStartCallback(SoDraggerCB *func, void *data=NULL)
Definition: SoDragger.cpp:570
SoDragger::setStartLocaterPosition
void setStartLocaterPosition(SbVec2s p)
Definition: SoDragger.cpp:1450
SoField::isOfType
SbBool isOfType(const SoType type) const
Definition: SoField.cpp:690
SoInteractionKit::fieldSensorCB
static void fieldSensorCB(void *, SoSensor *)
Definition: SoInteractionKit.cpp:725
SbMatrix::identity
static SbMatrix identity(void)
Definition: SbMatrix.cpp:748
SoEvent
The SoEvent class is the base class for all Coin events.
Definition: SoEvent.h:34
SoDragger::addMotionCallback
void addMotionCallback(SoDraggerCB *func, void *data=NULL)
Definition: SoDragger.cpp:591
SbString::getString
const char * getString(void) const
Definition: SbString.h:71
SbPlaneProjector::setPlane
void setPlane(const SbPlane &plane)
Definition: SbPlaneProjector.cpp:183
SbPlane
The SbPlane class represents a plane in 3D space.
Definition: SbPlane.h:34
SoDragger::initClass
static void initClass(void)
Definition: SoDragger.cpp:388
SbLineProjector
The SbLineProjector class projects 2D points to 3D points along a line.
Definition: SbLineProjector.h:32
SoHandleBoxDragger::scaleFieldSensor
SoFieldSensor * scaleFieldSensor
Definition: SoHandleBoxDragger.h:141
SoInteractionKit::setPartAsDefault
virtual SbBool setPartAsDefault(const SbName &partname, SoNode *node, SbBool onlyifdefault=1)
Definition: SoInteractionKit.cpp:271
SbPlaneProjector::project
virtual SbVec3f project(const SbVec2f &point)
Definition: SbPlaneProjector.cpp:101
SoDragger::getLocalToWorldMatrix
SbMatrix getLocalToWorldMatrix(void)
Definition: SoDragger.cpp:776
SoHandleBoxDragger::translation
SoSFVec3f translation
Definition: SoHandleBoxDragger.h:121

Copyright © 1998-2007 by Systems in Motion AS. All rights reserved.

Generated on Wed Jul 24 2019 for Coin by Doxygen. 1.8.17