Scale2DDragger
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
//osgManipulator - Copyright (C) 2007 Fugro-Jason B.V.
#ifndef OSGMANIPULATOR_SCALE2DDRAGGER
#define OSGMANIPULATOR_SCALE2DDRAGGER 1
#include <osgManipulator/Dragger>
#include <osgManipulator/Projector>
namespace osgManipulator {
class OSGMANIPULATOR_EXPORT Scale2DDragger : public Dragger
{
public:
enum ScaleMode
{
SCALE_WITH_ORIGIN_AS_PIVOT = 0,
SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT
};
Scale2DDragger(ScaleMode scaleMode=SCALE_WITH_ORIGIN_AS_PIVOT);
META_OSGMANIPULATOR_Object(osgManipulator,Scale2DDragger)
virtual bool handle(const PointerInfo& pi, const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& us);
void setupDefaultGeometry();
inline void setMinScale(const osg::Vec2d& min) { _minScale = min; }
inline const osg::Vec2d& getMinScale() const { return _minScale; }
inline void setColor(const osg::Vec4& color) { _color = color; setMaterialColor(_color,*this); }
inline const osg::Vec4& getColor() const { return _color; }
inline void setPickColor(const osg::Vec4& color) { _pickColor = color; }
inline const osg::Vec4& getPickColor() const { return _pickColor; }
inline void setTopLeftHandleNode (osg::Node& node) { _topLeftHandleNode = &node; }
inline osg::Node* getTopLeftHandleNode() { return _topLeftHandleNode.get(); }
inline const osg::Node* getTopLeftHandleNode() const { return _topLeftHandleNode.get(); }
inline void setBottomLeftHandleNode (osg::Node& node) { _bottomLeftHandleNode = &node; }
inline osg::Node* getBottomLeftHandleNode() { return _bottomLeftHandleNode.get(); }
inline const osg::Node* getBottomLeftHandleNode() const { return _bottomLeftHandleNode.get(); }
inline void setTopRightHandleNode(osg::Node& node) { _topRightHandleNode = &node; }
inline osg::Node* getTopRightHandleNode() { return _topRightHandleNode.get(); }
inline const osg::Node* getTopRightHandleNode() const { return _topRightHandleNode.get(); }
inline void setBottomRightHandleNode(osg::Node& node) { _bottomRightHandleNode = &node; }
inline osg::Node* getBottomRightHandleNode() { return _bottomRightHandleNode.get(); }
inline const osg::Node* getBottomRightHandleNode() const { return _bottomRightHandleNode.get(); }
inline void setTopLeftHandlePosition(const osg::Vec2d& pos) { _topLeftHandlePosition = pos; }
const osg::Vec2d& getTopLeftHandlePosition() const { return _topLeftHandlePosition; }
inline void setBottomLeftHandlePosition(const osg::Vec2d& pos) { _bottomLeftHandlePosition = pos; }
const osg::Vec2d& getBottomLeftHandlePosition() const { return _bottomLeftHandlePosition; }
inline void setTopRightHandlePosition(const osg::Vec2d& pos) { _topRightHandlePosition = pos; }
const osg::Vec2d& getTopRightHandlePosition() const { return _topRightHandlePosition; }
inline void setBottomRightHandlePosition(const osg::Vec2d& pos){ _bottomRightHandlePosition = pos; }
const osg::Vec2d& getBottomRightHandlePosition() const { return _bottomRightHandlePosition; }
protected:
virtual ~Scale2DDragger();
osg::ref_ptr< PlaneProjector > _projector;
osg::Vec3d _startProjectedPoint;
osg::Vec2d _scaleCenter;
osg::Vec2d _referencePoint;
osg::Vec2d _minScale;
osg::ref_ptr< osg::Node > _topLeftHandleNode;
osg::ref_ptr< osg::Node > _bottomLeftHandleNode;
osg::ref_ptr< osg::Node > _topRightHandleNode;
osg::ref_ptr< osg::Node > _bottomRightHandleNode;
osg::Vec2d _topLeftHandlePosition;
osg::Vec2d _bottomLeftHandlePosition;
osg::Vec2d _topRightHandlePosition;
osg::Vec2d _bottomRightHandlePosition;
osg::Vec4 _color;
osg::Vec4 _pickColor;
ScaleMode _scaleMode;
};
}
#endif
Dragger
Projector
osgManipulator::Dragger::handle
virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
osgManipulator::Dragger::Dragger
Dragger()
osgManipulator::PointerInfo
Definition Dragger:84
osgManipulator::Scale2DDragger::setColor
void setColor(const osg::Vec4 &color)
Definition Scale2DDragger:53
osgManipulator::Scale2DDragger::getBottomLeftHandleNode
const osg::Node * getBottomLeftHandleNode() const
Definition Scale2DDragger:70
osgManipulator::Scale2DDragger::_topLeftHandlePosition
osg::Vec2d _topLeftHandlePosition
Definition Scale2DDragger:103
osgManipulator::Scale2DDragger::getBottomLeftHandlePosition
const osg::Vec2d & getBottomLeftHandlePosition() const
Definition Scale2DDragger:82
osgManipulator::Scale2DDragger::_bottomLeftHandlePosition
osg::Vec2d _bottomLeftHandlePosition
Definition Scale2DDragger:104
osgManipulator::Scale2DDragger::setBottomLeftHandlePosition
void setBottomLeftHandlePosition(const osg::Vec2d &pos)
Definition Scale2DDragger:81
osgManipulator::Scale2DDragger::getPickColor
const osg::Vec4 & getPickColor() const
Definition Scale2DDragger:62
osgManipulator::Scale2DDragger::setMinScale
void setMinScale(const osg::Vec2d &min)
Definition Scale2DDragger:49
osgManipulator::Scale2DDragger::getColor
const osg::Vec4 & getColor() const
Definition Scale2DDragger:54
osgManipulator::Scale2DDragger::getTopLeftHandleNode
osg::Node * getTopLeftHandleNode()
Definition Scale2DDragger:66
osgManipulator::Scale2DDragger::setBottomRightHandlePosition
void setBottomRightHandlePosition(const osg::Vec2d &pos)
Definition Scale2DDragger:85
osgManipulator::Scale2DDragger::_scaleMode
ScaleMode _scaleMode
Definition Scale2DDragger:111
osgManipulator::Scale2DDragger::getTopRightHandleNode
const osg::Node * getTopRightHandleNode() const
Definition Scale2DDragger:73
osgManipulator::Scale2DDragger::_bottomLeftHandleNode
osg::ref_ptr< osg::Node > _bottomLeftHandleNode
Definition Scale2DDragger:99
osgManipulator::Scale2DDragger::_topRightHandleNode
osg::ref_ptr< osg::Node > _topRightHandleNode
Definition Scale2DDragger:100
osgManipulator::Scale2DDragger::setBottomLeftHandleNode
void setBottomLeftHandleNode(osg::Node &node)
Definition Scale2DDragger:68
osgManipulator::Scale2DDragger::setPickColor
void setPickColor(const osg::Vec4 &color)
Definition Scale2DDragger:61
osgManipulator::Scale2DDragger::setTopRightHandlePosition
void setTopRightHandlePosition(const osg::Vec2d &pos)
Definition Scale2DDragger:83
osgManipulator::Scale2DDragger::setupDefaultGeometry
void setupDefaultGeometry()
osgManipulator::Scale2DDragger::META_OSGMANIPULATOR_Object
META_OSGMANIPULATOR_Object(osgManipulator, Scale2DDragger) virtual bool handle(const PointerInfo &pi
osgManipulator::Scale2DDragger::_topLeftHandleNode
osg::ref_ptr< osg::Node > _topLeftHandleNode
Definition Scale2DDragger:98
osgManipulator::Scale2DDragger::_color
osg::Vec4 _color
Definition Scale2DDragger:108
osgManipulator::Scale2DDragger::getBottomRightHandleNode
osg::Node * getBottomRightHandleNode()
Definition Scale2DDragger:75
osgManipulator::Scale2DDragger::setBottomRightHandleNode
void setBottomRightHandleNode(osg::Node &node)
Definition Scale2DDragger:74
osgManipulator::Scale2DDragger::Scale2DDragger
Scale2DDragger(ScaleMode scaleMode=SCALE_WITH_ORIGIN_AS_PIVOT)
osgManipulator::Scale2DDragger::_pickColor
osg::Vec4 _pickColor
Definition Scale2DDragger:109
osgManipulator::Scale2DDragger::_bottomRightHandlePosition
osg::Vec2d _bottomRightHandlePosition
Definition Scale2DDragger:106
osgManipulator::Scale2DDragger::getTopLeftHandleNode
const osg::Node * getTopLeftHandleNode() const
Definition Scale2DDragger:67
osgManipulator::Scale2DDragger::_minScale
osg::Vec2d _minScale
Definition Scale2DDragger:96
osgManipulator::Scale2DDragger::getTopLeftHandlePosition
const osg::Vec2d & getTopLeftHandlePosition() const
Definition Scale2DDragger:80
osgManipulator::Scale2DDragger::getBottomLeftHandleNode
osg::Node * getBottomLeftHandleNode()
Definition Scale2DDragger:69
osgManipulator::Scale2DDragger::ScaleMode
ScaleMode
Definition Scale2DDragger:31
osgManipulator::Scale2DDragger::SCALE_WITH_ORIGIN_AS_PIVOT
@ SCALE_WITH_ORIGIN_AS_PIVOT
Definition Scale2DDragger:32
osgManipulator::Scale2DDragger::SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT
@ SCALE_WITH_OPPOSITE_HANDLE_AS_PIVOT
Definition Scale2DDragger:33
osgManipulator::Scale2DDragger::_bottomRightHandleNode
osg::ref_ptr< osg::Node > _bottomRightHandleNode
Definition Scale2DDragger:101
osgManipulator::Scale2DDragger::_startProjectedPoint
osg::Vec3d _startProjectedPoint
Definition Scale2DDragger:93
osgManipulator::Scale2DDragger::getTopRightHandlePosition
const osg::Vec2d & getTopRightHandlePosition() const
Definition Scale2DDragger:84
osgManipulator::Scale2DDragger::setTopLeftHandleNode
void setTopLeftHandleNode(osg::Node &node)
Definition Scale2DDragger:65
osgManipulator::Scale2DDragger::_topRightHandlePosition
osg::Vec2d _topRightHandlePosition
Definition Scale2DDragger:105
osgManipulator::Scale2DDragger::~Scale2DDragger
virtual ~Scale2DDragger()
osgManipulator::Scale2DDragger::us
const osgGA::GUIEventAdapter osgGA::GUIActionAdapter & us
Definition Scale2DDragger:43
osgManipulator::Scale2DDragger::getBottomRightHandleNode
const osg::Node * getBottomRightHandleNode() const
Definition Scale2DDragger:76
osgManipulator::Scale2DDragger::getBottomRightHandlePosition
const osg::Vec2d & getBottomRightHandlePosition() const
Definition Scale2DDragger:86
osgManipulator::Scale2DDragger::setTopLeftHandlePosition
void setTopLeftHandlePosition(const osg::Vec2d &pos)
Definition Scale2DDragger:79
osgManipulator::Scale2DDragger::getTopRightHandleNode
osg::Node * getTopRightHandleNode()
Definition Scale2DDragger:72
osgManipulator::Scale2DDragger::ea
const osgGA::GUIEventAdapter & ea
Definition Scale2DDragger:43
osgManipulator::Scale2DDragger::_scaleCenter
osg::Vec2d _scaleCenter
Definition Scale2DDragger:94
osgManipulator::Scale2DDragger::getMinScale
const osg::Vec2d & getMinScale() const
Definition Scale2DDragger:50
osgManipulator::Scale2DDragger::_projector
osg::ref_ptr< PlaneProjector > _projector
Definition Scale2DDragger:92
osgManipulator::Scale2DDragger::setTopRightHandleNode
void setTopRightHandleNode(osg::Node &node)
Definition Scale2DDragger:71
osgManipulator::Scale2DDragger::_referencePoint
osg::Vec2d _referencePoint
Definition Scale2DDragger:95
osg::Node
Definition Node:72
osg::Vec2d
Definition Vec2d:29
osg::Vec3d
Definition Vec3d:30
osg::ref_ptr
Definition ref_ptr:32
osgGA
Definition Callback:21
osgManipulator
Definition AntiSquish:23
osgManipulator::setMaterialColor
void OSGMANIPULATOR_EXPORT setMaterialColor(const osg::Vec4 &color, osg::Node &node)
osg
Definition AlphaFunc:19
osg::Vec4
Vec4f Vec4
Definition Vec4:21
OSGMANIPULATOR_EXPORT
#define OSGMANIPULATOR_EXPORT
Definition osgManipulator/Export:27