MeshLib C++ Docs
Loading...
Searching...
No Matches
MR::DirectionWidget Class Reference

Widget for visualizing the direction. More...

#include <MRDirectionWidget.h>

+ Inheritance diagram for MR::DirectionWidget:

Classes

struct  Arrow
 
class  ChangeDirAction
 This history action must be created before the change in widget's direction, base or length to make them undo-able. More...
 
class  ChangeVisibleAction
 history action for changing the visible. It should be added to the history stack by user code More...
 

Public Types

using OnDirectionChangedCallback = std::function<void( const Vector3f&, bool )>
 This callback is invoked every time when the direction is changed by mouse.
 

Public Member Functions

MRVIEWER_API void create (Object *parent=nullptr)
 
MRVIEWER_API void create (const Vector3f &worldDir, const Vector3f &worldBase, float worldLength, OnDirectionChangedCallback onDirectionChanged, Object *parent=nullptr)
 
MRVIEWER_API void reset ()
 
MRVIEWER_API void setOnDirectionChangedCallback (OnDirectionChangedCallback cb)
 Manually set callback function.
 
MRVIEWER_API void updateArrow (const Arrow &arrow)
 Updates the arrow, in world space.
 
MRVIEWER_API void updateLocalArrow (const Arrow &arrow)
 Updates the arrow in parent's space.
 
MRVIEWER_API void updateDirection (const Vector3f &dir)
 Updates the direction of the arrow, in world space.
 
MRVIEWER_API void updateLocalDirection (const Vector3f &dir)
 Updates the direction of the arrow in parent's space.
 
MRVIEWER_API void updateBase (const Vector3f &base)
 Updates the base of the arrow, in world space.
 
MRVIEWER_API void updateLocalBase (const Vector3f &base)
 Updates the base of the arrow in parent's space.
 
MRVIEWER_API void updateLength (float length)
 Updates the length of the arrow, in world space.
 
MRVIEWER_API void updateLocalLength (float length)
 Updates the length of the arrow in parent's space.
 
const std::shared_ptr< ObjectMesh > & obj () const
 Returns internal data model object of this widget.
 
MRVIEWER_API void setVisible (bool visible)
 Sets the visibility of the widget.
 
MRVIEWER_API bool isVisible () const
 
MRVIEWER_API void setColor (const Color &color)
 Sets the color of the widget.
 
MRVIEWER_API const ColorgetColor () const
 Returns the color of the widget.
 
MRVIEWER_API Arrow getArrow () const
 Returns the arrow's properties, in world space.
 
MRVIEWER_API Arrow getLocalArrow () const
 Returns the arrow's properties in parent's space.
 
MRVIEWER_API Vector3f getBase () const
 Returns the base of the widget, in world space.
 
MRVIEWER_API Vector3f getLocalBase () const
 Returns the base of the widget in parent's space.
 
MRVIEWER_API Vector3f getDirection () const
 Returns the direction of the widget, in world space.
 
MRVIEWER_API Vector3f getLocalDirection () const
 Returns the direction of the widget in parent's space.
 
MRVIEWER_API float getLength () const
 Returns the length of the arrow in world space.
 
MRVIEWER_API float getLocalLength () const
 Returns the length of the arrow in parent's space.
 
MRVIEWER_API ObjectgetParentPtr () const
 Returns pointer to parent object, always not-null after create() and before reset()
 
bool isMouseBlocked () const
 Block or allow mouse editing (allowed by default)
 
void setMouseBlocked (bool blocked)
 
- Public Member Functions inherited from MR::MultiListener< MouseDownListener, MouseMoveListener, MouseUpListener >
virtual ~MultiListener ()=default
 
virtual void connect (Viewer *viewer, int group=0, boost::signals2::connect_position pos=boost::signals2::connect_position::at_back)
 
virtual void disconnect ()
 

Detailed Description

Widget for visualizing the direction.

Member Typedef Documentation

◆ OnDirectionChangedCallback

using MR::DirectionWidget::OnDirectionChangedCallback = std::function<void( const Vector3f&, bool )>

This callback is invoked every time when the direction is changed by mouse.

Member Function Documentation

◆ create() [1/2]

MRVIEWER_API void MR::DirectionWidget::create ( const Vector3f & worldDir,
const Vector3f & worldBase,
float worldLength,
OnDirectionChangedCallback onDirectionChanged,
Object * parent = nullptr )

Creates a new widget for visualizing the direction and adds it to scene subscribes to viewer events

Parameters
worldDirinitial direction, in world space
worldBaseinitial base of the arrow, in world space
worldLengthlength of the arrow, in world space
onDirectionChangedcallback for the direction change
parentparent object for the widget, nullptr means scene root

◆ create() [2/2]

MRVIEWER_API void MR::DirectionWidget::create ( Object * parent = nullptr)

Creates a new widget for visualizing the direction and adds it to scene; subscribes to viewer events; intial local direction is (0,0,1), initial local base (0,0,0), the length is 1

Parameters
parentparent object for the widget, nullptr means scene root

◆ getArrow()

MRVIEWER_API Arrow MR::DirectionWidget::getArrow ( ) const

Returns the arrow's properties, in world space.

◆ getBase()

MRVIEWER_API Vector3f MR::DirectionWidget::getBase ( ) const

Returns the base of the widget, in world space.

◆ getColor()

MRVIEWER_API const Color & MR::DirectionWidget::getColor ( ) const

Returns the color of the widget.

◆ getDirection()

MRVIEWER_API Vector3f MR::DirectionWidget::getDirection ( ) const

Returns the direction of the widget, in world space.

◆ getLength()

MRVIEWER_API float MR::DirectionWidget::getLength ( ) const

Returns the length of the arrow in world space.

◆ getLocalArrow()

MRVIEWER_API Arrow MR::DirectionWidget::getLocalArrow ( ) const

Returns the arrow's properties in parent's space.

◆ getLocalBase()

MRVIEWER_API Vector3f MR::DirectionWidget::getLocalBase ( ) const

Returns the base of the widget in parent's space.

◆ getLocalDirection()

MRVIEWER_API Vector3f MR::DirectionWidget::getLocalDirection ( ) const

Returns the direction of the widget in parent's space.

◆ getLocalLength()

MRVIEWER_API float MR::DirectionWidget::getLocalLength ( ) const

Returns the length of the arrow in parent's space.

◆ getParentPtr()

MRVIEWER_API Object * MR::DirectionWidget::getParentPtr ( ) const

Returns pointer to parent object, always not-null after create() and before reset()

◆ isMouseBlocked()

bool MR::DirectionWidget::isMouseBlocked ( ) const
inline

Block or allow mouse editing (allowed by default)

◆ isVisible()

MRVIEWER_API bool MR::DirectionWidget::isVisible ( ) const

◆ obj()

const std::shared_ptr< ObjectMesh > & MR::DirectionWidget::obj ( ) const
inline

Returns internal data model object of this widget.

◆ reset()

MRVIEWER_API void MR::DirectionWidget::reset ( )

Removes the widget from the scene unsubscribes from viewer events

◆ setColor()

MRVIEWER_API void MR::DirectionWidget::setColor ( const Color & color)

Sets the color of the widget.

◆ setMouseBlocked()

void MR::DirectionWidget::setMouseBlocked ( bool blocked)
inline

◆ setOnDirectionChangedCallback()

MRVIEWER_API void MR::DirectionWidget::setOnDirectionChangedCallback ( OnDirectionChangedCallback cb)

Manually set callback function.

◆ setVisible()

MRVIEWER_API void MR::DirectionWidget::setVisible ( bool visible)

Sets the visibility of the widget.

◆ updateArrow()

MRVIEWER_API void MR::DirectionWidget::updateArrow ( const Arrow & arrow)

Updates the arrow, in world space.

◆ updateBase()

MRVIEWER_API void MR::DirectionWidget::updateBase ( const Vector3f & base)

Updates the base of the arrow, in world space.

◆ updateDirection()

MRVIEWER_API void MR::DirectionWidget::updateDirection ( const Vector3f & dir)

Updates the direction of the arrow, in world space.

◆ updateLength()

MRVIEWER_API void MR::DirectionWidget::updateLength ( float length)

Updates the length of the arrow, in world space.

◆ updateLocalArrow()

MRVIEWER_API void MR::DirectionWidget::updateLocalArrow ( const Arrow & arrow)

Updates the arrow in parent's space.

◆ updateLocalBase()

MRVIEWER_API void MR::DirectionWidget::updateLocalBase ( const Vector3f & base)

Updates the base of the arrow in parent's space.

◆ updateLocalDirection()

MRVIEWER_API void MR::DirectionWidget::updateLocalDirection ( const Vector3f & dir)

Updates the direction of the arrow in parent's space.

◆ updateLocalLength()

MRVIEWER_API void MR::DirectionWidget::updateLocalLength ( float length)

Updates the length of the arrow in parent's space.


The documentation for this class was generated from the following file: