pcl_context_item.h
/*
* Software License Agreement (BSD License)
*
* Point Cloud Library (PCL) - www.pointclouds.org
* Copyright (c) 2012-, Open Perception, Inc.
*
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following
* disclaimer in the documentation and/or other materials provided
* with the distribution.
* * Neither the name of the copyright holder(s) nor the names of its
* contributors may be used to endorse or promote products derived
* from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*
*/
#pragma once
#include <pcl/pcl_macros.h>
#include <vtkContextItem.h>
#include <vector>
template <typename T> class vtkSmartPointer;
class vtkImageData;
class vtkContext2D;
namespace pcl
{
namespace visualization
{
/** Struct PCLContextItem represents our own custom version of vtkContextItem, used by
* the ImageViewer class.
*
* \author Nizar Sallem
*/
struct PCL_EXPORTS PCLContextItem : public vtkContextItem
{
vtkTypeMacro (PCLContextItem, vtkContextItem);
static PCLContextItem *New();
bool Paint (vtkContext2D *) override { return (false); };
void setColors (unsigned char r, unsigned char g, unsigned char b);
void setColors (unsigned char rgb[3]) { memcpy (colors, rgb, 3 * sizeof (unsigned char)); }
void setOpacity (double opacity) { SetOpacity (opacity); };
unsigned char colors[3];
std::vector<float> params;
};
/** Struct PCLContextImageItem a specification of vtkContextItem, used to add an image to the
* scene in the ImageViewer class.
*
* \author Nizar Sallem
*/
struct PCL_EXPORTS PCLContextImageItem : public vtkContextItem
{
vtkTypeMacro (PCLContextImageItem, vtkContextItem);
PCLContextImageItem ();
static PCLContextImageItem *New ();
bool Paint (vtkContext2D *painter) override;
void set (float _x, float _y, vtkImageData *_image);
vtkSmartPointer<vtkImageData> image;
float x, y;
};
namespace context_items
{
struct PCL_EXPORTS Point : public PCLContextItem
{
vtkTypeMacro (Point, PCLContextItem);
static Point *New();
bool Paint (vtkContext2D *painter) override;
virtual void set (float _x, float _y);
};
struct PCL_EXPORTS Line : public PCLContextItem
{
vtkTypeMacro (Line, PCLContextItem);
static Line *New();
bool Paint (vtkContext2D *painter) override;
virtual void set (float _x_1, float _y_1, float _x_2, float _y_2);
};
struct PCL_EXPORTS Circle : public PCLContextItem
{
vtkTypeMacro (Circle, PCLContextItem);
static Circle *New();
bool Paint (vtkContext2D *painter) override;
virtual void set (float _x, float _y, float _r);
};
struct PCL_EXPORTS Disk : public Circle
{
vtkTypeMacro (Disk, Circle);
static Disk *New();
bool Paint (vtkContext2D *painter) override;
};
struct PCL_EXPORTS Rectangle : public PCLContextItem
{
vtkTypeMacro (Rectangle, Point);
static Rectangle *New();
bool Paint (vtkContext2D *painter) override;
virtual void set (float _x, float _y, float _w, float _h);
};
struct PCL_EXPORTS FilledRectangle : public Rectangle
{
vtkTypeMacro (FilledRectangle, Rectangle);
static FilledRectangle *New();
bool Paint (vtkContext2D *painter) override;
};
struct PCL_EXPORTS Points : public PCLContextItem
{
vtkTypeMacro (Points, PCLContextItem);
static Points *New();
bool Paint (vtkContext2D *painter) override;
void set (const std::vector<float>& _xy) { params = _xy; }
};
struct PCL_EXPORTS Polygon : public Points
{
vtkTypeMacro (Polygon, Points);
static Polygon *New();
bool Paint (vtkContext2D *painter) override;
};
struct PCL_EXPORTS Text : public PCLContextItem
{
vtkTypeMacro (Text, PCLContextItem);
static Text *New ();
bool Paint (vtkContext2D *painter) override;
virtual void set (float x, float y, const std::string& _text);
std::string text;
};
struct PCL_EXPORTS Markers : public Points
{
vtkTypeMacro (Markers, Points);
static Markers *New ();
bool Paint (vtkContext2D *painter) override;
void setSize (float _size) { size = _size; }
void setPointColors (unsigned char r, unsigned char g, unsigned char b);
void setPointColors (unsigned char rgb[3]);
float size;
unsigned char point_colors[3];
};
}
}
}
vtkSmartPointer
Definition: actor_map.h:51
pcl
Definition: convolution.h:46
pcl_macros.h
Defines all the PCL and non-PCL macros used.
PCL_EXPORTS
#define PCL_EXPORTS
Definition: pcl_macros.h:323
pcl::visualization::PCLContextImageItem
Struct PCLContextImageItem a specification of vtkContextItem, used to add an image to the scene in th...
Definition: pcl_context_item.h:75
pcl::visualization::PCLContextImageItem::PCLContextImageItem
PCLContextImageItem()
pcl::visualization::PCLContextImageItem::set
void set(float _x, float _y, vtkImageData *_image)
pcl::visualization::PCLContextImageItem::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::PCLContextImageItem::vtkTypeMacro
vtkTypeMacro(PCLContextImageItem, vtkContextItem)
pcl::visualization::PCLContextImageItem::New
static PCLContextImageItem * New()
pcl::visualization::PCLContextImageItem::image
vtkSmartPointer< vtkImageData > image
Definition: pcl_context_item.h:82
pcl::visualization::PCLContextImageItem::x
float x
Definition: pcl_context_item.h:83
pcl::visualization::PCLContextItem
Struct PCLContextItem represents our own custom version of vtkContextItem, used by the ImageViewer cl...
Definition: pcl_context_item.h:58
pcl::visualization::PCLContextItem::setOpacity
void setOpacity(double opacity)
Definition: pcl_context_item.h:64
pcl::visualization::PCLContextItem::setColors
void setColors(unsigned char r, unsigned char g, unsigned char b)
pcl::visualization::PCLContextItem::setColors
void setColors(unsigned char rgb[3])
Definition: pcl_context_item.h:63
pcl::visualization::PCLContextItem::Paint
bool Paint(vtkContext2D *) override
Definition: pcl_context_item.h:61
pcl::visualization::PCLContextItem::New
static PCLContextItem * New()
pcl::visualization::PCLContextItem::params
std::vector< float > params
Definition: pcl_context_item.h:66
pcl::visualization::PCLContextItem::vtkTypeMacro
vtkTypeMacro(PCLContextItem, vtkContextItem)
pcl::visualization::context_items::Circle
Definition: pcl_context_item.h:105
pcl::visualization::context_items::Circle::vtkTypeMacro
vtkTypeMacro(Circle, PCLContextItem)
pcl::visualization::context_items::Circle::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::Circle::set
virtual void set(float _x, float _y, float _r)
pcl::visualization::context_items::Circle::New
static Circle * New()
pcl::visualization::context_items::Disk
Definition: pcl_context_item.h:113
pcl::visualization::context_items::Disk::New
static Disk * New()
pcl::visualization::context_items::Disk::vtkTypeMacro
vtkTypeMacro(Disk, Circle)
pcl::visualization::context_items::Disk::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::FilledRectangle
Definition: pcl_context_item.h:128
pcl::visualization::context_items::FilledRectangle::New
static FilledRectangle * New()
pcl::visualization::context_items::FilledRectangle::vtkTypeMacro
vtkTypeMacro(FilledRectangle, Rectangle)
pcl::visualization::context_items::FilledRectangle::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::Line
Definition: pcl_context_item.h:97
pcl::visualization::context_items::Line::New
static Line * New()
pcl::visualization::context_items::Line::vtkTypeMacro
vtkTypeMacro(Line, PCLContextItem)
pcl::visualization::context_items::Line::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::Line::set
virtual void set(float _x_1, float _y_1, float _x_2, float _y_2)
pcl::visualization::context_items::Markers
Definition: pcl_context_item.h:159
pcl::visualization::context_items::Markers::size
float size
Definition: pcl_context_item.h:166
pcl::visualization::context_items::Markers::setPointColors
void setPointColors(unsigned char r, unsigned char g, unsigned char b)
pcl::visualization::context_items::Markers::setPointColors
void setPointColors(unsigned char rgb[3])
pcl::visualization::context_items::Markers::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::Markers::setSize
void setSize(float _size)
Definition: pcl_context_item.h:163
pcl::visualization::context_items::Markers::vtkTypeMacro
vtkTypeMacro(Markers, Points)
pcl::visualization::context_items::Markers::New
static Markers * New()
pcl::visualization::context_items::Point
Definition: pcl_context_item.h:89
pcl::visualization::context_items::Point::vtkTypeMacro
vtkTypeMacro(Point, PCLContextItem)
pcl::visualization::context_items::Point::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::Point::set
virtual void set(float _x, float _y)
pcl::visualization::context_items::Point::New
static Point * New()
pcl::visualization::context_items::Points
Definition: pcl_context_item.h:135
pcl::visualization::context_items::Points::vtkTypeMacro
vtkTypeMacro(Points, PCLContextItem)
pcl::visualization::context_items::Points::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::Points::set
void set(const std::vector< float > &_xy)
Definition: pcl_context_item.h:139
pcl::visualization::context_items::Points::New
static Points * New()
pcl::visualization::context_items::Polygon
Definition: pcl_context_item.h:143
pcl::visualization::context_items::Polygon::New
static Polygon * New()
pcl::visualization::context_items::Polygon::vtkTypeMacro
vtkTypeMacro(Polygon, Points)
pcl::visualization::context_items::Polygon::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::Rectangle
Definition: pcl_context_item.h:120
pcl::visualization::context_items::Rectangle::vtkTypeMacro
vtkTypeMacro(Rectangle, Point)
pcl::visualization::context_items::Rectangle::New
static Rectangle * New()
pcl::visualization::context_items::Rectangle::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::Rectangle::set
virtual void set(float _x, float _y, float _w, float _h)
pcl::visualization::context_items::Text
Definition: pcl_context_item.h:150
pcl::visualization::context_items::Text::Paint
bool Paint(vtkContext2D *painter) override
pcl::visualization::context_items::Text::vtkTypeMacro
vtkTypeMacro(Text, PCLContextItem)
pcl::visualization::context_items::Text::text
std::string text
Definition: pcl_context_item.h:155
pcl::visualization::context_items::Text::New
static Text * New()
pcl::visualization::context_items::Text::set
virtual void set(float x, float y, const std::string &_text)