![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
Helper class for exporting selections to CloudViewer objects or files. More...
#include <cvSelectionExporter.h>
Classes | |
| struct | ExportOptions |
| Options for exporting selections. More... | |
Static Public Member Functions | |
| static ccMesh * | exportToMesh (vtkPolyData *polyData, const cvSelectionData &selectionData, const ExportOptions &options=ExportOptions()) |
| Export selected cells to ccMesh. More... | |
| static ccPointCloud * | exportToPointCloud (vtkPolyData *polyData, const cvSelectionData &selectionData, const ExportOptions &options=ExportOptions()) |
| Export selected points to ccPointCloud. More... | |
| static ccPointCloud * | exportFromSourceCloud (ccPointCloud *sourceCloud, const cvSelectionData &selectionData, const ExportOptions &options=ExportOptions()) |
| Export selected points directly from source ccPointCloud. More... | |
| static ccMesh * | exportFromSourceMesh (ccMesh *sourceMesh, const cvSelectionData &selectionData, const ExportOptions &options=ExportOptions()) |
| Export selected cells directly from source ccMesh. More... | |
| static bool | exportToFile (vtkPolyData *polyData, const cvSelectionData &selectionData, const QString &filename, bool writeAscii=false, bool compressed=false) |
| Export selection to file (uses CV_io module) More... | |
| static vtkPolyData * | extractSelection (vtkPolyData *polyData, const cvSelectionData &selectionData) |
| Extract selected geometry as new vtkPolyData. More... | |
| static QList< ccMesh * > | batchExportToMeshes (vtkPolyData *polyData, const QList< cvSelectionData > &selections, const QString &baseName="Selection") |
| Export multiple selections to meshes. More... | |
| static QList< ccPointCloud * > | batchExportToPointClouds (vtkPolyData *polyData, const QList< cvSelectionData > &selections, const QString &baseName="Selection") |
| Export multiple selections to point clouds. More... | |
| static int | batchExportToFiles (vtkPolyData *polyData, const QList< cvSelectionData > &selections, const QString &outputDir, const QString &format, const QString &baseName="selection", std::function< void(int)> progressCallback=nullptr) |
| Export multiple selections to files. More... | |
| static bool | exportNumbered (vtkPolyData *polyData, const cvSelectionData &selection, const QString &outputPath, int number) |
| Export selection with numbered naming. More... | |
| static bool | saveObjectToFileWithDialog (ccHObject *object, bool isMesh, QWidget *parent=nullptr) |
| Save a ccHObject to file with file dialog Uses QFileDialog to let user choose filename and format Remembers last used path and filter using QSettings. More... | |
Helper class for exporting selections to CloudViewer objects or files.
Provides functionality to convert VTK selections to:
Based on ParaView's selection extraction filters:
Definition at line 42 of file cvSelectionExporter.h.
|
static |
Export multiple selections to files.
| polyData | Source mesh data |
| selections | List of selections |
| outputDir | Output directory |
| format | File format ("obj", "ply", "stl", "bin") |
| baseName | Base name for files |
| progressCallback | Optional callback for progress updates (0-100) |
Definition at line 1064 of file cvSelectionExporter.cpp.
References CVLog::Error(), exportToFile(), filename, format, cvSelectionData::isEmpty(), CVLog::Print(), and CVLog::Warning().
|
static |
Export multiple selections to meshes.
| polyData | Source mesh data |
| selections | List of selections (all must be CELLS) |
| baseName | Base name for meshes (e.g., "Selection") |
Definition at line 942 of file cvSelectionExporter.cpp.
References cvSelectionData::CELLS, CVLog::Error(), exportToMesh(), name, cvSelectionExporter::ExportOptions::name, CVLog::Print(), and CVLog::Warning().
|
static |
Export multiple selections to point clouds.
| polyData | Source mesh data |
| selections | List of selections (all must be POINTS) |
| baseName | Base name for clouds |
Definition at line 1003 of file cvSelectionExporter.cpp.
References CVLog::Error(), exportToPointCloud(), name, cvSelectionExporter::ExportOptions::name, cvSelectionData::POINTS, CVLog::Print(), and CVLog::Warning().
|
static |
Export selected points directly from source ccPointCloud.
This method bypasses VTK→ccPointCloud conversion by using the source ccPointCloud's partialClone method directly with selected indices. This preserves all scalar fields, normals, RGB colors, etc.
| sourceCloud | Source point cloud (original data) |
| selectionData | Selection data (must be POINTS) |
| options | Export options |
Definition at line 178 of file cvSelectionExporter.cpp.
References cloudViewer::ReferenceCloud::addPointIndex(), cvSelectionExporter::ExportOptions::compressed, CVLog::Error(), cvSelectionData::fieldAssociation(), cvSelectionExporter::ExportOptions::filename, cvSelectionData::ids(), cvSelectionData::isEmpty(), cvSelectionExporter::ExportOptions::name, cvSelectionData::POINTS, CVLog::PrintVerbose(), cloudViewer::ReferenceCloud::reserve(), result, cvSelectionExporter::ExportOptions::saveToFile, cloudViewer::GenericCloud::size(), sourceCloud, CVLog::Warning(), cvSelectionExporter::ExportOptions::writeAscii, ccPointCloud::WRN_OUT_OF_MEM_FOR_COLORS, ccPointCloud::WRN_OUT_OF_MEM_FOR_FWF, ccPointCloud::WRN_OUT_OF_MEM_FOR_NORMALS, and ccPointCloud::WRN_OUT_OF_MEM_FOR_SFS.
|
static |
Export selected cells directly from source ccMesh.
This method bypasses VTK→ccMesh conversion by extracting triangles directly from the source ccMesh using selected cell indices.
| sourceMesh | Source mesh (original data) |
| selectionData | Selection data (must be CELLS) |
| options | Export options |
Definition at line 302 of file cvSelectionExporter.cpp.
References cvSelectionData::CELLS, ccDrawableObject::colorsShown(), cvSelectionExporter::ExportOptions::compressed, CVLog::Error(), cvSelectionData::fieldAssociation(), cvSelectionExporter::ExportOptions::filename, cvSelectionData::ids(), cvSelectionData::isEmpty(), ccGenericMesh::materialsShown(), cvSelectionExporter::ExportOptions::name, ccMesh::normalsShown(), ccMesh::partialClone(), CVLog::Print(), CVLog::PrintVerbose(), result, cvSelectionExporter::ExportOptions::saveToFile, ccDrawableObject::sfShown(), ccMesh::size(), CVLog::Warning(), and cvSelectionExporter::ExportOptions::writeAscii.
|
static |
Export selection with numbered naming.
| polyData | Source mesh data |
| selection | Selection data |
| outputPath | Full output path with number placeholder (%1) |
| number | File number |
Definition at line 1145 of file cvSelectionExporter.cpp.
References exportToFile(), filename, format, and cvSelectionData::isEmpty().
|
static |
Export selection to file (uses CV_io module)
| polyData | Source mesh data |
| selectionData | Selection data |
| filename | Output filename (extension determines format) |
| writeAscii | Use ASCII format if supported |
| compressed | Use compression if supported |
Definition at line 403 of file cvSelectionExporter.cpp.
References cvSelectionData::CELLS, compressed, CVLog::Error(), extractSelection(), cvSelectionData::fieldAssociation(), filename, cvSelectionData::isEmpty(), and CVLog::Print().
Referenced by batchExportToFiles(), and exportNumbered().
|
static |
Export selected cells to ccMesh.
| polyData | Source mesh data |
| selectionData | Selection data (must be CELLS) |
| options | Export options |
Definition at line 60 of file cvSelectionExporter.cpp.
References cvSelectionData::CELLS, cvSelectionExporter::ExportOptions::compressed, cvSelectionData::count(), CVLog::Error(), extractSelection(), cvSelectionData::fieldAssociation(), cvSelectionExporter::ExportOptions::filename, cvSelectionData::isEmpty(), cvSelectionExporter::ExportOptions::name, CVLog::Print(), cvSelectionExporter::ExportOptions::saveToFile, ccMesh::size(), CVLog::Warning(), and cvSelectionExporter::ExportOptions::writeAscii.
Referenced by batchExportToMeshes().
|
static |
Export selected points to ccPointCloud.
| polyData | Source mesh data |
| selectionData | Selection data (must be POINTS) |
| options | Export options |
Definition at line 117 of file cvSelectionExporter.cpp.
References cvSelectionExporter::ExportOptions::compressed, cvSelectionData::count(), CVLog::Error(), extractSelection(), cvSelectionData::fieldAssociation(), cvSelectionExporter::ExportOptions::filename, cvSelectionData::isEmpty(), cvSelectionExporter::ExportOptions::name, cvSelectionData::POINTS, CVLog::PrintVerbose(), cvSelectionExporter::ExportOptions::saveToFile, cloudViewer::PointCloudTpl< T >::size(), CVLog::Warning(), and cvSelectionExporter::ExportOptions::writeAscii.
Referenced by batchExportToPointClouds().
|
static |
Extract selected geometry as new vtkPolyData.
| polyData | Source mesh data |
| selectionData | Selection data |
Definition at line 454 of file cvSelectionExporter.cpp.
References a, CVLog::Error(), cvSelectionData::fieldAssociation(), cvSelectionData::isEmpty(), cvSelectionData::POINTS, CVLog::PrintVerbose(), result, cvSelectionData::vtkArray(), and CVLog::Warning().
Referenced by exportToFile(), exportToMesh(), and exportToPointCloud().
|
static |
Save a ccHObject to file with file dialog Uses QFileDialog to let user choose filename and format Remembers last used path and filter using QSettings.
| object | Object to save |
| isMesh | True if object is a mesh, false if point cloud |
| parent | Parent widget for dialog (can be nullptr) |
Definition at line 844 of file cvSelectionExporter.cpp.
References FileIOFilter::SaveParameters::alwaysDisplaySaveDialog, CC_FERR_NO_ERROR, CVLog::Error(), FileIOFilter::GetFilters(), CV_TYPES::MESH, FileIOFilter::SaveParameters::parentWidget, CV_TYPES::POINT_CLOUD, CVLog::Print(), result, and FileIOFilter::SaveToFile().