12#include <unordered_map>
13#include <unordered_set>
26 int widgetContourCloseMod = GLFW_MOD_CONTROL;
29 int widgetDeletePointMod = GLFW_MOD_SHIFT;
32 bool writeHistory =
true;
35 std::string historySpecification =
"surface contours widget";
38 bool filterHistoryonReset =
true;
54 MR::Color closeContourPointColor = Color::transparent();
67 MRVIEWER_API
void enable(
bool isEnabled );
87 MRVIEWER_API
void clear(
bool writeHistory =
true );
95 return pickedPoints_[obj];
101 return pickedPoints_;
113 MRVIEWER_API std::pair <std::shared_ptr<MR::VisualObject>,
int >
getActivePoint()
const;
114 MRVIEWER_API
void setActivePoint( std::shared_ptr<MR::VisualObject> obj,
int index );
125 MRVIEWER_API
bool removePoint(
const std::shared_ptr<VisualObject>& obj,
int pickedIndex );
130 MRVIEWER_API
bool closeContour(
const std::shared_ptr<VisualObject>& objectToCloseCoutour );
137 MRVIEWER_API
bool onMouseMove_(
int mouse_x,
int mouse_y )
override;
140 [[nodiscard]] std::shared_ptr<SurfacePointWidget> createPickWidget_(
const std::shared_ptr<MR::VisualObject>& obj,
const PickedPoint& pt );
143 bool moveClosedPoint_ =
false;
144 bool activeChange_ =
false;
145 bool isPickerActive_ =
false;
148 int activeIndex_{ 0 };
149 std::shared_ptr<MR::VisualObject> activeObject_ =
nullptr;
152 SurfaceContours pickedPoints_;
155 std::unordered_set<const VisualObject*> surfacePointWidgetCache_;
158 struct SurfaceConnectionHolder
160 boost::signals2::scoped_connection onMeshChanged;
161 boost::signals2::scoped_connection onPointsChanged;
163 std::unordered_map<std::shared_ptr<VisualObject>, SurfaceConnectionHolder> surfaceConnectionHolders_;
166 PickerPointCallBack onPointAdd_;
167 PickerPointCallBack onPointMove_;
168 PickerPointCallBack onPointMoveFinish_;
169 PickerPointCallBack onPointRemove_;
170 PickerPointObjectChecker isObjectValidToPick_;
189 virtual std::string
name()
const override;
191 [[nodiscard]]
virtual size_t heapBytes()
const override;
194 const std::shared_ptr<MR::VisualObject> obj_;
208 virtual std::string
name()
const override;
210 [[nodiscard]]
virtual size_t heapBytes()
const override;
213 const std::shared_ptr<MR::VisualObject> obj_;
228 virtual std::string
name()
const override;
230 [[nodiscard]]
virtual size_t heapBytes()
const override;
233 const std::shared_ptr<MR::VisualObject> obj_;
245 [[nodiscard]] std::string
name()
const override {
return name_; }
257 std::weak_ptr<VisualObject> objPtr;
258 std::vector<PickedPoint> pickedPoints;
260 std::vector<ObjectState> states_;
261 std::weak_ptr<VisualObject> activeObject_;
Definition MRSurfaceContoursWidget.h:181
virtual void action(Type actionType) override
This function is called on history action (undo, redo, etc.)
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
virtual std::string name() const override
AddPointActionPickerPoint(SurfaceContoursWidget &widget, const std::shared_ptr< MR::VisualObject > &obj, const PickedPoint &point)
Definition MRSurfaceContoursWidget.h:183
Definition MRSurfaceContoursWidget.h:219
ChangePointActionPickerPoint(SurfaceContoursWidget &widget, const std::shared_ptr< MR::VisualObject > &obj, const PickedPoint &point, int index)
Definition MRSurfaceContoursWidget.h:221
virtual std::string name() const override
virtual void action(Type) override
This function is called on history action (undo, redo, etc.)
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
Definition MRHistoryAction.h:12
Type
Definition MRHistoryAction.h:19
Definition MRSurfaceContoursWidget.h:199
RemovePointActionPickerPoint(SurfaceContoursWidget &widget, const std::shared_ptr< MR::VisualObject > &obj, const PickedPoint &point, int index)
Definition MRSurfaceContoursWidget.h:201
virtual std::string name() const override
virtual void action(Type actionType) override
This function is called on history action (undo, redo, etc.)
virtual size_t heapBytes() const override
returns the amount of memory this object occupies on heap
std::function< bool(const VisualObject *, ViewportMask)> PickRenderObjectPredicate
Definition MRViewport.h:151
Definition MRCameraOrientationPlugin.h:8
MouseButton
Definition MRMouse.h:9
std::variant< MeshTriPoint, EdgePoint, VertId, int > PickedPoint
Definition MRPointOnObject.h:40
Definition MRViewerEventsListener.h:29