5#include "MRMesh/MRMeshFwd.h"
43 Color baseColor{ Color::gray() };
45 Color hoveredColor{ Color::red() };
47 Color activeColor{ { Color::red() } };
55 int customModifiers = 0;
57 bool pickInBackFaceObject =
true;
110 [[deprecated]] Vector3f
toVector3f()
const {
return getCoords(); }
139 canMove_ = std::move( canMove );
144 startMove_ = std::move( startMove );
149 onMove_ = std::move( onMove );
154 endMove_ = std::move( endMove );
163 [[nodiscard]]
bool isOnMove()
const {
return isOnMove_; }
175 MRVIEWER_API
virtual bool onMouseDown_(
MouseButton button,
int modifier )
override;
176 MRVIEWER_API
virtual bool onMouseUp_(
MouseButton button,
int modifier )
override;
177 MRVIEWER_API
virtual bool onMouseMove_(
int mouse_x,
int mouse_y )
override;
179 void updatePositionAndRadius_();
184 bool autoHover_{
true };
185 bool isOnMove_{
false };
186 bool isHovered_{
false };
187 MRVIEWER_API
void preDraw_()
override;
191 std::shared_ptr<SphereObject> pickSphere_;
192 std::shared_ptr<VisualObject> baseObject_;
194 boost::signals2::scoped_connection onBaseObjectWorldXfChanged_;
196 std::function<bool( SurfacePointWidget &,
const PickedPoint& )> canMove_;
197 std::function<void( SurfacePointWidget &,
const PickedPoint& )> startMove_;
198 std::function<void( SurfacePointWidget &,
const PickedPoint& )> onMove_;
199 std::function<void( SurfacePointWidget &,
const PickedPoint& )> endMove_;
202 void setPointRadius_();
205 void setSphereColor_();
void setOnMoveCallback(std::function< void(SurfacePointWidget &, const PickedPoint &)> onMove)
this callback is called on modification if it is set
Definition MRSurfacePointPicker.h:147
const std::shared_ptr< SphereObject > & getPickSphere() const
returns object of control sphere
Definition MRSurfacePointPicker.h:68
std::optional< Vector3f > findNormal() const
return the normal in local object's coordinates at the current position, or std::nullopt if it is inv...
Definition MRSurfacePointPicker.h:116
void setEndMoveCallback(std::function< void(SurfacePointWidget &, const PickedPoint &)> endMove)
this callback is called when modification ends if it is set
Definition MRSurfacePointPicker.h:152
MouseButton
Definition MRMouse.h:12
Faces
Definition MRObjectMeshHolder.h:17
MRVIEWER_API void setCurrentPosition(const PickedPoint &pos)
sets new position for the widget
MRVIEWER_API void setCurrentPosition(const PointOnObject &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
Edges
Definition MRObjectMeshHolder.h:19
std::variant< std::monostate, MeshTriPoint, EdgePoint, VertId > PickedPoint
Definition MRPointOnObject.h:45
MRVIEWER_API void setHovered(bool on)
std::optional< Vector3f > findCoords() const
return local object's coordinates at the current position, or std::nullopt if it is invalid
Definition MRSurfacePointPicker.h:113
void setCanMoveCallback(std::function< bool(SurfacePointWidget &, const PickedPoint &)> canMove)
this callback is called before modification starts if it is set, and can cancel it by returning false
Definition MRSurfacePointPicker.h:137
MRVIEWER_API void setBaseColor(const Color &color)
set baseColor parameter for this widget
MeshTriPoint getCurrentPositionMeshTriPoint() const
returns stored position as MeshTriPoint, otherwise returns invalid (default) MeshTriPoint
Definition MRSurfacePointPicker.h:119
PointSizeType
Definition MRSurfacePointPicker.h:36
MRVIEWER_API void setParameters(const Parameters ¶ms)
set parameters for this widget
bool getAutoHover() const
Definition MRSurfacePointPicker.h:90
MRVIEWER_API ~SurfacePointWidget()
MRMESH_API Vector3f triPoint(const MeshTopology &topology, const VertCoords &points, const MeshTriPoint &p)
computes coordinates of point given as face and barycentric representation
MRVIEWER_API const PickedPoint & create(const std::shared_ptr< VisualObject > &surface, const PointOnObject &startPos)
MRVIEWER_API void updateParameters(const std::function< void(Parameters &)> &visitor)
bool isOnMove() const
returns whether is the widget moving
Definition MRSurfacePointPicker.h:163
std::shared_ptr< VisualObject > & getBaseSurface()
Definition MRSurfacePointPicker.h:157
static bool isPickIntoBackFace(const std::shared_ptr< MR::VisualObject > &obj, const MR::PointOnObject &pick, const Vector3f &cameraEye)
Checks whether the current peak is a peak in the invisible (reverse) side of the mesh or cloud point.
const Parameters & getParameters() const
get current setup of this widget
Definition MRSurfacePointPicker.h:73
MRVIEWER_API const PickedPoint & create(const std::shared_ptr< VisualObject > &surface, const PickedPoint &startPos)
MRVIEWER_API Vector3f getCoords() const
return local object's coordinates at the current position where the center of sphere is located
void setStartMoveCallback(std::function< void(SurfacePointWidget &, const PickedPoint &)> startMove)
this callback is called when modification starts if it is set
Definition MRSurfacePointPicker.h:142
Vector3f toVector3f() const
Definition MRSurfacePointPicker.h:110
PositionType
Definition MRSurfacePointPicker.h:26
MRVIEWER_API void reset()
resets whole widget
const PickedPoint & getCurrentPosition() const
returns stored position of this widget
Definition MRSurfacePointPicker.h:103
MRMESH_API std::optional< Vector3f > getPickedPointPosition(const VisualObject &object, const PickedPoint &point)
void setAutoHover(bool on)
Definition MRSurfacePointPicker.h:94
MRMESH_API std::optional< Vector3f > getPickedPointNormal(const VisualObject &object, const PickedPoint &point, bool interpolated=true)
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRMeshTriPoint.h:26
Definition MRViewerEventsListener.h:32
Definition MRPointOnObject.h:21