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 reset()
resets whole widget
std::optional< Vector3f > getPickedPointNormal(const VisualObject &object, const PickedPoint &point, bool interpolated=true)
std::optional< Vector3f > getPickedPointPosition(const VisualObject &object, const PickedPoint &point)
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
void setCurrentPosition(const PointOnObject &pos)
sets new position for the widget
bool pickInBackFaceObject
pick_render_object parameters. Allow to use object in which pick exactly fell, instead of closer obje...
Definition MRSurfacePointPicker.h:57
std::variant< std::monostate, MeshTriPoint, EdgePoint, VertId > PickedPoint
Definition MRPointOnObject.h:45
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
Color baseColor
basic color of control sphere
Definition MRSurfacePointPicker.h:43
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
MeshTriPoint getCurrentPositionMeshTriPoint() const
returns stored position as MeshTriPoint, otherwise returns invalid (default) MeshTriPoint
Definition MRSurfacePointPicker.h:119
void swapCurrentPosition(PickedPoint &pos)
sets new position for the widget and returns previous position in the argument
PointSizeType
Definition MRSurfacePointPicker.h:36
PointSizeType radiusSizeType
how to set the size of the dots in mm or in pixels.
Definition MRSurfacePointPicker.h:49
const PickedPoint & create(const std::shared_ptr< VisualObject > &surface, const PickedPoint &startPos)
Vector3f getCoords() const
return local object's coordinates at the current position where the center of sphere is located
bool getAutoHover() const
Definition MRSurfacePointPicker.h:90
Vector3f triPoint(const MeshTopology &topology, const VertCoords &points, const MeshTriPoint &p)
computes coordinates of point given as face and barycentric representation
void setCurrentPosition(const PickedPoint &pos)
sets new position for the widget
bool isOnMove() const
returns whether is the widget moving
Definition MRSurfacePointPicker.h:163
std::shared_ptr< VisualObject > & getBaseSurface()
Definition MRSurfacePointPicker.h:157
Color hoveredColor
color of control sphere when it is hovered by mouse
Definition MRSurfacePointPicker.h:45
static constexpr Color red() noexcept
Definition MRColor.h:31
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 PickedPoint & create(const std::shared_ptr< VisualObject > &surface, const PointOnObject &startPos)
void setBaseColor(const Color &color)
set baseColor parameter for this widget
const Parameters & getParameters() const
get current setup of this widget
Definition MRSurfacePointPicker.h:73
static constexpr Color gray() noexcept
Definition MRColor.h:30
void setParameters(const Parameters ¶ms)
set parameters for this widget
float radius
Definition MRSurfacePointPicker.h:52
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
const PickedPoint & getCurrentPosition() const
returns stored position of this widget
Definition MRSurfacePointPicker.h:103
Color activeColor
color of control sphere when it is in move
Definition MRSurfacePointPicker.h:47
void updateParameters(const std::function< void(Parameters &)> &visitor)
PositionType positionType
type of point positioning, look at PositionType comments for more info
Definition MRSurfacePointPicker.h:41
void setAutoHover(bool on)
Definition MRSurfacePointPicker.h:94
int customModifiers
Definition MRSurfacePointPicker.h:55
@ Pixel
point size in mm
Definition MRSurfacePointPicker.h:38
@ Metrical
Definition MRSurfacePointPicker.h:37
@ Edges
point can be only in face center
Definition MRSurfacePointPicker.h:29
@ Faces
Definition MRSurfacePointPicker.h:27
@ FaceCenters
point can be in any place of surface
Definition MRSurfacePointPicker.h:28
@ EdgeCenters
point can be only on edges
Definition MRSurfacePointPicker.h:30
@ Verts
point can be only in edge center
Definition MRSurfacePointPicker.h:31
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Definition MRMeshTriPoint.h:26
Definition MRViewerEventsListener.h:32
Definition MRPointOnObject.h:21