ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cloudViewer::NormalizedProgress Class Reference

#include <GenericProgressCallback.h>

Collaboration diagram for cloudViewer::NormalizedProgress:

Public Member Functions

 NormalizedProgress (GenericProgressCallback *callback, unsigned totalSteps, unsigned totalPercentage=100)
 Default constructor. More...
 
virtual ~NormalizedProgress ()
 Destructor. More...
 
void scale (unsigned totalSteps, unsigned totalPercentage=100, bool updateCurrentProgress=false)
 
void reset ()
 Resets progress state. More...
 
bool oneStep ()
 Increments total progress value of a single unit. More...
 
bool steps (unsigned n)
 Increments total progress value of more than a single unit. More...
 

Protected Attributes

float m_percent
 Total progress value (in percent) More...
 
unsigned m_step
 
float m_percentAdd
 Percentage added to total progress value at each step. More...
 
AtomicCounterm_counter
 Current number of calls to 'oneStep'. More...
 
GenericProgressCallbackprogressCallback
 associated GenericProgressCallback More...
 

Detailed Description

Efficient management of progress based on a total number of steps different than 100 DGM: can now be associated to a null 'callback' pointer to simplify the client code.

Definition at line 78 of file GenericProgressCallback.h.

Constructor & Destructor Documentation

◆ NormalizedProgress()

NormalizedProgress::NormalizedProgress ( GenericProgressCallback callback,
unsigned  totalSteps,
unsigned  totalPercentage = 100 
)

Default constructor.

Parameters
callbackassociated GenericProgressCallback instance (can be null)
totalStepstotal number of steps (> 0)
totalPercentageequivalent percentage (> 0)

Definition at line 44 of file NormalizedProgress.cpp.

References scale().

◆ ~NormalizedProgress()

NormalizedProgress::~NormalizedProgress ( )
virtual

Destructor.

Definition at line 55 of file NormalizedProgress.cpp.

References m_counter.

Member Function Documentation

◆ oneStep()

bool NormalizedProgress::oneStep ( )

Increments total progress value of a single unit.

Definition at line 99 of file NormalizedProgress.cpp.

References AtomicCounter::fetchAndAddRelaxed(), cloudViewer::GenericProgressCallback::isCancelRequested(), m_counter, m_percent, m_percentAdd, m_step, progressCallback, and cloudViewer::GenericProgressCallback::update().

Referenced by cloudViewer::CloudSamplingTools::applyNoiseFilterAtLevel(), ccLibAlgorithms::ApplyScaleMatchingAlgorithm(), cloudViewer::CloudSamplingTools::applySORFilterAtLevel(), cloudViewer::PointProjectionTools::applyTransformation(), masc::Classifier::classify(), qCanupoProcess::Classify(), ClusterEmptySpace(), qVoxFallProcess::Compute(), cloudViewer::GeometricalAnalysisTools::ComputeApproxPointsDensityInACellAtLevel(), cloudViewer::ScalarFieldTools::computeCellGaussianFilter(), cloudViewer::DistanceComputationTools::computeCellHausdorffDistance(), cloudViewer::DistanceComputationTools::computeCellHausdorffDistanceWithLocalModel(), cloudViewer::DistanceComputationTools::computeCloud2MeshDistancesWithOctree(), cloudViewer::DistanceComputationTools::computeCloud2MeshDistanceWithOctree(), ComputeClusterVolume(), cloudViewer::GeometricalAnalysisTools::ComputeGeomCharacteristicAtLevel(), cloudViewer::StatisticalTestingTools::computeLocalChi2DistAtLevel(), ComputeM3C2DistForPoint(), ComputeMathOpWithNearestNeighbor(), DistanceMapGenerationTool::ComputeRadialDist(), ccVolumeCalcTool::ComputeVolume(), define_GenericProgressCallback(), cloudViewer::GeometricalAnalysisTools::DetectCircle(), cloudViewer::GeometricalAnalysisTools::DetectSphereRobust(), ccComparisonDlg::determineBestOctreeLevel(), cloudViewer::PointProjectionTools::developCloudOnCone(), cloudViewer::PointProjectionTools::developCloudOnCylinder(), masc::Classifier::evaluate(), cloudViewer::DgmOctree::extractCCs(), cloudViewer::GeometricalAnalysisTools::FlagDuplicatePointsInACellAtLevel(), ccKdTreeForFacetExtraction::FuseCells(), ccRasterizeTool::generateContours(), cloudViewer::DgmOctree::genericBuild(), FastMarchingForFacetExtraction::init(), StereogramWidget::init(), InitializeOutputCloud(), cloudViewer::Grid3D< Type >::intersectWith(), SoiFilter::loadFile(), SimpleBinFilter::loadFile(), E57Filter::loadFile(), LASFWFFilter::loadFile(), LasIOFilter::loadFile(), LASFilter::loadFile(), RDBFilter::loadFile(), LoadScan(), masc::ContextBasedFeature::prepare(), masc::Tools::PrepareFeatures(), cloudViewer::ChamferDistanceTransform::propagateDistance(), cloudViewer::CloudSamplingTools::resampleCloudSpatially(), cloudViewer::MeshSamplingTools::samplePointsOnMesh(), SaveScan(), MAFilter::saveToFile(), SimpleBinFilter::saveToFile(), E57Filter::saveToFile(), LASFWFFilter::saveToFile(), LASFilter::saveToFile(), cloudViewer::SaitoSquaredDistanceTransform::SDT_3D(), cloudViewer::ManualSegmentationTools::segmentMesh(), cloudViewer::CloudSamplingTools::subsampleCellAtLevel(), cloudViewer::CloudSamplingTools::subsampleCloudRandomly(), and TileLasReader().

◆ reset()

void NormalizedProgress::reset ( )

◆ scale()

void NormalizedProgress::scale ( unsigned  totalSteps,
unsigned  totalPercentage = 100,
bool  updateCurrentProgress = false 
)

Scales inner parameters so that 'totalSteps' calls of the 'oneStep' method correspond to 'totalPercentage' percents

Definition at line 61 of file NormalizedProgress.cpp.

References cloudViewer::utility::ceil(), AtomicCounter::load(), m_counter, m_percent, m_percentAdd, m_step, progressCallback, and AtomicCounter::store().

Referenced by define_GenericProgressCallback(), and NormalizedProgress().

◆ steps()

Member Data Documentation

◆ m_counter

AtomicCounter* cloudViewer::NormalizedProgress::m_counter
protected

Current number of calls to 'oneStep'.

Thread safe if CC_CORE_LIB is compiled with Qt.

Definition at line 121 of file GenericProgressCallback.h.

Referenced by oneStep(), reset(), scale(), steps(), and ~NormalizedProgress().

◆ m_percent

float cloudViewer::NormalizedProgress::m_percent
protected

Total progress value (in percent)

Definition at line 109 of file GenericProgressCallback.h.

Referenced by oneStep(), reset(), scale(), and steps().

◆ m_percentAdd

float cloudViewer::NormalizedProgress::m_percentAdd
protected

Percentage added to total progress value at each step.

Definition at line 116 of file GenericProgressCallback.h.

Referenced by oneStep(), scale(), and steps().

◆ m_step

unsigned cloudViewer::NormalizedProgress::m_step
protected

Number of necessary calls to 'oneStep' to actually call progress callback

Definition at line 113 of file GenericProgressCallback.h.

Referenced by oneStep(), scale(), and steps().

◆ progressCallback

GenericProgressCallback* cloudViewer::NormalizedProgress::progressCallback
protected

associated GenericProgressCallback

Definition at line 124 of file GenericProgressCallback.h.

Referenced by oneStep(), reset(), scale(), and steps().


The documentation for this class was generated from the following files: