25 int widgetContourCloseMod = GLFW_MOD_CONTROL;
28 int widgetDeletePointMod = GLFW_MOD_SHIFT;
31 bool writeHistory =
true;
37 bool filterHistoryonReset =
true;
53 MR::Color closeContourPointColor = Color::transparent();
69 MRVIEWER_API
void enable(
bool isEnabled );
89 MRVIEWER_API
void clear(
bool writeHistory =
true );
98 return pickedPoints_[obj];
104 return pickedPoints_;
116 MRVIEWER_API std::pair <std::shared_ptr<MR::VisualObject>,
int >
getActivePoint()
const;
117 MRVIEWER_API
void setActivePoint( std::shared_ptr<MR::VisualObject> obj,
int index );
128 MRVIEWER_API
bool removePoint(
const std::shared_ptr<VisualObject>& obj,
int pickedIndex );
133 MRVIEWER_API
bool closeContour(
const std::shared_ptr<VisualObject>& objectToCloseCoutour );
139 MRVIEWER_API
bool onMouseDown_(
MouseButton button,
int modifier )
override;
140 MRVIEWER_API
bool onMouseMove_(
int mouse_x,
int mouse_y )
override;
143 [[nodiscard]] std::shared_ptr<SurfacePointWidget> createPickWidget_(
const std::shared_ptr<MR::VisualObject>& obj,
const PickedPoint& pt );
146 bool moveClosedPoint_ =
false;
147 bool activeChange_ =
false;
148 bool isPickerActive_ =
false;
151 int activeIndex_{ 0 };
152 std::shared_ptr<MR::VisualObject> activeObject_ =
nullptr;
155 SurfaceContours pickedPoints_;
158 std::unordered_set<const VisualObject*> surfacePointWidgetCache_;
161 struct SurfaceConnectionHolder
163 boost::signals2::scoped_connection onMeshChanged;
164 boost::signals2::scoped_connection onPointsChanged;
166 std::unordered_map<std::shared_ptr<VisualObject>, SurfaceConnectionHolder> surfaceConnectionHolders_;
169 PickerPointCallBack onPointAdd_;
170 PickerPointCallBack onPointMove_;
171 PickerPointCallBack onPointMoveFinish_;
172 PickerPointCallBack onPointRemove_;
173 PickerPointObjectChecker isObjectValidToPick_;
176 bool undoRedoMode_{
false };
179 class AddPointActionPickerPoint :
public WidgetHistoryAction
182 AddPointActionPickerPoint( SurfaceContoursWidget& widget,
const std::shared_ptr<MR::VisualObject>& obj,
const PickedPoint& point ) :
188 virtual std::string
name()
const override;
189 virtual void action( Type actionType )
override;
190 [[nodiscard]]
virtual size_t heapBytes()
const override;
192 SurfaceContoursWidget& widget_;
193 const std::shared_ptr<MR::VisualObject> obj_;
197 class RemovePointActionPickerPoint :
public WidgetHistoryAction
200 RemovePointActionPickerPoint( SurfaceContoursWidget& widget,
const std::shared_ptr<MR::VisualObject>& obj,
const PickedPoint& point,
int index ) :
207 virtual std::string
name()
const override;
208 virtual void action( Type actionType )
override;
209 [[nodiscard]]
virtual size_t heapBytes()
const override;
211 SurfaceContoursWidget& widget_;
212 const std::shared_ptr<MR::VisualObject> obj_;
217 class ChangePointActionPickerPoint :
public WidgetHistoryAction
220 ChangePointActionPickerPoint( SurfaceContoursWidget& widget,
const std::shared_ptr<MR::VisualObject>& obj,
const PickedPoint& point,
int index ) :
227 virtual std::string
name()
const override;
228 virtual void action( Type )
override;
229 [[nodiscard]]
virtual size_t heapBytes()
const override;
231 SurfaceContoursWidget& widget_;
232 const std::shared_ptr<MR::VisualObject> obj_;
237 class SurfaceContoursWidgetClearAction :
public WidgetHistoryAction
240 SurfaceContoursWidgetClearAction( std::string name, SurfaceContoursWidget& widget );
243 [[nodiscard]] std::string
name()
const override {
return name_; }
245 void action( Type type )
override;
247 [[nodiscard]]
size_t heapBytes()
const override;
251 SurfaceContoursWidget& widget_;
255 std::weak_ptr<VisualObject> objPtr;
256 std::vector<PickedPoint> pickedPoints;
258 std::vector<ObjectState> states_;
259 std::weak_ptr<VisualObject> activeObject_;
Definition MRHistoryAction.h:12