Coin Logo Coin3D is Free Software,
published under the BSD 3-clause license.
https://bitbucket.org/Coin3D/
http://www.kongsberg.com/kogt/
SoTabPlaneDragger.h
1 #ifndef COIN_SOTABPLANEDRAGGER_H
2 #define COIN_SOTABPLANEDRAGGER_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 
37 #include <Inventor/tools/SbLazyPimplPtr.h>
38 #include <Inventor/fields/SoSFVec3f.h>
39 
40 class SoSensor;
41 class SoFieldSensor;
42 class SbLineProjector;
43 class SbPlaneProjector;
44 class SoTabPlaneDraggerP;
45 
46 class COIN_DLL_API SoTabPlaneDragger : public SoDragger {
47  typedef SoDragger inherited;
48 
49  SO_KIT_HEADER(SoTabPlaneDragger);
50  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleCoords);
51  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab0);
52  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab1);
53  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab2);
54  SO_KIT_CATALOG_ENTRY_HEADER(cornerScaleTab3);
55  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleCoords);
56  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab0);
57  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab1);
58  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab2);
59  SO_KIT_CATALOG_ENTRY_HEADER(edgeScaleTab3);
60  SO_KIT_CATALOG_ENTRY_HEADER(planeSwitch);
61  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabHints);
62  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterial);
63  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabMaterialBinding);
64  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormal);
65  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabNormalBinding);
66  SO_KIT_CATALOG_ENTRY_HEADER(scaleTabs);
67  SO_KIT_CATALOG_ENTRY_HEADER(translator);
68 
69 public:
70  static void initClass(void);
71  SoTabPlaneDragger(void);
72 
75 
76  void adjustScaleTabSize(void);
77 
78 protected:
79  virtual ~SoTabPlaneDragger(void);
80 
81  virtual void GLRender(SoGLRenderAction * action);
82 
83  virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
84  virtual void setDefaultOnNonWritingFields(void);
85 
86  void reallyAdjustScaleTabSize(SoGLRenderAction * action);
87 
88  void getXYScreenLengths(SbVec2f & lengths, const SbMatrix & localtoscreen,
89  const SbVec2s & winsize);
90 
91  void dragStart(void);
92  void drag(void);
93  void dragFinish(void);
94 
95  // Lots of public/protected methods and members were removed from
96  // this class as they clearly should have been private.
97  // Let us know if we've removed something that you need.
98  // pederb, 20000226
99 
100 private:
101 
102  // static methods moved from public to private
103  static void startCB(void * f, SoDragger * d);
104  static void motionCB(void * f, SoDragger * d);
105  static void finishCB(void * f, SoDragger * d);
106  static void metaKeyChangeCB(void * f, SoDragger * d);
107  static void fieldSensorCB(void * f, SoSensor * s);
108  static void valueChangedCB(void * f, SoDragger * d);
109 
110  void createPrivateParts(void);
111  SoNode *getNodeFieldNode(const char *fieldname);
112 
113  SoFieldSensor * scaleFieldSensor;
114  SoFieldSensor * translFieldSensor;
115  SbLineProjector *lineProj;
116  SbPlaneProjector *planeProj;
117  int whatkind;
118  int constraintState;
119  float prevsizex;
120  float prevsizey;
121  SbBool adjustTabs;
122  SbVec3f worldRestartPt;
123  SbVec3f scaleCenter;
124 
125 private:
127 
128  // NOT IMPLEMENTED:
130  SoTabPlaneDragger & operator = (const SoTabPlaneDragger & rhs);
131 }; // SoTabPlaneDragger
132 
133 #endif // !COIN_SOTABPLANEDRAGGER_H
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition: SbVec2f.h:49
static void fieldSensorCB(void *, SoSensor *)
Definition: SoInteractionKit.cpp:752
SoSFVec3f translation
Definition: SoTabPlaneDragger.h:73
The SoNode class is the base class for nodes used in scene graphs.
Definition: SoNode.h:56
The SoInteractionKit class is a base class for draggers.
Definition: SoInteractionKit.h:50
The SoTabPlaneDragger class is a dragger you can translate and scale within a plane.
Definition: SoTabPlaneDragger.h:46
The SoDragger class is the base class for all draggers.
Definition: SoDragger.h:64
The SoSensor class is the abstract base class for all sensors.
Definition: SoSensor.h:43
static void initClass(void)
Definition: SoDragger.cpp:409
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition: SbVec3f.h:51
SoSFVec3f scaleFactor
Definition: SoTabPlaneDragger.h:74
The SoFieldSensor class detects changes to a field.
Definition: SoFieldSensor.h:38
virtual void GLRender(SoGLRenderAction *action)
Definition: SoDragger.cpp:521
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition: SbMatrix.h:47
The SbPlaneProjector class projects 2D points to 3D points in a plane.
Definition: SbPlaneProjector.h:40
The SoSFVec3f class is a container for an SbVec3f vector.
Definition: SoSFVec3f.h:40
The SbLineProjector class projects 2D points to 3D points along a line.
Definition: SbLineProjector.h:41
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition: SbVec2s.h:51
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways=FALSE)
Definition: SoInteractionKit.cpp:675
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition: SoGLRenderAction.h:50
virtual void setDefaultOnNonWritingFields(void)
Definition: SoDragger.cpp:1829