Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
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
36#include <Inventor/draggers/SoDragger.h>
37#include <Inventor/tools/SbLazyPimplPtr.h>
38#include <Inventor/fields/SoSFVec3f.h>
39
40class SoSensor;
41class SoFieldSensor;
42class SbLineProjector;
44class SoTabPlaneDraggerP;
45
46class 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
69public:
70 static void initClass(void);
72
75
76 void adjustScaleTabSize(void);
77
78protected:
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
100private:
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
125private:
127
128 // NOT IMPLEMENTED:
130 SoTabPlaneDragger & operator = (const SoTabPlaneDragger & rhs);
131}; // SoTabPlaneDragger
132
133#endif // !COIN_SOTABPLANEDRAGGER_H
Definition SbLazyPimplPtr.h:56
The SbLineProjector class projects 2D points to 3D points along a line.
Definition SbLineProjector.h:41
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 SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:49
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:51
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
The SoDragger class is the base class for all draggers.
Definition SoDragger.h:62
static void initClass(void)
Definition SoDragger.cpp:408
virtual void setDefaultOnNonWritingFields(void)
Definition SoDragger.cpp:1828
virtual void GLRender(SoGLRenderAction *action)
Definition SoDragger.cpp:520
The SoFieldSensor class detects changes to a field.
Definition SoFieldSensor.h:38
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:50
static void fieldSensorCB(void *, SoSensor *)
Definition SoInteractionKit.cpp:754
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways=FALSE)
Definition SoInteractionKit.cpp:677
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
The SoSFVec3f class is a container for an SbVec3f vector.
Definition SoSFVec3f.h:40
The SoSensor class is the abstract base class for all sensors.
Definition SoSensor.h:43
The SoTabPlaneDragger class is a dragger you can translate and scale within a plane.
Definition SoTabPlaneDragger.h:46
SoSFVec3f translation
Definition SoTabPlaneDragger.h:73
SoSFVec3f scaleFactor
Definition SoTabPlaneDragger.h:74