 |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Go to the documentation of this file.
12 #include <QtCore/QObject>
13 #include <QtCore/QHash>
14 #include <QtCore/QMap>
15 #include <QtCore/QString>
23 #include <vtkSmartPointer.h>
73 FIELD_ASSOCIATION_CELLS = 0,
74 FIELD_ASSOCIATION_POINTS = 1
95 static bool promptUser(
const QString& settingsKey,
97 const QString& message,
98 QWidget* parent =
nullptr);
130 vtkSelection* selection, FieldAssociation fieldAssociation);
141 static QMap<vtkProp*, vtkDataSet*> extractDataFromSelection(
142 vtkSelection* selection);
152 static vtkDataSet* getPrimaryDataFromSelection(vtkSelection* selection);
166 vtkSelection* selection, FieldAssociation fieldAssociation);
176 static bool pointInPolygon(
const int point[2],
178 vtkIdType numPoints);
188 vtkSelection* selection, vtkIntArray*
polygon, vtkIdType numPoints);
196 return m_lastSelection;
203 void setEnableCaching(
bool enable);
213 int getCacheSize()
const;
214 int getCacheHits()
const;
215 int getCacheMisses()
const;
225 void enterSelectionMode();
230 void exitSelectionMode();
244 void invalidateCachedSelection();
265 void setPointPickingRadius(
unsigned int radius);
296 : valid(false), attributeID(-1), prop(nullptr), polyData(nullptr) {}
310 PixelSelectionInfo getPixelSelectionInfo(
int x,
int y,
bool selectCells);
326 vtkIdType fastPreSelectAt(
int x,
int y,
bool selectCells);
332 bool hasCachedBuffers()
const;
341 bool captureBuffersForFastPreSelection();
390 OPERATION_DEFAULT = 0,
391 OPERATION_ADDITION = 1,
392 OPERATION_SUBTRACTION = 2,
405 CombineOperation operation);
412 void selectionCompleted(vtkSelection* selection);
425 int region[4], FieldAssociation fieldAssociation);
436 void cacheSelection(
const QString& key, vtkSelection* selection);
441 QString generateCacheKey(
int region[4], SelectionType
type)
const;
446 FieldAssociation getFieldAssociation(SelectionType
type)
const;
457 FieldAssociation fieldAssoc,
458 const QString& errorContext);
462 vtkRenderer* m_renderer;
472 bool m_cachingEnabled;
473 QHash<QString, vtkSmartPointer<vtkSelection>> m_selectionCache;
480 static const int MAX_CACHE_SIZE = 50;
483 bool m_inSelectionMode =
false;
487 bool m_invalidating =
false;
494 unsigned int m_pointPickingRadius =
vtkSmartPointer< vtkSelection > executePolygonSelection(vtkIntArray *polygon, SelectionType type)
Execute a polygon selection.
Definition: cvSelectionPipeline.cpp:144
void selectionCompleted(vtkSelection *selection)
Emitted when selection is completed.
void setVisualizer(PclUtils::PCLVis *viewer)
Set the visualizer for selection operations.
Definition: cvSelectionPipeline.cpp:74
int actorCount() const
Get number of actors in this selection.
Definition: cvSelectionData.h:248
normal_z x
Definition: my_point_types.h:165
@ POLYGON_POINTS
Polygon points.
Definition: cvSelectionPipeline.h:66
PixelSelectionInfo()
Definition: cvSelectionPipeline.h:295
bool copy
Definition: VtkUtils.cpp:74
void invalidateCachedSelection()
Clear selection cache and invalidate cached buffers.
Definition: cvSelectionPipeline.cpp:491
cvSelectionData selectCellsInPolygon(vtkIntArray *polygon)
Select cells in polygon region.
Definition: cvSelectionPipeline.cpp:942
FieldAssociation fieldAssociation() const
Get field association.
Definition: cvSelectionData.h:193
GraphType data
Definition: graph_cut.cc:138
void setPointPickingRadius(unsigned int radius)
Point Picking Radius support (ParaView-aligned)
Definition: cvSelectionPipeline.cpp:516
@ FRUSTUM_CELLS
Frustum cells.
Definition: cvSelectionPipeline.h:63
static bool PrintVerbose(const char *format,...)
Prints out a verbose formatted message in console.
Definition: CVLog.cpp:103
bool valid
Definition: cvSelectionPipeline.h:290
vtkRenderer * getCurrentRenderer(int viewport=0)
Definition: PCLVis.cpp:2924
#define signals
Definition: PythonPlugin.cpp:26
vtkSmartPointer< vtkSelection > getLastSelection() const
Get the last selection result.
Definition: cvSelectionPipeline.h:195
static bool Print(const char *format,...)
Prints out a formatted message in console.
Definition: CVLog.cpp:113
FieldAssociation
Field association type.
Definition: cvSelectionPipeline.h:72
unsigned int getPointPickingRadius() const
Get the current point picking radius.
Definition: cvSelectionPipeline.h:271
SelectionType
Selection type.
Definition: cvSelectionPipeline.h:60
Definition: CustomContextItem.cpp:18
@ FRUSTUM_POINTS
Frustum points.
Definition: cvSelectionPipeline.h:64
static bool promptUser(const QString &settingsKey, const QString &title, const QString &message, QWidget *parent=nullptr)
Shows instruction dialog if not disabled by user (ParaView-style)
Definition: cvSelectionPipeline.cpp:1289
core::Tensor result
Definition: VtkUtils.cpp:76
static QMap< vtkProp *, vtkDataSet * > extractDataFromSelection(vtkSelection *selection)
Get data objects from selection (ParaView-style)
Definition: cvSelectionPipeline.cpp:716
static bool pointInPolygon(const int point[2], vtkIntArray *polygon, vtkIdType numPoints)
Test if a 2D point is inside a polygon (ParaView-aligned) Uses the ray casting algorithm for robust p...
Definition: cvSelectionPipeline.cpp:1124
void clearCache()
Clear the selection cache.
Definition: cvSelectionPipeline.cpp:321
CombineOperation
Selection combination methods (ParaView-style)
Definition: cvSelectionPipeline.h:389
int size
Definition: FileIOFactory.cpp:130
vtkSmartPointer< vtkSelection > refinePolygonSelection(vtkSelection *selection, vtkIntArray *polygon, vtkIdType numPoints)
Refine polygon selection with point-in-polygon testing.
Definition: cvSelectionPipeline.cpp:1160
normal_z y
Definition: my_point_types.h:168
double zValue
Z-buffer depth value (for front-to-back ordering)
Definition: cvSelectionData.h:112
Fast Pre-Selection API (ParaView-aligned)
Definition: cvSelectionPipeline.h:289
bool hasCachedBuffers() const
Check if fast pre-selection buffers are available.
Definition: cvSelectionPipeline.cpp:340
@ OPERATION_ADDITION
Union (sel1 | sel2)
Definition: cvSelectionPipeline.h:391
bool isEmpty() const
Check if selection is empty.
Definition: cvSelectionData.cpp:114
void setEnableCaching(bool enable)
Enable/disable selection caching.
Definition: cvSelectionPipeline.cpp:308
PixelSelectionInfo getPixelSelectionInfo(int x, int y, bool selectCells)
Get complete pixel selection information at a screen position.
Definition: cvSelectionPipeline.cpp:394
cvActorSelectionInfo actorInfo(int index=0) const
Get actor info at index.
Definition: cvSelectionData.cpp:173
vtkSmartPointer< vtkSelection > executeRectangleSelection(int region[4], SelectionType type)
Execute a rectangular selection.
Definition: cvSelectionPipeline.cpp:94
void exitSelectionMode()
Exit selection mode and release cached buffers.
Definition: cvSelectionPipeline.cpp:473
Selection pipeline abstraction layer.
Definition: cvSelectionPipeline.h:53
@ FIELD_ASSOCIATION_CELLS
Definition: cvSelectionPipeline.h:73
static cvSelectionData combineSelections(const cvSelectionData &sel1, const cvSelectionData &sel2, CombineOperation operation)
Combine two selections.
Definition: cvSelectionPipeline.cpp:983
void errorOccurred(const QString &message)
Emitted when an error occurs.
vtkProp * prop
Definition: cvSelectionPipeline.h:292
vtkPolyData * polyData
The associated polyData (weak pointer)
Definition: cvSelectionData.h:111
vtkPolyData * polyData
Definition: cvSelectionPipeline.h:293
static vtkDataSet * getPrimaryDataFromSelection(vtkSelection *selection)
Get the primary data object from selection.
Definition: cvSelectionPipeline.cpp:768
Eigen::Vector3d origin
Definition: VoxelGridIO.cpp:26
Hardware selector with ParaView-style buffer caching.
Definition: cvHardwareSelector.h:45
vtkIdType attributeID
Definition: cvSelectionPipeline.h:291
vtkIdType fastPreSelectAt(int x, int y, bool selectCells)
Perform fast pre-selection at a screen position.
Definition: cvSelectionPipeline.cpp:451
static cvSelectionData convertToCvSelectionData(vtkSelection *selection, FieldAssociation fieldAssociation)
Convert vtkSelection to cvSelectionData with actor info (ParaView-style)
Definition: cvSelectionPipeline.cpp:804
@ OPERATION_TOGGLE
XOR (sel1 ^ sel2)
Definition: cvSelectionPipeline.h:393
@ OPERATION_DEFAULT
Replace (sel2 only)
Definition: cvSelectionPipeline.h:390
void enterSelectionMode()
Enter selection mode (ParaView-style cache optimization)
Definition: cvSelectionPipeline.cpp:459
Encapsulates selection data without exposing VTK types.
Definition: cvSelectionData.h:136
int count
Definition: FileIOFactory.cpp:132
static bool Warning(const char *format,...)
Prints out a formatted warning message in console.
Definition: CVLog.cpp:133
#define QPCL_ENGINE_LIB_API
Definition: qPCL.h:15
cvSelectionData selectCellsOnSurface(const int region[4])
High-level selection API (ParaView-style)
Definition: cvSelectionPipeline.cpp:923
bool captureBuffersForFastPreSelection()
Capture buffers for fast pre-selection.
Definition: cvSelectionPipeline.cpp:347
boost::geometry::model::polygon< point_xy > polygon
Definition: TreeIso.cpp:37
@ POLYGON_CELLS
Polygon cells.
Definition: cvSelectionPipeline.h:65
@ OPERATION_SUBTRACTION
Difference (sel1 & !sel2)
Definition: cvSelectionPipeline.h:392
vtkSmartPointer< vtkIdTypeArray > vtkArray() const
Get the underlying VTK array (for internal use only)
Definition: cvSelectionData.h:204
Definition: ccGuiPythonInstance.h:15
static vtkSmartPointer< vtkIdTypeArray > extractSelectionIds(vtkSelection *selection, FieldAssociation fieldAssociation)
Extract selected IDs from vtkSelection.
Definition: cvSelectionPipeline.cpp:275
@ SURFACE_CELLS
Surface cells (rectangle)
Definition: cvSelectionPipeline.h:61
FieldAssociation
Field association for selection.
Definition: cvSelectionData.h:141
bool isInSelectionMode() const
Check if currently in selection mode.
Definition: cvSelectionPipeline.h:235
cvSelectionData selectPointsOnSurface(const int region[4])
Select points on surface in a rectangular region.
Definition: cvSelectionPipeline.cpp:932
int getCacheSize() const
Get cache statistics.
Definition: cvSelectionPipeline.cpp:329
int getCacheMisses() const
Definition: cvSelectionPipeline.cpp:337
~cvSelectionPipeline() override
Definition: cvSelectionPipeline.cpp:64
@ SURFACE_POINTS
Surface points (rectangle)
Definition: cvSelectionPipeline.h:62
char type
Definition: FileIOFactory.cpp:131
@ FIELD_ASSOCIATION_POINTS
Definition: cvSelectionPipeline.h:74
cvSelectionPipeline(QObject *parent=nullptr)
Definition: cvSelectionPipeline.cpp:53
Information about a selected actor/representation.
Definition: cvSelectionData.h:109
vtkActor * actor
The selected actor (weak pointer)
Definition: cvSelectionData.h:110
cvSelectionData selectPointsInPolygon(vtkIntArray *polygon)
Select points in polygon region.
Definition: cvSelectionPipeline.cpp:961
int getCacheHits() const
Definition: cvSelectionPipeline.cpp:334