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:
Collaboration diagram for cvSelectionAlgebra:

Public Types

enum class  Operation {
  UNION , INTERSECTION , DIFFERENCE , SYMMETRIC_DIFF ,
  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.

Definition at line 46 of file cvSelectionAlgebra.h.

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 

Definition at line 57 of file cvSelectionAlgebra.h.

Constructor & Destructor Documentation

◆ cvSelectionAlgebra()

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

Definition at line 32 of file cvSelectionAlgebra.cpp.

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

Definition at line 405 of file cvSelectionAlgebra.cpp.

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)

Definition at line 165 of file cvSelectionAlgebra.cpp.

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)

Definition at line 92 of file cvSelectionAlgebra.cpp.

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

Definition at line 462 of file cvSelectionAlgebra.cpp.

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)

Definition at line 370 of file cvSelectionAlgebra.cpp.

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.

Definition at line 739 of file cvSelectionAlgebra.cpp.

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

Definition at line 240 of file cvSelectionAlgebra.cpp.

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)

Definition at line 63 of file cvSelectionAlgebra.cpp.

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

Definition at line 211 of file cvSelectionAlgebra.cpp.

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

Definition at line 831 of file cvSelectionAlgebra.cpp.

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

Definition at line 320 of file cvSelectionAlgebra.cpp.

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)

Definition at line 124 of file cvSelectionAlgebra.cpp.

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)

Definition at line 37 of file cvSelectionAlgebra.cpp.

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: