ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
cvSelectionAlgebra Class Reference

Selection algebra operations. More...

#include <cvSelectionAlgebra.h>

Inheritance diagram for cvSelectionAlgebra:
[legend]
Collaboration diagram for cvSelectionAlgebra:
[legend]

Public Types

enum  Operation {
  Operation::UNION, Operation::INTERSECTION, Operation::DIFFERENCE, Operation::SYMMETRIC_DIFF,
  Operation::COMPLEMENT
}
 Algebra operations Using enum class to avoid macro conflicts (e.g., DIFFERENCE may be defined as a macro on Windows) Note: Q_ENUM requires QObject to be fully defined before the enum Note: DIFFERENCE macro protection is handled at file scope (top of file) More...
 

Signals

void operationComplete (const cvSelectionData &result)
 Emitted when operation is complete. More...
 
void progressChanged (int percentage)
 Emitted when filtering progress changes. More...
 
void filteringComplete (const cvSelectionData &result)
 Emitted when filtering is complete. More...
 

Public Member Functions

 cvSelectionAlgebra (QObject *parent=nullptr)
 

Static Public Member Functions

static cvSelectionData unionOf (const cvSelectionData &a, const cvSelectionData &b)
 Compute union of two selections. More...
 
static cvSelectionData intersectionOf (const cvSelectionData &a, const cvSelectionData &b)
 Compute intersection of two selections. More...
 
static cvSelectionData differenceOf (const cvSelectionData &a, const cvSelectionData &b)
 Compute difference of two selections. More...
 
static cvSelectionData symmetricDifferenceOf (const cvSelectionData &a, const cvSelectionData &b)
 Compute symmetric difference of two selections. More...
 
static cvSelectionData complementOf (vtkPolyData *polyData, const cvSelectionData &input)
 Compute complement of a selection. More...
 
static cvSelectionData performOperation (Operation op, const cvSelectionData &a, const cvSelectionData &b, vtkPolyData *polyData=nullptr)
 Perform algebra operation on two selections. More...
 
static cvSelectionData growSelection (vtkPolyData *polyData, const cvSelectionData &input, int layers=1, bool removeSeed=false, bool removeIntermediateLayers=false)
 Grow selection by adding neighbors. More...
 
static cvSelectionData shrinkSelection (vtkPolyData *polyData, const cvSelectionData &input, int iterations=1)
 Shrink selection by removing boundary elements. More...
 
static cvSelectionData expandSelection (vtkPolyData *polyData, const cvSelectionData &input, int layers, bool removeSeed=false, bool removeIntermediateLayers=false)
 Expand selection (ParaView-compatible) More...
 
static cvSelectionData extractBoundary (vtkPolyData *polyData, const cvSelectionData &input)
 Extract boundary elements of selection. More...
 
static bool areCompatible (const cvSelectionData &a, const cvSelectionData &b)
 Validate that two selections are compatible for operations. More...
 
static cvSelectionData growPointSelection (vtkPolyData *polyData, const cvSelectionData &input, int layers=1, bool removeSeed=false, bool removeIntermediateLayers=false)
 Grow point selection by adding neighbor points. More...
 
static cvSelectionData shrinkPointSelection (vtkPolyData *polyData, const cvSelectionData &input, int iterations=1)
 Shrink point selection by removing boundary points. More...
 

Detailed Description

Selection algebra operations.

Provides set-theoretic operations on selections:

  • Union (A U B): Combine two selections
  • Intersection (A & B): Common elements
  • Difference (A - B): Elements in A but not in B
  • Symmetric Difference (A ^ B): Elements in A or B but not both
  • Complement (~A): All elements not in A

Based on ParaView's selection algebra functionality.

Member Enumeration Documentation

◆ Operation

Algebra operations Using enum class to avoid macro conflicts (e.g., DIFFERENCE may be defined as a macro on Windows) Note: Q_ENUM requires QObject to be fully defined before the enum Note: DIFFERENCE macro protection is handled at file scope (top of file)

Enumerator
UNION 
INTERSECTION 
DIFFERENCE 
SYMMETRIC_DIFF 
COMPLEMENT 

Constructor & Destructor Documentation

◆ cvSelectionAlgebra()

cvSelectionAlgebra::cvSelectionAlgebra ( QObject *  parent = nullptr)
explicit

References CVLog::PrintVerbose().

Member Function Documentation

◆ areCompatible()

bool cvSelectionAlgebra::areCompatible ( const cvSelectionData &  a,
const cvSelectionData &  b 
)
static

Validate that two selections are compatible for operations.

Returns
True if compatible

References a, cvSelectionData::fieldAssociation(), and cvSelectionData::isEmpty().

Referenced by differenceOf(), intersectionOf(), symmetricDifferenceOf(), and unionOf().

◆ complementOf()

cvSelectionData cvSelectionAlgebra::complementOf ( vtkPolyData *  polyData,
const cvSelectionData &  input 
)
static

Compute complement of a selection.

Parameters
polyDataThe mesh data (to determine total element count)
inputInput selection
Returns
Complement result (~A)

References cvSelectionData::count(), CVLog::Error(), cvSelectionData::fieldAssociation(), cvSelectionData::ids(), cvSelectionData::isEmpty(), cvSelectionData::POINTS, CVLog::Print(), and qSetFromVector().

Referenced by performOperation().

◆ differenceOf()

cvSelectionData cvSelectionAlgebra::differenceOf ( const cvSelectionData &  a,
const cvSelectionData &  b 
)
static

Compute difference of two selections.

Parameters
aFirst selection
bSecond selection
Returns
Difference result (A - B)

References a, areCompatible(), cvSelectionData::count(), CVLog::Error(), cvSelectionData::ids(), cvSelectionData::isEmpty(), CVLog::Print(), qSetFromVector(), qVectorFromSet(), and result.

Referenced by performOperation().

◆ expandSelection()

cvSelectionData cvSelectionAlgebra::expandSelection ( vtkPolyData *  polyData,
const cvSelectionData &  input,
int  layers,
bool  removeSeed = false,
bool  removeIntermediateLayers = false 
)
static

Expand selection (ParaView-compatible)

Parameters
polyDataThe mesh data
inputInput selection
layersNumber of layers to expand (positive = grow, negative = shrink)
removeSeedIf true, removes the original seed elements
removeIntermediateLayersIf true, keeps only the outermost layer
Returns
Expanded selection

This is the ParaView-compatible API matching vtkSMSelectionHelper::ExpandSelection

References cvSelectionData::fieldAssociation(), cvSelectionData::hasActorInfo(), cvSelectionData::ids(), cvSelectionData::isEmpty(), cvSelectionData::POINTS, cvSelectionData::primaryActor(), cvSelectionData::primaryPolyData(), CVLog::PrintVerbose(), cvSelectionData::setActorInfo(), and CVLog::Warning().

Referenced by cvViewSelectionManager::expandSelection().

◆ extractBoundary()

cvSelectionData cvSelectionAlgebra::extractBoundary ( vtkPolyData *  polyData,
const cvSelectionData &  input 
)
static

Extract boundary elements of selection.

Parameters
polyDataThe mesh data
inputInput selection (must be CELLS)
Returns
Boundary selection (cells at the edge of the selection)

References cvSelectionData::CELLS, cvSelectionData::count(), cvSelectionData::fieldAssociation(), cvSelectionData::ids(), cvSelectionData::isEmpty(), CVLog::PrintVerbose(), qSetFromVector(), and CVLog::Warning().

◆ filteringComplete

void cvSelectionAlgebra::filteringComplete ( const cvSelectionData &  result)
signal

Emitted when filtering is complete.

◆ growPointSelection()

cvSelectionData cvSelectionAlgebra::growPointSelection ( vtkPolyData *  polyData,
const cvSelectionData &  input,
int  layers = 1,
bool  removeSeed = false,
bool  removeIntermediateLayers = false 
)
static

Grow point selection by adding neighbor points.

Parameters
polyDataThe mesh data
inputInput selection (must be POINTS)
layersNumber of growth layers
removeSeedIf true, removes the original seed points
removeIntermediateLayersIf true, keeps only outermost layer
Returns
Grown selection

Point neighbors are determined by shared cells.

References cvSelectionData::count(), cvSelectionData::fieldAssociation(), cvSelectionData::ids(), cvSelectionData::isEmpty(), cvSelectionData::POINTS, CVLog::PrintVerbose(), qSetFromVector(), and CVLog::Warning().

◆ growSelection()

cvSelectionData cvSelectionAlgebra::growSelection ( vtkPolyData *  polyData,
const cvSelectionData &  input,
int  layers = 1,
bool  removeSeed = false,
bool  removeIntermediateLayers = false 
)
static

Grow selection by adding neighbors.

Parameters
polyDataThe mesh data
inputInput selection (must be CELLS)
layersNumber of growth layers (negative for shrink)
removeSeedIf true, removes the original seed cells (ParaView-aligned)
removeIntermediateLayersIf true, keeps only outermost layer (ParaView-aligned)
Returns
Grown selection

Reference: vtkPVRenderViewSettings::GrowSelectionRemoveSeed vtkPVRenderViewSettings::GrowSelectionRemoveIntermediateLayers

References cvSelectionData::CELLS, cvSelectionData::count(), cvSelectionData::fieldAssociation(), cvSelectionData::ids(), cvSelectionData::isEmpty(), CVLog::PrintVerbose(), qSetFromVector(), and CVLog::Warning().

◆ intersectionOf()

cvSelectionData cvSelectionAlgebra::intersectionOf ( const cvSelectionData &  a,
const cvSelectionData &  b 
)
static

Compute intersection of two selections.

Parameters
aFirst selection
bSecond selection
Returns
Intersection result (A & B)

References a, areCompatible(), cvSelectionData::count(), CVLog::Error(), cvSelectionData::ids(), cvSelectionData::isEmpty(), CVLog::Print(), qSetFromVector(), qVectorFromSet(), and result.

Referenced by performOperation().

◆ operationComplete

void cvSelectionAlgebra::operationComplete ( const cvSelectionData &  result)
signal

Emitted when operation is complete.

◆ performOperation()

cvSelectionData cvSelectionAlgebra::performOperation ( Operation  op,
const cvSelectionData &  a,
const cvSelectionData &  b,
vtkPolyData *  polyData = nullptr 
)
static

Perform algebra operation on two selections.

Parameters
opOperation to perform
aFirst selection
bSecond selection (not used for COMPLEMENT)
polyDataMesh data (required for COMPLEMENT)
Returns
Result selection

References a, COMPLEMENT, complementOf(), DIFFERENCE, differenceOf(), CVLog::Error(), INTERSECTION, intersectionOf(), SYMMETRIC_DIFF, symmetricDifferenceOf(), UNION, and unionOf().

Referenced by cvViewSelectionManager::performAlgebraOperation().

◆ progressChanged

void cvSelectionAlgebra::progressChanged ( int  percentage)
signal

Emitted when filtering progress changes.

◆ shrinkPointSelection()

cvSelectionData cvSelectionAlgebra::shrinkPointSelection ( vtkPolyData *  polyData,
const cvSelectionData &  input,
int  iterations = 1 
)
static

Shrink point selection by removing boundary points.

Parameters
polyDataThe mesh data
inputInput selection (must be POINTS)
iterationsNumber of shrink iterations
Returns
Shrunk selection

References cvSelectionData::count(), cvSelectionData::fieldAssociation(), cvSelectionData::ids(), cvSelectionData::isEmpty(), cvSelectionData::POINTS, CVLog::PrintVerbose(), qSetFromVector(), and CVLog::Warning().

◆ shrinkSelection()

cvSelectionData cvSelectionAlgebra::shrinkSelection ( vtkPolyData *  polyData,
const cvSelectionData &  input,
int  iterations = 1 
)
static

Shrink selection by removing boundary elements.

Parameters
polyDataThe mesh data
inputInput selection (must be CELLS)
iterationsNumber of shrink iterations
Returns
Shrunk selection

References cvSelectionData::CELLS, cvSelectionData::count(), cvSelectionData::fieldAssociation(), cvSelectionData::ids(), cvSelectionData::isEmpty(), CVLog::PrintVerbose(), qSetFromVector(), and CVLog::Warning().

◆ symmetricDifferenceOf()

cvSelectionData cvSelectionAlgebra::symmetricDifferenceOf ( const cvSelectionData &  a,
const cvSelectionData &  b 
)
static

Compute symmetric difference of two selections.

Parameters
aFirst selection
bSecond selection
Returns
Symmetric difference result (A ^ B)

References a, areCompatible(), cvSelectionData::count(), CVLog::Error(), cvSelectionData::ids(), cvSelectionData::isEmpty(), CVLog::Print(), qSetFromVector(), qVectorFromSet(), and result.

Referenced by performOperation().

◆ unionOf()

cvSelectionData cvSelectionAlgebra::unionOf ( const cvSelectionData &  a,
const cvSelectionData &  b 
)
static

Compute union of two selections.

Parameters
aFirst selection
bSecond selection
Returns
Union result (A U B)

References a, areCompatible(), cvSelectionData::count(), CVLog::Error(), cvSelectionData::ids(), cvSelectionData::isEmpty(), CVLog::Print(), qSetFromVector(), qVectorFromSet(), and result.

Referenced by performOperation().


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