4#include "MRMesh/MRMeshFwd.h"
8#include <unordered_map>
31 float ordinaryLineWidth = 3;
34 float hoveredLineWidth = 4;
37 float selectedLineWidth = 3;
51 MRVIEWER_API
void enable(
bool isEnabled );
70 MRVIEWER_API
bool selectHole( std::shared_ptr<MR::ObjectMeshHolder>
object,
int index );
76 MRVIEWER_API std::pair< std::shared_ptr<MR::ObjectMeshHolder>, EdgeId >
getSelectHole()
const;
85 float mouseAccuracy_{ 5.5f };
87 bool isSelectorActive_ =
false;
89 PerObjectHoles holes_;
90 PerObjectHolesPolylines holeLines_;
91 PerObjectMeshChangedSignals onMeshChangedSignals_;
93 MRVIEWER_API
bool onMouseDown_(
MouseButton button,
int modifier )
override;
94 MRVIEWER_API
bool onMouseMove_(
int mouse_x,
int mouse_y )
override;
97 AncillaryLines createAncillaryLines_( std::shared_ptr<ObjectMeshHolder>& obj, MR::EdgeId hole );
100 std::shared_ptr<MR::Polyline3> getHoleBorder_(
const std::shared_ptr<ObjectMeshHolder> obj, EdgeId initEdge );
104 std::pair<std::shared_ptr<MR::ObjectMeshHolder>,
HoleEdgePoint> getHoverdHole_();
107 bool selectHole_( std::shared_ptr<ObjectMeshHolder>
object,
int index,
bool writeHistory =
true );
110 bool updateHole_( std::shared_ptr<MR::ObjectMeshHolder>
object,
int index,
MR::Color color,
float lineWidth );
113 enum class ActionType {
119 bool actionByPick_( ActionType actionType );
122 BoundarySelectionWidgetCallBack onBoundarySelected_;
123 BoundarySelectionWidgetChecker isObjectValidToPick_;
126 std::shared_ptr<MR::ObjectMeshHolder> selectedHoleObject_;
127 int selectedHoleIndex_;
130 std::shared_ptr<MR::ObjectMeshHolder> hoveredHoleObject_;
131 int hoveredHoleIndex_;
134 bool isSelectedAndHoveredTheSame_();
137 bool hoverHole_( std::shared_ptr<MR::ObjectMeshHolder>
object,
int index );
140 void calculateHoles_();
152 [[nodiscard]] std::string
name()
const override {
return name_; }
161 std::shared_ptr<ObjectMeshHolder> prevSelectedHoleObject_;
162 std::shared_ptr<ObjectMeshHolder> nextSelectedHoleObject_;
163 int prevSelectedHoleIndex_;
164 int nextSelectedHoleIndex_;
Definition MRMeshBoundarySelectionWidget.h:146
Definition MRHistoryAction.h:15
static constexpr Color green() noexcept
Definition MRColor.h:32
MouseButton
Definition MRMouse.h:12
MRVIEWER_API void enable(bool isEnabled)
enable or disable widget
static constexpr Color purple() noexcept
Definition MRColor.h:36
MRVIEWER_API void create(BoundarySelectionWidgetCallBack onBoundarySelected, BoundarySelectionWidgetChecker isObjectValidToPick)
std::function< bool(std::shared_ptr< const MR::ObjectMeshHolder >)> BoundarySelectionWidgetChecker
Definition MRMeshBoundarySelectionWidget.h:42
std::unordered_map< std::shared_ptr< MR::ObjectMeshHolder >, boost::signals2::scoped_connection > PerObjectMeshChangedSignals
Definition MRMeshBoundarySelectionWidget.h:47
std::unordered_map< std::shared_ptr< MR::ObjectMeshHolder >, std::vector< AncillaryLines > > PerObjectHolesPolylines
Definition MRMeshBoundarySelectionWidget.h:46
MRVIEWER_API void clear()
clear selection
MRVIEWER_API std::vector< MR::Vector3f > getPointsForSelectedHole() const
collect and return vector of points ( verts coord ) for all edges in selected mesh boundary
MRVIEWER_API std::pair< std::shared_ptr< MR::ObjectMeshHolder >, EdgeId > getSelectHole() const
returns pair of selected hole ( in Edge representations) and objects on which particular hole is pres...
BoundarySelectionWidgetParams params
configuration params
Definition MRMeshBoundarySelectionWidget.h:82
void action(Type type) override
This function is called on history action (undo, redo, etc.)
std::string name() const override
HistoryAction.
Definition MRMeshBoundarySelectionWidget.h:152
std::function< void(std::shared_ptr< const MR::ObjectMeshHolder >)> BoundarySelectionWidgetCallBack
Definition MRMeshBoundarySelectionWidget.h:41
std::vector< MR::EdgeId > HolesOnObject
Definition MRMeshBoundarySelectionWidget.h:44
MRVIEWER_API void reset()
reset widget, clear internal variables and detach from signals.
static constexpr Color gray() noexcept
Definition MRColor.h:30
std::unordered_map< std::shared_ptr< MR::ObjectMeshHolder >, HolesOnObject > PerObjectHoles
Definition MRMeshBoundarySelectionWidget.h:45
ChangeBoundarySelectionHistoryAction(std::string name, BoundarySelectionWidget &widget, std::shared_ptr< ObjectMeshHolder > object, int index)
Type
Definition MRHistoryAction.h:22
MRVIEWER_API bool selectHole(std::shared_ptr< MR::ObjectMeshHolder > object, int index)
select one of the holes. Return true on success.
size_t heapBytes() const override
returns the amount of memory this object occupies on heap
void onObjectChange_()
meshChangedSignal processor
only for bindings generation
Definition MRCameraOrientationPlugin.h:8
Helper class to manage ancillary visual lines used by plugins.
Definition MRAncillaryLines.h:16
Definition MRPickHoleBorderElement.h:14
Definition MRViewerEventsListener.h:32