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 Color & | getColor () 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 Object * | getParentPtr () 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 () |
Widget for visualizing the direction.
| using MR::DirectionWidget::OnDirectionChangedCallback = std::function<void( const Vector3f&, bool )> |
This callback is invoked every time when the direction is changed by mouse.
| 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
| worldDir | initial direction, in world space |
| worldBase | initial base of the arrow, in world space |
| worldLength | length of the arrow, in world space |
| onDirectionChanged | callback for the direction change |
| parent | parent object for the widget, nullptr means scene root |
| 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
| parent | parent object for the widget, nullptr means scene root |
| MRVIEWER_API Arrow MR::DirectionWidget::getArrow | ( | ) | const |
Returns the arrow's properties, in world space.
| MRVIEWER_API Vector3f MR::DirectionWidget::getBase | ( | ) | const |
Returns the base of the widget, in world space.
| MRVIEWER_API const Color & MR::DirectionWidget::getColor | ( | ) | const |
Returns the color of the widget.
| MRVIEWER_API Vector3f MR::DirectionWidget::getDirection | ( | ) | const |
Returns the direction of the widget, in world space.
| MRVIEWER_API float MR::DirectionWidget::getLength | ( | ) | const |
Returns the length of the arrow in world space.
| MRVIEWER_API Arrow MR::DirectionWidget::getLocalArrow | ( | ) | const |
Returns the arrow's properties in parent's space.
| MRVIEWER_API Vector3f MR::DirectionWidget::getLocalBase | ( | ) | const |
Returns the base of the widget in parent's space.
| MRVIEWER_API Vector3f MR::DirectionWidget::getLocalDirection | ( | ) | const |
Returns the direction of the widget in parent's space.
| MRVIEWER_API float MR::DirectionWidget::getLocalLength | ( | ) | const |
Returns the length of the arrow in parent's space.
| MRVIEWER_API Object * MR::DirectionWidget::getParentPtr | ( | ) | const |
|
inline |
Block or allow mouse editing (allowed by default)
| MRVIEWER_API bool MR::DirectionWidget::isVisible | ( | ) | const |
|
inline |
Returns internal data model object of this widget.
| MRVIEWER_API void MR::DirectionWidget::reset | ( | ) |
Removes the widget from the scene unsubscribes from viewer events
| MRVIEWER_API void MR::DirectionWidget::setColor | ( | const Color & | color | ) |
Sets the color of the widget.
|
inline |
| MRVIEWER_API void MR::DirectionWidget::setOnDirectionChangedCallback | ( | OnDirectionChangedCallback | cb | ) |
Manually set callback function.
| MRVIEWER_API void MR::DirectionWidget::setVisible | ( | bool | visible | ) |
Sets the visibility of the widget.
| MRVIEWER_API void MR::DirectionWidget::updateArrow | ( | const Arrow & | arrow | ) |
Updates the arrow, in world space.
| MRVIEWER_API void MR::DirectionWidget::updateBase | ( | const Vector3f & | base | ) |
Updates the base of the arrow, in world space.
| MRVIEWER_API void MR::DirectionWidget::updateDirection | ( | const Vector3f & | dir | ) |
Updates the direction of the arrow, in world space.
| MRVIEWER_API void MR::DirectionWidget::updateLength | ( | float | length | ) |
Updates the length of the arrow, in world space.
| MRVIEWER_API void MR::DirectionWidget::updateLocalArrow | ( | const Arrow & | arrow | ) |
Updates the arrow in parent's space.
| MRVIEWER_API void MR::DirectionWidget::updateLocalBase | ( | const Vector3f & | base | ) |
Updates the base of the arrow in parent's space.
| MRVIEWER_API void MR::DirectionWidget::updateLocalDirection | ( | const Vector3f & | dir | ) |
Updates the direction of the arrow in parent's space.
| MRVIEWER_API void MR::DirectionWidget::updateLocalLength | ( | float | length | ) |
Updates the length of the arrow in parent's space.