SOFA API  1c8b807d
Open source framework for multi-physics simuation
sofa::gui::common::PickHandler Class Reference

#include <PickHandler.h>

Inheritance diagram for sofa::gui::common::PickHandler:

Protected Attributes

bool interactorInUse
 
MOUSE_STATUS mouseStatus
 
MOUSE_BUTTON mouseButton
 
sofa::simulation::NodeSPtr mouseNode
 
MouseContainer::SPtr mouseContainer
 
sofa::core::sptr< MouseCollisionModelmouseCollision
 
MousePosition mousePosition
 
ComponentMouseInteractioninteraction
 
std::vector< ComponentMouseInteraction * > instanceComponents
 
BodyPicked lastPicked
 
bool useCollisions
 
type::fixed_array< Operation *, NONEoperations
 
type::vector< CallBackPicker * > callbacks
 
CallBackRenderrenderCallback
 
PickingMethod pickingMethod
 
double m_defaultLength
 Default length of the ray. Set by constructor. More...
 

Public Member Functions

 PickHandler (double defaultLength=1000000)
 
virtual ~PickHandler ()
 
void activateRay (int width, int height, core::objectmodel::BaseNode *root)
 
void deactivateRay ()
 
virtual void allocateSelectionBuffer (int width, int height)
 
virtual void destroySelectionBuffer ()
 
void setPickingMethod (PickingMethod method)
 
bool useSelectionBufferMethod () const
 
void updateRay (const sofa::type::Vec3 &position, const sofa::type::Vec3 &orientation)
 
void handleMouseEvent (MOUSE_STATUS status, MOUSE_BUTTON button)
 
void init (core::objectmodel::BaseNode *root)
 
void reset ()
 
void unload ()
 
void setColourRenderCallback (CallBackRender *colourRender)
 
void updateMouse2D (MousePosition mouse)
 
OperationgetOperation (MOUSE_BUTTON button)
 
OperationchangeOperation (sofa::component::setting::MouseButtonSetting *setting)
 
OperationchangeOperation (MOUSE_BUTTON button, const std::string &op)
 
void addCallBack (CallBackPicker *c)
 
type::vector< CallBackPicker * > getCallBackPicker ()
 
void clearCallBacks ()
 
virtual BodyPicked findCollisionUsingColourCoding (const type::Vec3 &origin, const type::Vec3 &direction)
 
ComponentMouseInteractiongetInteraction ()
 
BodyPickedgetLastPicked ()
 

Static Public Member Functions

static BodyPicked findCollisionUsingBruteForce (const type::Vec3 &origin, const type::Vec3 &direction, double maxLength, core::objectmodel::BaseNode *root)
 

Protected Member Functions

virtual BodyPicked findCollision ()
 
BodyPicked findCollisionUsingPipeline ()
 
BodyPicked findCollisionUsingBruteForce ()
 
BodyPicked findCollisionUsingColourCoding ()
 
bool needToCastRay ()
 
void setCompatibleInteractor ()
 

Attribute details

◆ callbacks

type::vector< CallBackPicker* > sofa::gui::common::PickHandler::callbacks
protected

◆ instanceComponents

std::vector< ComponentMouseInteraction *> sofa::gui::common::PickHandler::instanceComponents
protected

◆ interaction

ComponentMouseInteraction* sofa::gui::common::PickHandler::interaction
protected

◆ interactorInUse

bool sofa::gui::common::PickHandler::interactorInUse
protected

◆ lastPicked

BodyPicked sofa::gui::common::PickHandler::lastPicked
protected

◆ m_defaultLength

double sofa::gui::common::PickHandler::m_defaultLength
protected

Default length of the ray. Set by constructor.

◆ mouseButton

MOUSE_BUTTON sofa::gui::common::PickHandler::mouseButton
protected

◆ mouseCollision

sofa::core::sptr<MouseCollisionModel> sofa::gui::common::PickHandler::mouseCollision
protected

◆ mouseContainer

MouseContainer::SPtr sofa::gui::common::PickHandler::mouseContainer
protected

◆ mouseNode

sofa::simulation::NodeSPtr sofa::gui::common::PickHandler::mouseNode
protected

◆ mousePosition

MousePosition sofa::gui::common::PickHandler::mousePosition
protected

◆ mouseStatus

MOUSE_STATUS sofa::gui::common::PickHandler::mouseStatus
protected

◆ operations

type::fixed_array< Operation*,NONE > sofa::gui::common::PickHandler::operations
protected

◆ pickingMethod

PickingMethod sofa::gui::common::PickHandler::pickingMethod
protected

◆ renderCallback

CallBackRender* sofa::gui::common::PickHandler::renderCallback
protected

◆ useCollisions

bool sofa::gui::common::PickHandler::useCollisions
protected

Constructor details

◆ PickHandler()

sofa::gui::common::PickHandler::PickHandler ( double  defaultLength = 1000000)

◆ ~PickHandler()

sofa::gui::common::PickHandler::~PickHandler ( )
virtual

Function details

◆ activateRay()

void sofa::gui::common::PickHandler::activateRay ( int  width,
int  height,
core::objectmodel::BaseNode root 
)

◆ addCallBack()

void sofa::gui::common::PickHandler::addCallBack ( CallBackPicker c)
inline

◆ allocateSelectionBuffer()

void sofa::gui::common::PickHandler::allocateSelectionBuffer ( int  width,
int  height 
)
virtual

Reimplemented in sofa::gui::qt::GLPickHandler.

◆ changeOperation() [1/2]

Operation * sofa::gui::common::PickHandler::changeOperation ( MOUSE_BUTTON  button,
const std::string &  op 
)

◆ changeOperation() [2/2]

Operation * sofa::gui::common::PickHandler::changeOperation ( sofa::component::setting::MouseButtonSetting setting)

◆ clearCallBacks()

void sofa::gui::common::PickHandler::clearCallBacks ( )
inline

◆ deactivateRay()

void sofa::gui::common::PickHandler::deactivateRay ( )

◆ destroySelectionBuffer()

void sofa::gui::common::PickHandler::destroySelectionBuffer ( )
virtual

Reimplemented in sofa::gui::qt::GLPickHandler.

◆ findCollision()

BodyPicked sofa::gui::common::PickHandler::findCollision ( )
protectedvirtual

◆ findCollisionUsingBruteForce() [1/2]

BodyPicked sofa::gui::common::PickHandler::findCollisionUsingBruteForce ( )
protected

◆ findCollisionUsingBruteForce() [2/2]

BodyPicked sofa::gui::common::PickHandler::findCollisionUsingBruteForce ( const type::Vec3 origin,
const type::Vec3 direction,
double  maxLength,
core::objectmodel::BaseNode root 
)
static

◆ findCollisionUsingColourCoding() [1/2]

BodyPicked sofa::gui::common::PickHandler::findCollisionUsingColourCoding ( )
protected

◆ findCollisionUsingColourCoding() [2/2]

BodyPicked sofa::gui::common::PickHandler::findCollisionUsingColourCoding ( const type::Vec3 origin,
const type::Vec3 direction 
)
virtual

Reimplemented in sofa::gui::qt::GLPickHandler.

◆ findCollisionUsingPipeline()

BodyPicked sofa::gui::common::PickHandler::findCollisionUsingPipeline ( )
protected

◆ getCallBackPicker()

type::vector< CallBackPicker* > sofa::gui::common::PickHandler::getCallBackPicker ( )
inline

◆ getInteraction()

ComponentMouseInteraction * sofa::gui::common::PickHandler::getInteraction ( )

◆ getLastPicked()

BodyPicked* sofa::gui::common::PickHandler::getLastPicked ( )
inline

◆ getOperation()

Operation* sofa::gui::common::PickHandler::getOperation ( MOUSE_BUTTON  button)
inline

◆ handleMouseEvent()

void sofa::gui::common::PickHandler::handleMouseEvent ( MOUSE_STATUS  status,
MOUSE_BUTTON  button 
)

◆ init()

void sofa::gui::common::PickHandler::init ( core::objectmodel::BaseNode root)

◆ needToCastRay()

bool sofa::gui::common::PickHandler::needToCastRay ( )
protected

◆ reset()

void sofa::gui::common::PickHandler::reset ( void  )

◆ setColourRenderCallback()

void sofa::gui::common::PickHandler::setColourRenderCallback ( CallBackRender colourRender)
inline

◆ setCompatibleInteractor()

void sofa::gui::common::PickHandler::setCompatibleInteractor ( )
protected

◆ setPickingMethod()

void sofa::gui::common::PickHandler::setPickingMethod ( PickingMethod  method)
inline

◆ unload()

void sofa::gui::common::PickHandler::unload ( void  )

◆ updateMouse2D()

void sofa::gui::common::PickHandler::updateMouse2D ( MousePosition  mouse)
inline

◆ updateRay()

void sofa::gui::common::PickHandler::updateRay ( const sofa::type::Vec3 position,
const sofa::type::Vec3 orientation 
)

◆ useSelectionBufferMethod()

bool sofa::gui::common::PickHandler::useSelectionBufferMethod ( ) const
inline

Enum details

◆ PickingMethod

Enumerator
RAY_CASTING 
SELECTION_BUFFER