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

#include <MRPickPointManager.h>

+ Inheritance diagram for MR::PickPointManager:

Classes

struct  ObjectState
 
struct  Params
 
struct  WidgetHistoryAction
 A common base class for all history actions of this widget. More...
 

Public Types

using PickerPointCallBack = std::function<void( std::shared_ptr<VisualObject> obj, int index )>
 
using AllowCallBack = std::function<bool( const std::shared_ptr<VisualObject>& obj, int index )>
 
using SurfaceContour = std::vector<std::shared_ptr<SurfacePointWidget>>
 
using SurfaceContours = std::unordered_map <std::shared_ptr<VisualObject>, SurfaceContour>
 
using FullState = std::vector<ObjectState>
 

Public Member Functions

MRVIEWER_API PickPointManager ()
 create an object and starts listening for mouse events
 
MRVIEWER_API ~PickPointManager ()
 destroy this and remove the undo/redo actions referring this from the history.
 
const SurfaceContourgetSurfaceContour (const std::shared_ptr< VisualObject > &obj)
 return contour for specific object (creating new one if necessary)
 
const SurfaceContoursgetSurfaceContours () const
 return all contours, i.e. per object unorderd_map of ordered surface points [vector].
 
MRVIEWER_API bool isClosedCountour (const std::shared_ptr< VisualObject > &obj) const
 check whether the contour is closed for a particular object.
 
MRVIEWER_API size_t numPickPoints (const std::shared_ptr< VisualObject > &obj) const
 returns the total number of pick points (including extra point if the contour is closed) on given object
 
MRVIEWER_API std::shared_ptr< SurfacePointWidgetgetPointWidget (const std::shared_ptr< VisualObject > &obj, int index) const
 returns point widget by index from given object or nullptr if no such widget exists
 
MRVIEWER_API int getPointIndex (const std::shared_ptr< VisualObject > &obj, SurfacePointWidget &pointWidget) const
 returns index of given point widget on given object or -1 if this widget is not from given object
 
SurfacePointWidgetdraggedPointWidget () const
 returns point widget currently dragged by mouse
 
MRVIEWER_API bool appendPoint (const std::shared_ptr< VisualObject > &obj, const PickedPoint &triPoint, bool startDragging=false)
 
MRVIEWER_API bool insertPoint (const std::shared_ptr< VisualObject > &obj, int index, const PickedPoint &triPoint, bool startDragging=false)
 
MRVIEWER_API bool removePoint (const std::shared_ptr< VisualObject > &obj, int pickedIndex)
 Remove point with pickedIndex index from contour connected with obj.
 
MRVIEWER_API bool closeContour (const std::shared_ptr< VisualObject > &obj, bool makeClosed=true)
 
MRVIEWER_API FullState getFullState () const
 returns the state of this
 
MRVIEWER_API void clear ()
 removes all points from all objects
 
MRVIEWER_API void setFullState (FullState s)
 removes all current points, then adds pick points on all objects as prescribed by given state
 
- Public Member Functions inherited from MR::MultiListener< MouseDownListener, MouseMoveListener >
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 ()
 

Public Attributes

Params params
 

Detailed Description

PickPointManager allows the user to pick/move/delete several ordered points on one or more visual objects; mouse events and public methods automatically add history actions for reverting (if enabled)

Member Typedef Documentation

◆ AllowCallBack

using MR::PickPointManager::AllowCallBack = std::function<bool( const std::shared_ptr<VisualObject>& obj, int index )>

◆ FullState

◆ PickerPointCallBack

using MR::PickPointManager::PickerPointCallBack = std::function<void( std::shared_ptr<VisualObject> obj, int index )>

◆ SurfaceContour

using MR::PickPointManager::SurfaceContour = std::vector<std::shared_ptr<SurfacePointWidget>>

◆ SurfaceContours

using MR::PickPointManager::SurfaceContours = std::unordered_map <std::shared_ptr<VisualObject>, SurfaceContour>

Constructor & Destructor Documentation

◆ PickPointManager()

MRVIEWER_API MR::PickPointManager::PickPointManager ( )

create an object and starts listening for mouse events

◆ ~PickPointManager()

MRVIEWER_API MR::PickPointManager::~PickPointManager ( )

destroy this and remove the undo/redo actions referring this from the history.

Member Function Documentation

◆ appendPoint()

MRVIEWER_API bool MR::PickPointManager::appendPoint ( const std::shared_ptr< VisualObject > & obj,
const PickedPoint & triPoint,
bool startDragging = false )

Add a point to the end of non closed contour connected with obj

Parameters
startDraggingif true then new point widget is immediately made draggable by mouse, please be sure that mouse is over new point and is down

◆ clear()

MRVIEWER_API void MR::PickPointManager::clear ( )

removes all points from all objects

◆ closeContour()

MRVIEWER_API bool MR::PickPointManager::closeContour ( const std::shared_ptr< VisualObject > & obj,
bool makeClosed = true )

◆ draggedPointWidget()

SurfacePointWidget * MR::PickPointManager::draggedPointWidget ( ) const
inlinenodiscard

returns point widget currently dragged by mouse

◆ getFullState()

MRVIEWER_API FullState MR::PickPointManager::getFullState ( ) const

returns the state of this

◆ getPointIndex()

MRVIEWER_API int MR::PickPointManager::getPointIndex ( const std::shared_ptr< VisualObject > & obj,
SurfacePointWidget & pointWidget ) const
nodiscard

returns index of given point widget on given object or -1 if this widget is not from given object

◆ getPointWidget()

MRVIEWER_API std::shared_ptr< SurfacePointWidget > MR::PickPointManager::getPointWidget ( const std::shared_ptr< VisualObject > & obj,
int index ) const
nodiscard

returns point widget by index from given object or nullptr if no such widget exists

◆ getSurfaceContour()

const SurfaceContour & MR::PickPointManager::getSurfaceContour ( const std::shared_ptr< VisualObject > & obj)
inlinenodiscard

return contour for specific object (creating new one if necessary)

◆ getSurfaceContours()

const SurfaceContours & MR::PickPointManager::getSurfaceContours ( ) const
inlinenodiscard

return all contours, i.e. per object unorderd_map of ordered surface points [vector].

◆ insertPoint()

MRVIEWER_API bool MR::PickPointManager::insertPoint ( const std::shared_ptr< VisualObject > & obj,
int index,
const PickedPoint & triPoint,
bool startDragging = false )

Inserts a point into contour connected with obj

Parameters
indexpoint index before which to insert new point
startDraggingif true then new point widget is immediately made draggable by mouse, please be sure that mouse is over new point and is down

◆ isClosedCountour()

MRVIEWER_API bool MR::PickPointManager::isClosedCountour ( const std::shared_ptr< VisualObject > & obj) const
nodiscard

check whether the contour is closed for a particular object.

◆ numPickPoints()

MRVIEWER_API size_t MR::PickPointManager::numPickPoints ( const std::shared_ptr< VisualObject > & obj) const
nodiscard

returns the total number of pick points (including extra point if the contour is closed) on given object

◆ removePoint()

MRVIEWER_API bool MR::PickPointManager::removePoint ( const std::shared_ptr< VisualObject > & obj,
int pickedIndex )

Remove point with pickedIndex index from contour connected with obj.

◆ setFullState()

MRVIEWER_API void MR::PickPointManager::setFullState ( FullState s)

removes all current points, then adds pick points on all objects as prescribed by given state

Member Data Documentation

◆ params

Params MR::PickPointManager::params

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