OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Scale2DDragger.h
Go to the documentation of this file.
1 /* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2  *
3  * This library is open source and may be redistributed and/or modified under
4  * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5  * (at your option) any later version. The full license is in LICENSE file
6  * included with this distribution, and on the openscenegraph.org website.
7  *
8  * This library is distributed in the hope that it will be useful,
9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  * OpenSceneGraph Public License for more details.
12 */
13 //osgManipulator - Copyright (C) 2007 Fugro-Jason B.V.
14 
15 #ifndef OSGMANIPULATOR_SCALE2DDRAGGER
16 #define OSGMANIPULATOR_SCALE2DDRAGGER 1
17 
18 #include <osgManipulator/Dragger>
19 #include <osgManipulator/Projector>
20 
21 namespace osgManipulator {
22 
27 {
28  public:
29 
30  enum ScaleMode
31  {
32  SCALE_WITH_ORIGIN_AS_PIVOT = 0,
33  SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT
34  };
35 
36  Scale2DDragger(ScaleMode scaleMode=SCALE_WITH_ORIGIN_AS_PIVOT);
37 
39 
40 
43  virtual bool handle(const PointerInfo& pi, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
44 
46  void setupDefaultGeometry();
47 
49  inline void setMinScale(const osg::Vec2d& min) { _minScale = min; }
50  inline const osg::Vec2d& getMinScale() const { return _minScale; }
51 
53  inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
54  inline const osg::Vec4& getColor() const { return _color; }
55 
61  inline void setPickColor(const osg::Vec4& color) { _pickColor = color; }
62  inline const osg::Vec4& getPickColor() const { return _pickColor; }
63 
65  inline void setTopLeftHandleNode (osg::Node& node) { _topLeftHandleNode = &node; }
66  inline osg::Node* getTopLeftHandleNode() { return _topLeftHandleNode.get(); }
67  inline const osg::Node* getTopLeftHandleNode() const { return _topLeftHandleNode.get(); }
68  inline void setBottomLeftHandleNode (osg::Node& node) { _bottomLeftHandleNode = &node; }
69  inline osg::Node* getBottomLeftHandleNode() { return _bottomLeftHandleNode.get(); }
70  inline const osg::Node* getBottomLeftHandleNode() const { return _bottomLeftHandleNode.get(); }
71  inline void setTopRightHandleNode(osg::Node& node) { _topRightHandleNode = &node; }
72  inline osg::Node* getTopRightHandleNode() { return _topRightHandleNode.get(); }
73  inline const osg::Node* getTopRightHandleNode() const { return _topRightHandleNode.get(); }
74  inline void setBottomRightHandleNode(osg::Node& node) { _bottomRightHandleNode = &node; }
75  inline osg::Node* getBottomRightHandleNode() { return _bottomRightHandleNode.get(); }
76  inline const osg::Node* getBottomRightHandleNode() const { return _bottomRightHandleNode.get(); }
77 
79  inline void setTopLeftHandlePosition(const osg::Vec2d& pos) { _topLeftHandlePosition = pos; }
80  const osg::Vec2d& getTopLeftHandlePosition() const { return _topLeftHandlePosition; }
81  inline void setBottomLeftHandlePosition(const osg::Vec2d& pos) { _bottomLeftHandlePosition = pos; }
82  const osg::Vec2d& getBottomLeftHandlePosition() const { return _bottomLeftHandlePosition; }
83  inline void setTopRightHandlePosition(const osg::Vec2d& pos) { _topRightHandlePosition = pos; }
84  const osg::Vec2d& getTopRightHandlePosition() const { return _topRightHandlePosition; }
85  inline void setBottomRightHandlePosition(const osg::Vec2d& pos){ _bottomRightHandlePosition = pos; }
86  const osg::Vec2d& getBottomRightHandlePosition() const { return _bottomRightHandlePosition; }
87 
88  protected:
89 
90  virtual ~Scale2DDragger();
91 
97 
102 
107 
110 
112 };
113 
114 
115 }
116 
117 #endif
void setColor(const osg::Vec4 &color)
void setTopLeftHandlePosition(const osg::Vec2d &pos)
void setBottomLeftHandleNode(osg::Node &node)
const osg::Node * getBottomRightHandleNode() const
osg::Node * getBottomRightHandleNode()
#define OSGMANIPULATOR_EXPORT
Definition: Export.h:27
void setBottomRightHandleNode(osg::Node &node)
const osg::Vec2d & getBottomRightHandlePosition() const
void setBottomLeftHandlePosition(const osg::Vec2d &pos)
const osg::Node * getTopRightHandleNode() const
const osg::Vec4 & getColor() const
#define META_OSGMANIPULATOR_Object(library, name)
Definition: Export.h:30
osg::ref_ptr< osg::Node > _bottomRightHandleNode
void setTopRightHandleNode(osg::Node &node)
const osg::Node * getBottomLeftHandleNode() const
const osg::Vec2d & getTopLeftHandlePosition() const
void OSGMANIPULATOR_EXPORT setMaterialColor(const osg::Vec4 &color, osg::Node &node)
osg::ref_ptr< osg::Node > _topLeftHandleNode
osg::ref_ptr< osg::Node > _bottomLeftHandleNode
const osg::Vec2d & getMinScale() const
const osg::Vec4 & getPickColor() const
osg::ref_ptr< PlaneProjector > _projector
const osg::Node * getTopLeftHandleNode() const
Definition: Node.h:71
Definition: AlphaFunc.h:19
void setTopLeftHandleNode(osg::Node &node)
void setPickColor(const osg::Vec4 &color)
void setTopRightHandlePosition(const osg::Vec2d &pos)
osg::ref_ptr< osg::Node > _topRightHandleNode
const osg::Vec2d & getBottomLeftHandlePosition() const
void setBottomRightHandlePosition(const osg::Vec2d &pos)
const osg::Vec2d & getTopRightHandlePosition() const