Completed refactor of osgManipulator, key changes are:

Selection is now just a typedef of osg::MatrixTransform, and is deprecated

   CommandManager is shell class that just sets values directly on Dragger, and is deprecated

   Dragger now has list of DraggerCallback that takes over the roll of tracking changes to the Dragger, and
   allows users to track the dragger in any way they wish.

   Dragger now has a convinience method making MatrixTransforms track a dragger.

   Selection and CommandManager are no longer required for use of osgManipulator and are kept around for backwards compatibility.
This commit is contained in:
Robert Osfield
2009-07-01 14:01:09 +00:00
parent 4e305cf46b
commit 2525bb5d06
16 changed files with 476 additions and 414 deletions

View File

@@ -20,71 +20,8 @@
namespace osgManipulator {
class MotionCommand;
class TranslateInLineCommand;
class TranslateInPlaneCommand;
class Scale1DCommand;
class Scale2DCommand;
class ScaleUniformCommand;
class Rotate3DCommand;
/** Computes the nodepath from the given node all the way upto the root. */
extern OSGMANIPULATOR_EXPORT void computeNodePathToRoot(osg::Node& node, osg::NodePath& np);
#define META_OSGMANIPULATOR_Object(library,name) \
virtual bool isSameKindAs(const osg::Object* obj) const { return dynamic_cast<const name *>(obj)!=NULL; } \
virtual const char* libraryName() const { return #library; }\
virtual const char* className() const { return #name; }
class CommandProcessor
{
public:
virtual bool receive(const MotionCommand&) = 0;
virtual bool receive(const TranslateInLineCommand& command) = 0;
virtual bool receive(const TranslateInPlaneCommand& command) = 0;
virtual bool receive(const Scale1DCommand& command) = 0;
virtual bool receive(const Scale2DCommand& command) = 0;
virtual bool receive(const ScaleUniformCommand& command) = 0;
virtual bool receive(const Rotate3DCommand& command) = 0;
};
/**
* Selection listens to motion commands generated by draggers.
*/
class OSGMANIPULATOR_EXPORT Selection : public osg::MatrixTransform
{
public:
Selection();
META_OSGMANIPULATOR_Object(osgManipulator,Selection)
/**
* Receive motion commands and set the MatrixTransform accordingly to
* transform selections. Returns true on success.
*/
virtual bool receive(const MotionCommand&);
virtual bool receive(const TranslateInLineCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const TranslateInPlaneCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const Scale1DCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const Scale2DCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const ScaleUniformCommand& command) { return receive((MotionCommand&)command); }
virtual bool receive(const Rotate3DCommand& command) { return receive((MotionCommand&)command); }
protected:
virtual ~Selection();
osg::Matrix _startMotionMatrix;
osg::Matrix _localToWorld;
osg::Matrix _worldToLocal;
};
typedef osg::MatrixTransform Selection;
}