Skip to content

Commit d717e06

Browse files
committed
PickPointManager: color inserted points with ordinaryPointColor
1 parent 9d6e0c4 commit d717e06

File tree

2 files changed

+12
-14
lines changed

2 files changed

+12
-14
lines changed

source/MRViewer/MRPickPointManager.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ std::shared_ptr<SurfacePointWidget> PickPointManager::createPickWidget_( const s
236236
auto newPoint = std::make_shared<SurfacePointWidget>();
237237
newPoint->setAutoHover( false );
238238
newPoint->setParameters( params.surfacePointParams );
239+
newPoint->setBaseColor( params.ordinaryPointColor );
239240
newPoint->create( obj, pt );
240241

241242
newPoint->setStartMoveCallback( [this, obj = obj] ( SurfacePointWidget & pointWidget, const PickedPoint& point )

source/MRViewer/MRPickPointManager.h

+11-14
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ class MRVIEWER_CLASS PickPointManager : public MultiListener<
2020
MouseMoveListener>
2121
{
2222
public:
23-
using PickerPointCallBack = std::function<void( std::shared_ptr<MR::VisualObject> obj, int index )>;
24-
using AllowCallBack = std::function<bool( const std::shared_ptr<MR::VisualObject>& obj, int index )>;
23+
using PickerPointCallBack = std::function<void( std::shared_ptr<VisualObject> obj, int index )>;
24+
using AllowCallBack = std::function<bool( const std::shared_ptr<VisualObject>& obj, int index )>;
2525

2626
struct Params
2727
{
@@ -44,17 +44,14 @@ class MRVIEWER_CLASS PickPointManager : public MultiListener<
4444
/// Parameters affect to future points only
4545
SurfacePointWidget::Parameters surfacePointParams;
4646

47-
/// Color for ordinary points in the contour
48-
/// Parameters affect to future points only
49-
MR::Color ordinaryPointColor = Color::gray();
47+
/// The color of all pick spheres except the one with the largest index on each object
48+
Color ordinaryPointColor = Color::gray();
5049

51-
/// Color for the last modified point in the contour
52-
/// Parameters affect to future points only
53-
MR::Color lastPointColor = Color::green();
50+
/// The color of last by index pick sphere in open contour
51+
Color lastPointColor = Color::green();
5452

55-
/// Color for the special point used to close a contour. Better do not change it.
56-
/// Parameters affect to future points only
57-
MR::Color closeContourPointColor = Color::transparent();
53+
/// The color of last by index pick sphere in closed contour, which coincides in position with the first pick sphere
54+
Color closeContourPointColor = Color::transparent();
5855

5956
/// Predicate to additionally filter objects that should be treated as pickable.
6057
Viewport::PickRenderObjectPredicate pickPredicate;
@@ -88,7 +85,7 @@ class MRVIEWER_CLASS PickPointManager : public MultiListener<
8885
struct WidgetHistoryAction : HistoryAction {};
8986

9087
using SurfaceContour = std::vector<std::shared_ptr<SurfacePointWidget>>;
91-
using SurfaceContours = std::unordered_map <std::shared_ptr<MR::VisualObject>, SurfaceContour>;
88+
using SurfaceContours = std::unordered_map <std::shared_ptr<VisualObject>, SurfaceContour>;
9289

9390
/// create an object and starts listening for mouse events
9491
MRVIEWER_API PickPointManager();
@@ -97,7 +94,7 @@ class MRVIEWER_CLASS PickPointManager : public MultiListener<
9794
MRVIEWER_API ~PickPointManager();
9895

9996
/// return contour for specific object (creating new one if necessary)
100-
[[nodiscard]] const SurfaceContour& getSurfaceContour( const std::shared_ptr<MR::VisualObject>& obj ) { return pickedPoints_[obj]; }
97+
[[nodiscard]] const SurfaceContour& getSurfaceContour( const std::shared_ptr<VisualObject>& obj ) { return pickedPoints_[obj]; }
10198

10299
/// return all contours, i.e. per object unorderd_map of ordered surface points [vector].
103100
[[nodiscard]] const SurfaceContours& getSurfaceContours() const { return pickedPoints_; }
@@ -161,7 +158,7 @@ class MRVIEWER_CLASS PickPointManager : public MultiListener<
161158
void colorLast2Points_( const std::shared_ptr<VisualObject>& obj );
162159

163160
// creates point widget for add to contour.
164-
[[nodiscard]] std::shared_ptr<SurfacePointWidget> createPickWidget_( const std::shared_ptr<MR::VisualObject>& obj, const PickedPoint& pt );
161+
[[nodiscard]] std::shared_ptr<SurfacePointWidget> createPickWidget_( const std::shared_ptr<VisualObject>& obj, const PickedPoint& pt );
165162

166163
/// removes everything
167164
void clearNoHistory_();

0 commit comments

Comments
 (0)