TuttleOFX  1
TuttleOFX/libraries/tuttle/src/tuttle/plugin/interact/SelectionManipulator.hpp
Go to the documentation of this file.
00001 #ifndef _TUTTLE_PLUGIN_INTERACT_SELECTIONMANIPULATOR_HPP_
00002 #define _TUTTLE_PLUGIN_INTERACT_SELECTIONMANIPULATOR_HPP_
00003 
00004 #include "InteractObject.hpp"
00005 #include "InteractInfos.hpp"
00006 
00007 namespace tuttle {
00008 namespace plugin {
00009 namespace interact {
00010 
00011 class SelectionManipulator : public InteractObject
00012 {
00013 public:
00014         SelectionManipulator( const InteractInfos& infos );
00015         virtual ~SelectionManipulator();
00016 
00017         MotionType intersect( const OFX::PenArgs& args )
00018         {
00019                 const Point2 mouse = ofxToGil( args.penPosition );
00020                 const Point2 p = _selectionPos;
00021 
00022                 const double margeCanonical = getMarge() * args.pixelScale.x;
00023                 MotionType m;
00024                 m._mode = eMotionTranslate;
00025                 m._axis = clicPoint( p, mouse, margeCanonical );
00026                 return m;
00027         }
00028 
00029         double getMarge() const { return _infos._marge * _infos._projectSize.x; }
00030         
00031         Point2 getDistance( const Point2& p ) const { return Point2(0.0, 0.0); }
00032 
00033         void setPosition( const Point2& p )
00034         {
00035                 _selectionPos = p;
00036         }
00037         void setPositionX( const Scalar x )
00038         {
00039                 _selectionPos.x = x;
00040                 _selectionPos.y = getPosition().y;
00041         }
00042         void setPositionY( const Scalar y )
00043         {
00044                 _selectionPos.x = getPosition().x;
00045                 _selectionPos.y = y;
00046         }
00047 
00048         void beginMove( const Point2& penPosition )
00049         {
00050         }
00051         void endMove( const Point2& penPosition )
00052         {
00053         }
00054 
00055 protected:
00056         const InteractInfos& _infos;
00057 private:
00058         Point2 _selectionPos;
00059 };
00060 
00061 }
00062 }
00063 }
00064 
00065 #endif
00066