Skip to content

Commit

Permalink
minimum effort to deal with point_cloud_editor's weak_ptr
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrea Ponza committed Apr 28, 2020
1 parent 5f85799 commit a9a0432
Show file tree
Hide file tree
Showing 11 changed files with 72 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,9 @@
#include <QtGui/QColor>
#include <pcl/apps/point_cloud_editor/localTypes.h>
#include <pcl/apps/point_cloud_editor/statistics.h>

#include <pcl/memory.h> // for pcl::weak_ptr

#ifdef OPENGL_IS_A_FRAMEWORK
# include <OpenGL/gl.h>
# include <OpenGL/glu.h>
Expand Down Expand Up @@ -75,6 +78,12 @@
class Cloud : public Statistics
{
public:
/// The type for shared pointer pointing to a selection buffer
using SelectionPtr = pcl::shared_ptr<Selection>;

/// The type for weak pointer pointing to a selection buffer
using SelectionWeakPtr = pcl::weak_ptr<Selection>;

/// @brief Default Constructor
Cloud ();

Expand Down Expand Up @@ -412,7 +421,7 @@ class Cloud : public Statistics
/// @brief A weak pointer pointing to the selection object.
/// @details This implementation uses the weak pointer to allow for a lazy
/// update of the cloud if the selection object is destroyed.
std::weak_ptr<Selection> selection_wk_ptr_;
SelectionWeakPtr selection_wk_ptr_;

/// Flag that indicates whether a color ramp should be used (true) or not
/// (false) when displaying the cloud
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,16 +47,23 @@
#include <pcl/apps/point_cloud_editor/statisticsDialog.h>
#include <pcl/apps/point_cloud_editor/toolInterface.h>

#include <pcl/memory.h> // for pcl::shared_ptr

#include <QGLWidget>

#include <functional>

class Selection;

/// @brief class declaration for the widget for editing and viewing
/// point clouds.
class CloudEditorWidget : public QGLWidget
{
Q_OBJECT
public:
/// The type for shared pointer pointing to a selection buffer
using SelectionPtr = pcl::shared_ptr<Selection>;

/// @brief Constructor
/// @param parent a pointer which points to the parent widget
CloudEditorWidget (QWidget *parent = nullptr);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@
#include <pcl/apps/point_cloud_editor/localTypes.h>
#include <pcl/apps/point_cloud_editor/copyBuffer.h>

#include <pcl/memory.h> // for pcl::shared_ptr

class Selection;

class CopyCommand : public Command
{
public:
/// The type for shared pointer pointing to a constant selection buffer
using ConstSelectionPtr = pcl::shared_ptr<const Selection>;

/// @brief Constructor
/// @param copy_buffer_ptr a shared pointer pointing to the copy buffer.
/// @param selection_ptr a shared pointer pointing to the selection object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@
#include <pcl/apps/point_cloud_editor/copyBuffer.h>
#include <pcl/apps/point_cloud_editor/selection.h>

#include <pcl/memory.h> // for pcl::shared_ptr

class CutCommand : public Command
{
public:
/// The type for shared pointer pointing to a selection buffer
using SelectionPtr = pcl::shared_ptr<Selection>;

/// @brief Constructor
/// @param copy_buffer_ptr a shared pointer pointing to the copy buffer.
/// @param selection_ptr a shared pointer pointing to the selection object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,14 @@
#include <pcl/apps/point_cloud_editor/copyBuffer.h>
#include <pcl/apps/point_cloud_editor/selection.h>

#include <pcl/memory.h> // for pcl::shared_ptr

class DeleteCommand : public Command
{
public:
/// The type for shared pointer pointing to a selection buffer
using SelectionPtr = pcl::shared_ptr<Selection>;

/// @brief Constructor
/// @param selection_ptr A shared pointer pointing to the selection object.
/// @param cloud_ptr A shared pointer pointing to the cloud object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,14 @@
#include <pcl/apps/point_cloud_editor/selection.h>
#include <pcl/apps/point_cloud_editor/copyBuffer.h>

#include <pcl/memory.h> // for pcl::shared_ptr

class DenoiseCommand : public Command
{
public:
/// The type for shared pointer pointing to a selection buffer
using SelectionPtr = pcl::shared_ptr<Selection>;

/// @brief Constructor
/// @param selection_ptr a shared pointer pointing to the selection object.
/// @param cloud_ptr a shared pointer pointing to the cloud object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,14 @@
#include <pcl/apps/point_cloud_editor/command.h>
#include <pcl/apps/point_cloud_editor/localTypes.h>

#include <pcl/memory.h> // for pcl::shared_ptr

class PasteCommand : public Command
{
public:
/// The type for shared pointer pointing to a selection buffer
using SelectionPtr = pcl::shared_ptr<Selection>;

/// @brief Constructor
/// @param copy_buffer_ptr a shared pointer pointing to the copy buffer.
/// @param selection_ptr a shared pointer pointing to the selection object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,16 @@
#include <pcl/apps/point_cloud_editor/toolInterface.h>
#include <pcl/apps/point_cloud_editor/localTypes.h>

#include <pcl/memory.h> // for pcl::shared_ptr

class Selection;

class Select1DTool : public ToolInterface
{
public:
/// The type for shared pointer pointing to a selection buffer
using SelectionPtr = pcl::shared_ptr<Selection>;

/// @brief Constructor
/// @param selection_ptr a shared pointer pointing to the selection object.
/// @param cloud_ptr a shared pointer pointing to the cloud object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@
#include <pcl/apps/point_cloud_editor/toolInterface.h>
#include <pcl/apps/point_cloud_editor/localTypes.h>

#include <pcl/memory.h> // for pcl::shared_ptr

class Selection;

class Select2DTool : public ToolInterface
{
public:
/// The type for shared pointer pointing to a selection buffer
using SelectionPtr = pcl::shared_ptr<Selection>;

/// @brief Constructor
/// @param selection_ptr a shared pointer pointing to the selection object.
/// @param cloud_ptr a shared pointer pointing to the cloud object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
#include <pcl/apps/point_cloud_editor/localTypes.h>
#include <pcl/apps/point_cloud_editor/trackball.h>

#include <pcl/memory.h> // for pcl::shared_ptr

class Selection;

/// @brief The selection transform tool computes the transform matrix from
/// mouse input. It then updates the cloud's transform matrix for the
/// selected points so that the transformed and selected points will be
Expand All @@ -53,6 +57,9 @@
class SelectionTransformTool : public ToolInterface
{
public:
/// The type for shared pointer pointing to a constant selection buffer
using ConstSelectionPtr = pcl::shared_ptr<const Selection>;

/// @brief Constructor
/// @param selection_ptr a shared pointer pointing to the selection object.
/// @param cloud_ptr a shared pointer pointing to the cloud object.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,16 @@
#include <pcl/apps/point_cloud_editor/localTypes.h>
#include <pcl/apps/point_cloud_editor/cloud.h>

#include <pcl/memory.h> // for pcl::shared_ptr

class Selection;

class TransformCommand : public Command
{
public:
/// The type for shared pointer pointing to a constant selection buffer
using ConstSelectionPtr = pcl::shared_ptr<const Selection>;

/// @brief Constructor
/// @param selection_ptr a shared pointer pointing to the selection object.
/// @param cloud_ptr a shared pointer pointing to the cloud object.
Expand Down

0 comments on commit a9a0432

Please sign in to comment.