ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
pcl_context_item.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 #include <pcl/pcl_macros.h>
11 #include <vtkContextItem.h>
12 #include <vtkSmartPointer.h>
13 
14 #include <vector>
15 class vtkImageData;
16 class vtkContext2D;
17 
18 namespace pcl {
19 namespace visualization {
25 struct PCL_EXPORTS PCLContextItem : public vtkContextItem {
26  vtkTypeMacro(PCLContextItem, vtkContextItem);
27  static PCLContextItem* New();
28  bool Paint(vtkContext2D*) override { return (false); };
29  void setColors(unsigned char r, unsigned char g, unsigned char b);
30  void setColors(unsigned char rgb[3]) {
31  memcpy(colors, rgb, 3 * sizeof(unsigned char));
32  }
33  void setOpacity(double opacity) { SetOpacity(opacity); };
34  unsigned char colors[3];
35  std::vector<float> params;
36 };
37 
43 struct PCL_EXPORTS PCLContextImageItem : public vtkContextItem {
46 
48  bool Paint(vtkContext2D* painter) override;
49  void set(float _x, float _y, vtkImageData* _image);
51  float x, y;
52 };
53 
54 namespace context_items {
55 struct PCL_EXPORTS Point : public PCLContextItem {
57  static Point* New();
58  bool Paint(vtkContext2D* painter) override;
59  virtual void set(float _x, float _y);
60 };
61 
62 struct PCL_EXPORTS Line : public PCLContextItem {
64  static Line* New();
65  bool Paint(vtkContext2D* painter) override;
66  virtual void set(float _x_1, float _y_1, float _x_2, float _y_2);
67 };
68 
69 struct PCL_EXPORTS Circle : public PCLContextItem {
71  static Circle* New();
72  bool Paint(vtkContext2D* painter) override;
73  virtual void set(float _x, float _y, float _r);
74 };
75 
76 struct PCL_EXPORTS Disk : public Circle {
78  static Disk* New();
79  bool Paint(vtkContext2D* painter) override;
80 };
81 
82 struct PCL_EXPORTS Rectangle : public PCLContextItem {
84  static Rectangle* New();
85  bool Paint(vtkContext2D* painter) override;
86  virtual void set(float _x, float _y, float _w, float _h);
87 };
88 
89 struct PCL_EXPORTS FilledRectangle : public Rectangle {
91  static FilledRectangle* New();
92  bool Paint(vtkContext2D* painter) override;
93 };
94 
95 struct PCL_EXPORTS Points : public PCLContextItem {
97  static Points* New();
98  bool Paint(vtkContext2D* painter) override;
99  void set(const std::vector<float>& _xy) { params = _xy; }
100 };
101 
102 struct PCL_EXPORTS Polygon : public Points {
104  static Polygon* New();
105  bool Paint(vtkContext2D* painter) override;
106 };
107 
108 struct PCL_EXPORTS Text : public PCLContextItem {
110  static Text* New();
111  bool Paint(vtkContext2D* painter) override;
112  virtual void set(float x, float y, const std::string& _text);
113  std::string text;
114 };
115 
116 struct PCL_EXPORTS Markers : public Points {
118  static Markers* New();
119  bool Paint(vtkContext2D* painter) override;
120  void setSize(float _size) { size = _size; }
121  void setPointColors(unsigned char r, unsigned char g, unsigned char b);
122  void setPointColors(unsigned char rgb[3]);
123  float size;
124  unsigned char point_colors[3];
125 };
126 } // namespace context_items
127 } // namespace visualization
128 } // namespace pcl
int size
double colors[3]
normal_z y
normal_z rgb
normal_z x
vtkTypeMacro(PCLContextImageItem, vtkContextItem)
static PCLContextImageItem * New()
vtkSmartPointer< vtkImageData > image
void setColors(unsigned char rgb[3])
bool Paint(vtkContext2D *) override
static PCLContextItem * New()
vtkTypeMacro(PCLContextItem, vtkContextItem)
void set(const std::vector< float > &_xy)