14class ChangePointCloudAction :
public HistoryAction
17 using Obj = ObjectPoints;
22 name_{ std::move(
name ) }
26 if (
auto m = obj->pointCloud() )
27 clonePointCloud_ = std::make_shared<PointCloud>( *m );
31 virtual std::string
name()
const override {
return name_; }
33 virtual void action( HistoryAction::Type )
override
38 objPoints_->swapPointCloud( clonePointCloud_ );
41 static void setObjectDirty(
const std::shared_ptr<ObjectPoints>& obj )
44 obj->setDirtyFlags( DIRTY_ALL );
47 [[nodiscard]]
virtual size_t heapBytes()
const override
48 {
return name_.capacity() +
MR::heapBytes( clonePointCloud_ ); }
51 std::shared_ptr<ObjectPoints> objPoints_;
52 std::shared_ptr<PointCloud> clonePointCloud_;
59class ChangePointCloudPointsAction :
public HistoryAction
62 using Obj = ObjectPoints;
67 name_{ std::move(
name ) }
71 if (
auto m = obj->pointCloud() )
72 clonePoints_ = m->points;
79 clonePoints_{ std::move( newPoints ) },
80 name_{ std::move(
name ) }
82 action( HistoryAction::Type::Redo );
85 virtual std::string
name()
const override
90 virtual void action( HistoryAction::Type )
override
95 if (
auto m = objPoints_->varPointCloud() )
97 std::swap( m->points, clonePoints_ );
98 objPoints_->setDirtyFlags( DIRTY_POSITION );
102 static void setObjectDirty(
const std::shared_ptr<ObjectPoints>& obj )
105 obj->setDirtyFlags( DIRTY_POSITION );
108 [[nodiscard]]
virtual size_t heapBytes()
const override
110 return name_.capacity() + clonePoints_.heapBytes();
114 std::shared_ptr<ObjectPoints> objPoints_;
115 VertCoords clonePoints_;
122class ChangeOnePointInCloudAction :
public HistoryAction
125 using Obj = ObjectPoints;
131 name_{ std::move(
name ) }
135 if (
auto m = obj->pointCloud() )
136 if ( m->points.size() > pointId_ )
137 safeCoords_ = m->points[pointId_];
142 ChangeOnePointInCloudAction( std::string name,
const std::shared_ptr<ObjectPoints>& obj, VertId pointId,
const Vector3f & newCoords ) :
145 safeCoords_{ newCoords },
146 name_{ std::move(
name ) }
148 action( HistoryAction::Type::Redo );
151 virtual std::string
name()
const override
156 virtual void action( HistoryAction::Type )
override
161 if (
auto m = objPoints_->varPointCloud() )
163 if ( m->points.size() > pointId_ )
165 std::swap( safeCoords_, m->points[pointId_] );
166 objPoints_->setDirtyFlags( DIRTY_POSITION );
171 static void setObjectDirty(
const std::shared_ptr<ObjectPoints>& obj )
174 obj->setDirtyFlags( DIRTY_POSITION );
177 [[nodiscard]]
virtual size_t heapBytes()
const override
179 return name_.capacity();
183 std::shared_ptr<ObjectPoints> objPoints_;
185 Vector3f safeCoords_;
unsafe ChangeOnePointInCloudAction(MR._ByValue_ChangeOnePointInCloudAction _other)
unsafe void action(MR.HistoryAction.Type _1)
unsafe void action(MR.HistoryAction.Type _1)
unsafe ChangePointCloudAction(MR._ByValue_ChangePointCloudAction _other)
unsafe ChangePointCloudPointsAction(MR._ByValue_ChangePointCloudPointsAction _other)
unsafe void action(MR.HistoryAction.Type _1)
size_t heapBytes(const BitSet &bs)
returns the amount of memory given BitSet occupies on heap
Definition MRMesh/MRBitSet.h:298
std::string name(const T &primitive)
Definition MRFeatures.h:309
Definition MRCameraOrientationPlugin.h:8