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

#include <MRSurfacePointPicker.h>

+ Inheritance diagram for MR::SurfacePointWidget:

Classes

struct  Parameters
 

Public Types

enum class  PositionType {
  Faces , FaceCenters , Edges , EdgeCenters ,
  Verts
}
 

Public Member Functions

MRVIEWER_API ~SurfacePointWidget ()
 
MRVIEWER_API const PickedPointcreate (const std::shared_ptr< VisualObject > &surface, const PointOnObject &startPos)
 
MRVIEWER_API const PickedPointcreate (const std::shared_ptr< VisualObject > &surface, const PickedPoint &startPos)
 
MRVIEWER_API void reset ()
 
const std::shared_ptr< SphereObject > & getPickSphere () const
 
const ParametersgetParameters () const
 
MRVIEWER_API void setParameters (const Parameters &params)
 
MRVIEWER_API void setBaseColor (const Color &color)
 
MRVIEWER_API void updateParameters (const std::function< void(Parameters &)> &visitor)
 
bool getAutoHover () const
 
void setAutoHover (bool on)
 
MRVIEWER_API void setHovered (bool on)
 
const PickedPointgetCurrentPosition () const
 
MRVIEWER_API Vector3f getCoords () const
 return local object's coordinates at the current position where the center of sphere is located
 
Vector3f toVector3f () const
 
std::optional< Vector3f > findCoords () const
 return local object's coordinates at the current position, or std::nullopt if it is invalid
 
std::optional< Vector3f > findNormal () const
 return the normal in local object's coordinates at the current position, or std::nullopt if it is invalid or normal is not defined
 
MeshTriPoint getCurrentPositionMeshTriPoint () const
 returns stored position as MeshTriPoint, otherwise returns invalid (default) MeshTriPoint
 
MRVIEWER_API void setCurrentPosition (const PointOnObject &pos)
 sets new position for the widget
 
MRVIEWER_API void setCurrentPosition (const PickedPoint &pos)
 sets new position for the widget
 
MRVIEWER_API void swapCurrentPosition (PickedPoint &pos)
 sets new position for the widget and returns previous position in the argument
 
void setCanMoveCallback (std::function< bool(SurfacePointWidget &, const PickedPoint &)> canMove)
 
void setStartMoveCallback (std::function< void(SurfacePointWidget &, const PickedPoint &)> startMove)
 
void setOnMoveCallback (std::function< void(SurfacePointWidget &, const PickedPoint &)> onMove)
 
void setEndMoveCallback (std::function< void(SurfacePointWidget &, const PickedPoint &)> endMove)
 
std::shared_ptr< VisualObject > & getBaseSurface ()
 
bool isOnMove () const
 
bool startDragging ()
 
- Public Member Functions inherited from MR::MultiListener< PreDrawListener, 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 ()
 

Static Public Member Functions

static bool isPickIntoBackFace (const std::shared_ptr< MR::VisualObject > &obj, const MR::PointOnObject &pick, const Vector3f &cameraEye)
 

Member Enumeration Documentation

◆ PositionType

Enumerator
Faces 
FaceCenters 
Edges 
EdgeCenters 
Verts 

Constructor & Destructor Documentation

◆ ~SurfacePointWidget()

MRVIEWER_API MR::SurfacePointWidget::~SurfacePointWidget ( )

Member Function Documentation

◆ create() [1/2]

MRVIEWER_API const PickedPoint & MR::SurfacePointWidget::create ( const std::shared_ptr< VisualObject > & surface,
const PickedPoint & startPos )

◆ create() [2/2]

MRVIEWER_API const PickedPoint & MR::SurfacePointWidget::create ( const std::shared_ptr< VisualObject > & surface,
const PointOnObject & startPos )

◆ findCoords()

std::optional< Vector3f > MR::SurfacePointWidget::findCoords ( ) const
inline

return local object's coordinates at the current position, or std::nullopt if it is invalid

◆ findNormal()

std::optional< Vector3f > MR::SurfacePointWidget::findNormal ( ) const
inline

return the normal in local object's coordinates at the current position, or std::nullopt if it is invalid or normal is not defined

◆ getAutoHover()

bool MR::SurfacePointWidget::getAutoHover ( ) const
inline

◆ getBaseSurface()

std::shared_ptr< VisualObject > & MR::SurfacePointWidget::getBaseSurface ( )
inline

◆ getCoords()

MRVIEWER_API Vector3f MR::SurfacePointWidget::getCoords ( ) const

return local object's coordinates at the current position where the center of sphere is located

◆ getCurrentPosition()

const PickedPoint & MR::SurfacePointWidget::getCurrentPosition ( ) const
inline

◆ getCurrentPositionMeshTriPoint()

MeshTriPoint MR::SurfacePointWidget::getCurrentPositionMeshTriPoint ( ) const
inline

returns stored position as MeshTriPoint, otherwise returns invalid (default) MeshTriPoint

◆ getParameters()

const Parameters & MR::SurfacePointWidget::getParameters ( ) const
inline

◆ getPickSphere()

const std::shared_ptr< SphereObject > & MR::SurfacePointWidget::getPickSphere ( ) const
inline

◆ isOnMove()

bool MR::SurfacePointWidget::isOnMove ( ) const
inlinenodiscard

◆ isPickIntoBackFace()

static bool MR::SurfacePointWidget::isPickIntoBackFace ( const std::shared_ptr< MR::VisualObject > & obj,
const MR::PointOnObject & pick,
const Vector3f & cameraEye )
staticnodiscard

◆ reset()

MRVIEWER_API void MR::SurfacePointWidget::reset ( )

◆ setAutoHover()

void MR::SurfacePointWidget::setAutoHover ( bool on)
inline

◆ setBaseColor()

MRVIEWER_API void MR::SurfacePointWidget::setBaseColor ( const Color & color)

◆ setCanMoveCallback()

void MR::SurfacePointWidget::setCanMoveCallback ( std::function< bool(SurfacePointWidget &, const PickedPoint &)> canMove)
inline

◆ setCurrentPosition() [1/2]

MRVIEWER_API void MR::SurfacePointWidget::setCurrentPosition ( const PickedPoint & pos)

sets new position for the widget

◆ setCurrentPosition() [2/2]

MRVIEWER_API void MR::SurfacePointWidget::setCurrentPosition ( const PointOnObject & pos)

sets new position for the widget

◆ setEndMoveCallback()

void MR::SurfacePointWidget::setEndMoveCallback ( std::function< void(SurfacePointWidget &, const PickedPoint &)> endMove)
inline

◆ setHovered()

MRVIEWER_API void MR::SurfacePointWidget::setHovered ( bool on)

◆ setOnMoveCallback()

void MR::SurfacePointWidget::setOnMoveCallback ( std::function< void(SurfacePointWidget &, const PickedPoint &)> onMove)
inline

◆ setParameters()

MRVIEWER_API void MR::SurfacePointWidget::setParameters ( const Parameters & params)

◆ setStartMoveCallback()

void MR::SurfacePointWidget::setStartMoveCallback ( std::function< void(SurfacePointWidget &, const PickedPoint &)> startMove)
inline

◆ startDragging()

bool MR::SurfacePointWidget::startDragging ( )

activates dragging of this widget; this method is called automatically on mouse down, but it can also be called manually, please be sure that mouse is over this widget and is down may return false if moving is forbidden by callback

◆ swapCurrentPosition()

MRVIEWER_API void MR::SurfacePointWidget::swapCurrentPosition ( PickedPoint & pos)

sets new position for the widget and returns previous position in the argument

◆ toVector3f()

Vector3f MR::SurfacePointWidget::toVector3f ( ) const
inline

◆ updateParameters()

MRVIEWER_API void MR::SurfacePointWidget::updateParameters ( const std::function< void(Parameters &)> & visitor)

Update the widget parameters.

Parameters
visitor- the function that takes the widget parameters and modifies them. Then the parameters are applied by setParameters.

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