ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvVolumeCalcTool.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <ui_volumeCalcDlg.h>
11 
12 // Local
13 #include "ecv2.5DimEditor.h"
14 
15 // Qt
16 #include <QDialog>
17 
19 class ccPointCloud;
20 class ccPolyline;
21 class QComboBox;
22 
24 class ccVolumeCalcTool : public QDialog,
25  public cc2Point5DimEditor,
26  public Ui::VolumeCalcDialog {
27  Q_OBJECT
28 
29 public:
32  ccGenericPointCloud* cloud2,
33  QWidget* parent = 0);
34 
37 
38  // Inherited from cc2Point5DimEditor
39  virtual double getGridStep() const override;
40  virtual unsigned char getProjectionDimension() const override;
41  virtual ccRasterGrid::ProjectionType getTypeOfProjection() const override;
42 
44  struct ReportInfo {
46  : volume(0),
47  addedVolume(0),
48  removedVolume(0),
49  surface(0),
50  matchingPrecent(0),
54 
55  QString toText(int precision = 6) const;
56 
57  double volume;
58  double addedVolume;
59  double removedVolume;
60  double surface;
65  };
66 
68  static bool ComputeVolume(
69  ccRasterGrid& grid,
70  ccGenericPointCloud* ground,
72  const ccBBox& gridBox,
73  unsigned char vertDim,
74  double gridStep,
75  unsigned gridWidth,
76  unsigned gridHeight,
77  ccRasterGrid::ProjectionType projectionType,
78  ccRasterGrid::EmptyCellFillOption groundEmptyCellFillStrategy,
79  ccRasterGrid::EmptyCellFillOption ceilEmptyCellFillStrategy,
80  ccVolumeCalcTool::ReportInfo& reportInfo,
81  double groundHeight,
82  double ceilHeight,
83  QWidget* parentWidget = 0);
84 
87  const ccBBox& gridBox,
88  unsigned char vertDim,
89  bool exportToOriginalCS);
90 
91 protected slots:
92 
94  void saveSettingsAndAccept();
95 
97  void saveSettings();
98 
100  void projectionDirChanged(int);
101 
103  void sfProjectionTypeChanged(int);
104 
105  // Inherited from cc2Point5DimEditor
106  virtual bool showGridBoxEditor() override;
107 
112 
114  void gridOptionChanged();
115 
117  void updateGridInfo();
118 
120  void updateGridAndDisplay();
121 
123  void swapRoles();
124 
126  void groundSourceChanged(int);
128  void ceilSourceChanged(int);
129 
131  void exportToClipboard() const;
132 
134  void exportGridAsCloud() const;
135 
137  void setDisplayedNumberPrecision(int);
138 
139 protected: // standard methods
140  // Inherited from cc2Point5DimEditor
141  virtual void gridIsUpToDate(bool state) override;
142 
144  void loadSettings();
145 
147  bool updateGrid();
148 
150  ccPointCloud* convertGridToCloud(bool exportToOriginalCS) const;
151 
153  void outputReport(const ReportInfo& info);
154 
155 protected: // members
160 
162 
165 };
#define slots
2.5D data editor (generic interface)
Bounding box structure.
Definition: ecvBBox.h:25
A 3D cloud interface with associated features (color, normals, octree, etc.)
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Colored polyline.
Definition: ecvPolyline.h:24
Volume calculation tool (dialog)
ccGenericPointCloud * m_cloud2
Second associated cloud.
virtual void gridIsUpToDate(bool state) override
Declares whether the grid is up-to-date or not.
virtual bool showGridBoxEditor() override
void projectionDirChanged(int)
Called when the projection direction changes.
static ccPointCloud * ConvertGridToCloud(ccRasterGrid &grid, const ccBBox &gridBox, unsigned char vertDim, bool exportToOriginalCS)
Converts a (volume) grid to a point cloud.
void loadSettings()
Load persistent settings.
void setDisplayedNumberPrecision(int)
Sets the displayed number precision.
void ceilFillEmptyCellStrategyChanged(int)
Called when the (ceil) empty cell filling strategy changes.
virtual ccRasterGrid::ProjectionType getTypeOfProjection() const override
Returns type of projection.
void sfProjectionTypeChanged(int)
Called when the SF projection type changes.
static bool ComputeVolume(ccRasterGrid &grid, ccGenericPointCloud *ground, ccGenericPointCloud *ceil, const ccBBox &gridBox, unsigned char vertDim, double gridStep, unsigned gridWidth, unsigned gridHeight, ccRasterGrid::ProjectionType projectionType, ccRasterGrid::EmptyCellFillOption groundEmptyCellFillStrategy, ccRasterGrid::EmptyCellFillOption ceilEmptyCellFillStrategy, ccVolumeCalcTool::ReportInfo &reportInfo, double groundHeight, double ceilHeight, QWidget *parentWidget=0)
Static accessor.
void updateGridInfo()
Updates the gid info.
virtual unsigned char getProjectionDimension() const override
Returns projection dimension.
void updateGridAndDisplay()
Update the grid and the 2D display.
void outputReport(const ReportInfo &info)
Outputs the report.
~ccVolumeCalcTool()
Destructor.
void saveSettings()
Save persistent settings and 'accept' dialog.
ccVolumeCalcTool(ccGenericPointCloud *cloud1, ccGenericPointCloud *cloud2, QWidget *parent=0)
Default constructor.
ReportInfo m_lastReport
Last report.
void gridOptionChanged()
Called when the an option of the grid generation has changed.
bool updateGrid()
Updates the grid.
void groundFillEmptyCellStrategyChanged(int)
Called when the (ground) empty cell filling strategy changes.
void ceilSourceChanged(int)
Ceil source changed.
virtual double getGridStep() const override
Returns projection grid step.
ccPointCloud * convertGridToCloud(bool exportToOriginalCS) const
Converts the grid to a point cloud.
void groundSourceChanged(int)
Ground source changed.
void exportToClipboard() const
Exports info to clipboard.
ccGenericPointCloud * m_cloud1
First associated cloud.
void saveSettingsAndAccept()
Accepts the dialog and save settings.
void exportGridAsCloud() const
Exports the grid as a point cloud.
void swapRoles()
Swap roles.
MiniVec< float, N > ceil(const MiniVec< float, N > &a)
Definition: MiniVec.h:89
Raster grid type.
Definition: ecvRasterGrid.h:53
ProjectionType
Types of projection.
EmptyCellFillOption
Option for handling empty cells.
QString toText(int precision=6) const