Point Cloud Library (PCL) 1.12.0
Loading...
Searching...
No Matches
pcl_context_item.h
1/*
2 * Software License Agreement (BSD License)
3 *
4 * Point Cloud Library (PCL) - www.pointclouds.org
5 * Copyright (c) 2012-, Open Perception, Inc.
6 *
7 * All rights reserved.
8 *
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted provided that the following conditions
11 * are met:
12 *
13 * * Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * * Redistributions in binary form must reproduce the above
16 * copyright notice, this list of conditions and the following
17 * disclaimer in the documentation and/or other materials provided
18 * with the distribution.
19 * * Neither the name of the copyright holder(s) nor the names of its
20 * contributors may be used to endorse or promote products derived
21 * from this software without specific prior written permission.
22 *
23 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
26 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
27 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
28 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
29 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
30 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
33 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
34 * POSSIBILITY OF SUCH DAMAGE.
35 *
36 */
37
38#pragma once
39
40#include <pcl/pcl_macros.h>
41#include <vtkContextItem.h>
42#include <vector>
43
44template <typename T> class vtkSmartPointer;
45class vtkImageData;
46class vtkContext2D;
47
48namespace pcl
49{
50 namespace visualization
51 {
52 /** Struct PCLContextItem represents our own custom version of vtkContextItem, used by
53 * the ImageViewer class.
54 *
55 * \author Nizar Sallem
56 */
57 struct PCL_EXPORTS PCLContextItem : public vtkContextItem
58 {
59 vtkTypeMacro (PCLContextItem, vtkContextItem);
61 bool Paint (vtkContext2D *) override { return (false); };
62 void setColors (unsigned char r, unsigned char g, unsigned char b);
63 void setColors (unsigned char rgb[3]) { memcpy (colors, rgb, 3 * sizeof (unsigned char)); }
64 void setOpacity (double opacity) { SetOpacity (opacity); };
65 unsigned char colors[3];
66 std::vector<float> params;
67 };
68
69 /** Struct PCLContextImageItem a specification of vtkContextItem, used to add an image to the
70 * scene in the ImageViewer class.
71 *
72 * \author Nizar Sallem
73 */
74 struct PCL_EXPORTS PCLContextImageItem : public vtkContextItem
75 {
78
80 bool Paint (vtkContext2D *painter) override;
81 void set (float _x, float _y, vtkImageData *_image);
83 float x, y;
84 };
85
86 namespace context_items
87 {
88 struct PCL_EXPORTS Point : public PCLContextItem
89 {
91 static Point *New();
92 bool Paint (vtkContext2D *painter) override;
93 virtual void set (float _x, float _y);
94 };
95
96 struct PCL_EXPORTS Line : public PCLContextItem
97 {
99 static Line *New();
100 bool Paint (vtkContext2D *painter) override;
101 virtual void set (float _x_1, float _y_1, float _x_2, float _y_2);
102 };
103
104 struct PCL_EXPORTS Circle : public PCLContextItem
105 {
107 static Circle *New();
108 bool Paint (vtkContext2D *painter) override;
109 virtual void set (float _x, float _y, float _r);
110 };
111
112 struct PCL_EXPORTS Disk : public Circle
113 {
115 static Disk *New();
116 bool Paint (vtkContext2D *painter) override;
117 };
118
119 struct PCL_EXPORTS Rectangle : public PCLContextItem
120 {
122 static Rectangle *New();
123 bool Paint (vtkContext2D *painter) override;
124 virtual void set (float _x, float _y, float _w, float _h);
125 };
126
127 struct PCL_EXPORTS FilledRectangle : public Rectangle
128 {
131 bool Paint (vtkContext2D *painter) override;
132 };
133
134 struct PCL_EXPORTS Points : public PCLContextItem
135 {
137 static Points *New();
138 bool Paint (vtkContext2D *painter) override;
139 void set (const std::vector<float>& _xy) { params = _xy; }
140 };
141
142 struct PCL_EXPORTS Polygon : public Points
143 {
145 static Polygon *New();
146 bool Paint (vtkContext2D *painter) override;
147 };
148
149 struct PCL_EXPORTS Text : public PCLContextItem
150 {
152 static Text *New ();
153 bool Paint (vtkContext2D *painter) override;
154 virtual void set (float x, float y, const std::string& _text);
155 std::string text;
156 };
157
158 struct PCL_EXPORTS Markers : public Points
159 {
161 static Markers *New ();
162 bool Paint (vtkContext2D *painter) override;
163 void setSize (float _size) { size = _size; }
164 void setPointColors (unsigned char r, unsigned char g, unsigned char b);
165 void setPointColors (unsigned char rgb[3]);
166 float size;
167 unsigned char point_colors[3];
168 };
169 }
170 }
171}
Iterator class for point clouds with or without given indices.
Defines all the PCL and non-PCL macros used.
Struct PCLContextImageItem a specification of vtkContextItem, used to add an image to the scene in th...
static PCLContextImageItem * New()
void set(float _x, float _y, vtkImageData *_image)
bool Paint(vtkContext2D *painter) override
vtkTypeMacro(PCLContextImageItem, vtkContextItem)
vtkSmartPointer< vtkImageData > image
Struct PCLContextItem represents our own custom version of vtkContextItem, used by the ImageViewer cl...
void setColors(unsigned char r, unsigned char g, unsigned char b)
void setColors(unsigned char rgb[3])
static PCLContextItem * New()
bool Paint(vtkContext2D *) override
vtkTypeMacro(PCLContextItem, vtkContextItem)
bool Paint(vtkContext2D *painter) override
virtual void set(float _x, float _y, float _r)
bool Paint(vtkContext2D *painter) override
bool Paint(vtkContext2D *painter) override
bool Paint(vtkContext2D *painter) override
virtual void set(float _x_1, float _y_1, float _x_2, float _y_2)
void setPointColors(unsigned char r, unsigned char g, unsigned char b)
void setPointColors(unsigned char rgb[3])
bool Paint(vtkContext2D *painter) override
bool Paint(vtkContext2D *painter) override
virtual void set(float _x, float _y)
bool Paint(vtkContext2D *painter) override
void set(const std::vector< float > &_xy)
bool Paint(vtkContext2D *painter) override
bool Paint(vtkContext2D *painter) override
virtual void set(float _x, float _y, float _w, float _h)
bool Paint(vtkContext2D *painter) override
virtual void set(float x, float y, const std::string &_text)