11 #pragma warning(disable : 4996)
39 #include <vtkBoundingBox.h>
42 #include <pcl/visualization/pcl_visualizer.h>
50 class vtkAbstractWidget;
51 class vtkRenderWindow;
54 class vtkCubeAxesActor;
55 class vtkCameraOrientationWidget;
63 class ecvPointpickingTools;
81 public pcl::visualization::PCLVisualizer {
87 const std::string& viewerName =
"",
88 bool initIterator =
false,
90 char** argv =
nullptr);
95 const std::string& viewerName =
"",
96 bool initIterator =
false,
98 char** argv =
nullptr);
106 void configCenterAxes();
108 void configInteractorStyle(
115 void hidePclMarkerAxes();
116 bool pclMarkerAxesShown();
117 void showPclMarkerAxes(vtkRenderWindowInteractor* interactor =
nullptr);
118 void hideOrientationMarkerWidgetAxes();
119 void showOrientationMarkerWidgetAxes(vtkRenderWindowInteractor* interactor);
120 void toggleOrientationMarkerWidgetAxes();
144 void setupInteractor(vtkRenderWindowInteractor* iren, vtkRenderWindow* win);
149 return (interactor_);
153 pcl::visualization::Camera getCamera(
int viewport = 0);
156 void setModelViewMatrix(
const ccGLMatrixd& viewMat,
int viewport = 0);
157 double getParallelScale(
int viewport = 0);
158 void setParallelScale(
double scale,
int viewport = 0);
160 void setOrthoProjection(
int viewport = 0);
161 void setPerspectiveProjection(
int viewport = 0);
162 bool getPerspectiveState(
int viewport = 0);
166 m_autoUpdateCameraPos = state;
178 void getCenterOfRotation(
double center[3]);
182 void resetCenterOfRotation(
int viewport = 0);
184 static void ExpandBounds(
double bounds[6], vtkMatrix4x4* matrix);
192 void setCenterOfRotation(
double x,
double y,
double z);
194 setCenterOfRotation(xyz[0], xyz[1], xyz[2]);
197 void setRotationFactor(
double factor);
198 double getRotationFactor();
202 void setCenterAxesVisibility(
bool);
206 virtual void setCamera2DManipulators(
const int manipulators[9]);
207 virtual void setCamera3DManipulators(
const int manipulators[9]);
209 const int manipulators[9]);
210 virtual void setCamera2DMouseWheelMotionFactor(
double factor);
211 virtual void setCamera3DMouseWheelMotionFactor(
double factor);
216 virtual void updateCenterAxes();
222 void synchronizeGeometryBounds(
int viewport = 0);
225 double getGLDepth(
int x,
int y);
227 double getCameraFocalDistance(
int viewport = 0);
228 void setCameraFocalDistance(
double focal_distance,
int viewport = 0);
237 void zoomCamera(
double zoomFactor,
int viewport = 0);
239 void getProjectionTransformMatrix(Eigen::Matrix4d& proj);
241 void getModelViewTransformMatrix(Eigen::Matrix4d& view);
252 void resetCameraClippingRange(
int viewport = 0);
254 this->resetCameraClippingRange(0);
256 void resetCamera(
const ccBBox* bbox);
257 void resetCamera(
double xMin,
264 pcl::visualization::PCLVisualizer::resetCamera();
267 resetCamera(bounds[0], bounds[1], bounds[2], bounds[3], bounds[4],
270 void getReasonableClippingRange(
double range[2],
int viewport = 0);
271 void expandBounds(
double bounds[6], vtkMatrix4x4* matrix);
272 void setCameraViewAngle(
double viewAngle,
int viewport = 0);
277 const PCLTextureMesh::Ptr& textureMesh);
279 const PCLPolygon::Ptr& pclPolygon,
289 const PCLCloud::Ptr& smCloud);
292 void hideShowActors(
bool visibility,
293 const std::string& viewID,
295 void hideShowWidgets(
bool visibility,
296 const std::string& viewID,
301 bool addCaption(
const std::string& text,
309 const std::string& viewID =
"caption",
310 bool anchorDragable =
false,
313 bool updateCaption(
const std::string& text,
321 const std::string& viewID =
"caption",
331 bool getCaptionPosition(
const std::string& viewID,
335 bool addPolyline(
const PCLPolygon::ConstPtr pclPolygon,
340 const std::string&
id =
"multiline",
350 const std::string&
id,
362 const std::string&
id,
375 const std::string&
id,
378 bool enable_cache =
true);
392 const std::string& mtl_path,
393 const std::string&
id,
395 int max_texture_size = 4096,
396 bool use_mipmaps =
true,
397 bool enable_cache =
true);
418 const std::string&
id =
"cube",
420 bool addOrientedCube(
const Eigen::Vector3f& translation,
428 const std::string&
id =
"cube",
431 const std::string&
id =
"cube",
437 std::unique_ptr<renders::TextureRenderManager> texture_render_manager_;
441 std::map<std::string, vtkSmartPointer<vtkMatrix4x4>> transformation_map_;
444 void setPointSize(
const unsigned char pointSize,
445 const std::string& viewID,
447 void setScalarFieldName(
const std::string& viewID,
448 const std::string& scalarName,
458 void addScalarFieldToVTK(
const std::string& viewID,
460 int scalarFieldIndex,
473 void syncAllScalarFieldsToVTK(
const std::string& viewID,
488 void setCurrentSourceObject(
ccHObject* obj,
const std::string& viewID);
494 void removeSourceObject(
const std::string& viewID);
501 ccHObject* getSourceObject(
const std::string& viewID)
const;
508 ccPointCloud* getSourceCloud(
const std::string& viewID)
const;
515 ccMesh* getSourceMesh(
const std::string& viewID)
const;
522 bool hasSourceObject(
const std::string& viewID)
const;
524 void setPointCloudUniqueColor(
double r,
527 const std::string& viewID,
529 void resetScalarColor(
const std::string& viewID,
532 void setShapeUniqueColor(
float r,
535 const std::string& viewID,
537 void setLineWidth(
const unsigned char lineWidth,
538 const std::string& viewID,
541 const std::string& viewID,
543 void setLightMode(
const std::string& viewID,
int viewport = 0);
544 void setPointCloudOpacity(
double opacity,
545 const std::string& viewID,
547 void setShapeOpacity(
double opacity,
548 const std::string& viewID,
564 void setMeshOpacity(
double opacity,
565 const std::string& viewID,
574 const std::string& viewID,
577 const std::string& viewID,
581 getPCLInteractorStyle();
582 vtkActor* getActorById(
const std::string& viewId);
583 vtkProp* getPropById(
const std::string& viewId);
585 const std::string& viewId);
586 std::string getIdByActor(vtkProp* actor);
587 vtkAbstractWidget* getWidgetById(
const std::string& viewId);
593 vtkRenderer* getCurrentRenderer(
int viewport = 0);
601 return (m_widget_map->find(
id) != m_widget_map->end() ||
602 m_prop_map->find(
id) != m_prop_map->end());
615 return TwoDInteractorStyle;
620 return ThreeDInteractorStyle;
640 bool removeWidgets(
const std::string& viewId,
int viewport);
641 void removePointClouds(
const std::string& viewId,
int viewport = 0);
642 void removeShapes(
const std::string& viewId,
int viewport = 0);
643 void removeMesh(
const std::string& viewId,
int viewport = 0);
644 void removeText2D(
const std::string& viewId,
int viewport = 0);
645 void removeText3D(
const std::string& viewId,
int viewport = 0);
646 void removeALL(
int viewport = 0);
649 void registerMouse();
650 void registerKeyboard();
651 void registerAreaPicking();
652 void registerPointPicking();
654 void registerInteractorStyle(
bool useDefault =
false);
656 void pointPickingProcess(
const pcl::visualization::PointPickingEvent&
event,
658 void areaPickingEventProcess(
659 const pcl::visualization::AreaPickingEvent&
event,
void* args);
660 void mouseEventProcess(
const pcl::visualization::MouseEvent&
event,
662 void keyboardEventProcess(
const pcl::visualization::KeyboardEvent&
event,
669 m_pointPickingEnabled = state;
672 setPointPickingEnabled(!isPointPickingEnabled());
677 m_areaPickingEnabled = state;
682 m_actorPickingEnabled = state;
685 setActorPickingEnabled(!isActorPickingEnabled());
688 void toggleAreaPicking();
689 void exitCallbackProcess();
690 void setAreaPickingMode(
bool state);
691 vtkActor* pickActor(
double x,
double y);
692 std::string pickItem(
double x0 = -1,
697 QImage renderToImage(
int zoomFactor = 1,
698 bool renderOverlayItems =
false,
727 void setLightIntensity(
double intensity);
733 double getLightIntensity()
const;
750 void SetDataAxesGridProperties(
const std::string& viewID,
758 void GetDataAxesGridProperties(
const std::string& viewID,
765 void RemoveDataAxesGrid(
const std::string& viewID);
775 void ToggleCameraOrientationWidget(
bool show);
781 bool IsCameraOrientationWidgetShown()
const;
pcl::PCLPointCloud2 PCLCloud
pcl::TextureMesh PCLTextureMesh
bool isActorPickingEnabled()
vtkBoundingBox GeometryBounds
std::map< std::string, ccHObject * > m_sourceObjectMap
bool isAreaPickingEnabled()
void clearTextureCache()
Clear texture cache.
vtkSmartPointer< vtkCameraOrientationWidget > m_cameraOrientationWidget
bool m_pointPickingEnabled
WidgetActorMapPtr m_widget_map
Internal list with actor pointers and name IDs for widgets.
PropActorMapPtr getPropActorMap()
Return a pointer to the PropActorMap this visualizer uses.
bool isPointPickingEnabled()
vtkSmartPointer< VTKExtensions::vtkCustomInteractorStyle > get2DInteractorStyle()
bool addTextureMeshFromOBJAdvanced(const std::string &obj_path, const std::string &mtl_path, const std::string &id, int viewport=0, int max_texture_size=4096, bool use_mipmaps=true, bool enable_cache=true)
Load multi-texture mesh from OBJ file (advanced options)
bool getAutoUpateCameraPos()
vtkSmartPointer< VTKExtensions::vtkCustomInteractorStyle > ThreeDInteractorStyle
std::map< std::string, vtkSmartPointer< vtkCubeAxesActor > > m_dataAxesGridMap
void internalResetCameraClippingRange()
vtkSmartPointer< VTKExtensions::vtkPVCenterAxesActor > m_centerAxes
void resetCamera(double bounds[6])
bool m_autoUpdateCameraPos
vtkSmartPointer< vtkOrientationMarkerWidget > m_axes_widget
vtkSmartPointer< pcl::visualization::PCLVisualizerInteractorStyle > m_interactorStyle
bool m_areaPickingEnabled
vtkBoundingBox getVisibleGeometryBounds()
vtkSmartPointer< VTKExtensions::vtkCustomInteractorStyle > get3DInteractorStyle()
vtkSmartPointer< VTKExtensions::vtkCustomInteractorStyle > TwoDInteractorStyle
void setAreaPickingEnabled(bool state)
void setAutoUpateCameraPos(bool state)
vtkSmartPointer< vtkRenderWindowInteractor > getRenderWindowInteractor()
Get a pointer to the current interactor style used.
void setPointPickingEnabled(bool state)
WidgetActorMapPtr getWidgetActorMap()
Return a pointer to the WidgetActorMap this visualizer uses.
std::vector< int > m_selected_slice
vtkSmartPointer< vtkPropPicker > m_propPicker
void getTextureCacheInfo(size_t &count, size_t &memory_bytes) const
Get texture cache information.
void setCenterOfRotation(double xyz[3])
vtkSmartPointer< vtkPointPicker > m_point_picker
bool containWidget(const std::string &id) const
Check if the widgets or props with the given id was already added to this visualizer.
void setActorPickingEnabled(bool state)
bool addTextureMeshFromOBJ(const std::string &obj_path, const std::string &id, int viewport=0, int quality=2, bool enable_cache=true)
Load multi-texture mesh from OBJ file (enhanced version)
void interactorPickedEvent(vtkActor *actor)
PropActorMapPtr m_prop_map
Internal list with actor pointers and name IDs for props.
void togglePointPicking()
bool m_actorPickingEnabled
vtkSmartPointer< vtkAreaPicker > m_area_picker
void toggleActorPicking()
Texture rendering manager.
vtkCustomInteractorStyle defines an unique, custom VTK based interactory style for PCL Visualizer app...
Double version of ccGLMatrixTpl.
Hierarchical CLOUDVIEWER Object.
Mesh (triangle) material.
Mesh (triangle) material.
A 3D cloud and its associated features (color, normals, scalar fields, etc.)
Generic sensor interface.
LineSet define a sets of lines in 3D. A typical application is to display the point cloud corresponde...
Generic visualizer 3D interface.
std::shared_ptr< PropActorMap > PropActorMapPtr
std::shared_ptr< PCLVis > PCLVisPtr
std::shared_ptr< WidgetActorMap > WidgetActorMapPtr
Generic file read and write utility for python interface.
#define QPCL_ENGINE_LIB_API
Data Axes Grid properties structure Encapsulates all properties for vtkCubeAxesActor configuration.