Coin: SoTabPlaneDragger.h Source File

| Coin3D is Free Software, published under the BSD 3-clause license. | https://coin3d.github.io https://www.kongsberg.com/en/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
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;
43class SbPlaneProjector;
44class 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
69public:
70 static void initClass(void);
71 SoTabPlaneDragger(void);
72
73 SoSFVec3f translation;
74 SoSFVec3f scaleFactor;
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:
126 SbLazyPimplPtr<SoTabPlaneDraggerP> pimpl;
127
128 // NOT IMPLEMENTED:
129 SoTabPlaneDragger(const SoTabPlaneDragger & rhs);
130 SoTabPlaneDragger & operator = (const SoTabPlaneDragger & rhs);
131}; // SoTabPlaneDragger
132
133#endif // !COIN_SOTABPLANEDRAGGER_H
SbLazyPimplPtr
Definition SbLazyPimplPtr.h:56
SbLineProjector
The SbLineProjector class projects 2D points to 3D points along a line.
Definition SbLineProjector.h:41
SbMatrix
The SbMatrix class is a 4x4 dimensional representation of a matrix.
Definition SbMatrix.h:47
SbPlaneProjector
The SbPlaneProjector class projects 2D points to 3D points in a plane.
Definition SbPlaneProjector.h:40
SbVec2f
The SbVec2f class is a 2 dimensional vector with floating point coordinates.
Definition SbVec2f.h:49
SbVec2s
The SbVec2s class is a 2 dimensional vector with short integer coordinates.
Definition SbVec2s.h:51
SbVec3f
The SbVec3f class is a 3 dimensional vector with floating point coordinates.
Definition SbVec3f.h:51
SoDragger::SoDragger
SoDragger(void)
Definition SoDragger.cpp:355
SoDragger::initClass
static void initClass(void)
Definition SoDragger.cpp:408
SoDragger::setDefaultOnNonWritingFields
virtual void setDefaultOnNonWritingFields(void)
Definition SoDragger.cpp:1828
SoDragger::GLRender
virtual void GLRender(SoGLRenderAction *action)
Definition SoDragger.cpp:520
SoFieldSensor
The SoFieldSensor class detects changes to a field.
Definition SoFieldSensor.h:38
SoGLRenderAction
The SoGLRenderAction class renders the scene graph with OpenGL calls.
Definition SoGLRenderAction.h:50
SoInteractionKit::fieldSensorCB
static void fieldSensorCB(void *, SoSensor *)
Definition SoInteractionKit.cpp:754
SoInteractionKit::setUpConnections
virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways=FALSE)
Definition SoInteractionKit.cpp:677
SoNode
The SoNode class is the base class for nodes used in scene graphs.
Definition SoNode.h:56
SoSFVec3f
The SoSFVec3f class is a container for an SbVec3f vector.
Definition SoSFVec3f.h:40
SoSensor
The SoSensor class is the abstract base class for all sensors.
Definition SoSensor.h:43
SoTabPlaneDragger::getXYScreenLengths
void getXYScreenLengths(SbVec2f &lengths, const SbMatrix &localtoscreen, const SbVec2s &winsize)
Definition SoTabPlaneDragger.cpp:508
SoTabPlaneDragger::adjustScaleTabSize
void adjustScaleTabSize(void)
Definition SoTabPlaneDragger.cpp:401
SoTabPlaneDragger::dragStart
void dragStart(void)
Definition SoTabPlaneDragger.cpp:522
SoTabPlaneDragger::translation
SoSFVec3f translation
Definition SoTabPlaneDragger.h:73
SoTabPlaneDragger::scaleFactor
SoSFVec3f scaleFactor
Definition SoTabPlaneDragger.h:74
SoTabPlaneDragger::drag
void drag(void)
Definition SoTabPlaneDragger.cpp:588
SoTabPlaneDragger::reallyAdjustScaleTabSize
void reallyAdjustScaleTabSize(SoGLRenderAction *action)
Definition SoTabPlaneDragger.cpp:412
SoTabPlaneDragger::dragFinish
void dragFinish(void)
Definition SoTabPlaneDragger.cpp:692
SoTabPlaneDragger::SoTabPlaneDragger
SoTabPlaneDragger(void)
Definition SoTabPlaneDragger.cpp:221