42#include <pcl/pcl_exports.h>
43#include <vtkRenderer.h>
44#include <vtkRenderWindow.h>
45#include <vtkRenderWindowInteractor.h>
46#include <vtkSmartPointer.h>
47#include <vtkObjectFactory.h>
48#include <vtkContext2D.h>
49#include <vtkTransform2D.h>
50#include <vtkContextItem.h>
51#include <vtkContextView.h>
52#include <vtkContextScene.h>
55#include <vtkTextProperty.h>
56#include <vtkOpenGLContextDevice2D.h>
57#include <vtkPoints2D.h>
58#include "vtkCommand.h"
62 namespace visualization
78 this->pen_ = vtkPen::New ();
79 this->brush_ = vtkBrush::New ();
80 this->transform_ = vtkTransform2D::New();
82 this->pen_->DeepCopy (p);
83 this->brush_->DeepCopy (b);
84 this->transform_->SetMatrix (
t->GetMatrix());
90 this->pen_ = vtkPen::New ();
91 this->brush_ = vtkBrush::New ();
92 this->transform_ = vtkTransform2D::New();
94 this->pen_->DeepCopy (p);
95 this->brush_->DeepCopy (b);
96 this->transform_->SetMatrix (
t->GetMatrix());
172 FEllipticArc2D (
float x,
float y,
float rx,
float ry,
float sa,
float ea,
vtkPen *p,
vtkBrush * b,
vtkTransform2D *
t) :
Figure2D (p, b,
t)
250 addRect (
float x,
float y,
float width,
float height);
347 void setPenColor (
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a);
363 void setBrushColor (
unsigned char r,
unsigned char g,
unsigned char b,
unsigned char a);
417 std::vector<Figure2D *> figures_;
423 int win_width_, win_height_;
424 double bkg_color_[3];
429 struct ExitMainLoopTimerCallback :
public vtkCommand
431 static ExitMainLoopTimerCallback* New ()
433 return (
new ExitMainLoopTimerCallback);
438 if (
event_id != vtkCommand::TimerEvent)
446 interactor->TerminateApp ();
Iterator class for point clouds with or without given indices.
PCL Painter2D main class.
void clearTransform()
Clears all the transformation applied.
void setPenType(int type)
void addCircle(float x, float y, float r)
Draw a circle based on the inputs.
void spin()
spins (runs the event loop) the interactor indefinitely.
double * getBackgroundColor()
set/get method for the viewport's background color.
void addRect(float x, float y, float width, float height)
Draw a rectangle based on the given points.
unsigned char * getPenColor()
set/get methods for current working vtkPen
PCLPainter2D(char const *name="PCLPainter2D")
Constructor of the class.
void setBrushColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
void rotatePen(double angle)
Create a rotation matrix and concatenate it with the current transformation.
unsigned char * getBrushColor()
vtkMatrix3x3 * getTransform()
Returns the current transformation matrix.
void addEllipticArc(float x, float y, float rx, float ry, float start_angle, float end_angle)
Draw an elliptic arc based on the inputs.
void scalePen(double x, double y)
Create a scale matrix and concatenate it with the current transformation.
void addPoints(std::vector< float > points)
Draw specified point(s).
void setBackgroundColor(const double r, const double g, const double b)
set/get method for the viewport's background color.
void display()
displays all the figures added in a window.
void setPenWidth(float w)
void addEllipse(float x, float y, float rx, float ry)
Draw an ellipse based on the inputs.
bool Paint(vtkContext2D *painter) override
Paint event for the chart, called whenever the chart needs to be drawn.
void setBackgroundColor(const double color[3])
set/get method for the viewport's background color.
void translatePen(double x, double y)
Create a translation matrix and concatenate it with the current transformation.
vtkTypeMacro(PCLPainter2D, vtkContextItem)
int * getWindowSize() const
set/get method for the window size.
void addLine(std::vector< float > p)
Draw line(s) between the specified points.
void clearFigures()
remove all the figures from the window
void addPolygon(std::vector< float > p)
Draw a polygon between the specified points.
void addQuad(std::vector< float > p)
Draw a quadrilateral based on the given points.
void setTransform(vtkMatrix3x3 *matrix)
Create a translation matrix and concatenate it with the current transformation.
void addPoint(float x, float y)
Draw specified point(s).
void setBrush(vtkBrush *brush)
set/get methods for current working vtkBrush
void addArc(float x, float y, float r, float start_angle, float end_angle)
Draw an arc based on the inputs.
void spinOnce(const int spin_time=0)
spins (runs the event loop) the interactor for spin_time amount of time.
void addLine(float x1, float y1, float x2, float y2)
Draw a line between the specified points.
void setPenColor(unsigned char r, unsigned char g, unsigned char b, unsigned char a)
set/get methods for current working vtkPen
void setWindowSize(int w, int h)
set/get method for the window size.
Class for storing EllipticArc; every ellipse , circle are covered by this.
void draw(vtkContext2D *painter) override
FEllipticArc2D(float x, float y, float rx, float ry, float sa, float ea, vtkPen *p, vtkBrush *b, vtkTransform2D *t)
FEllipticArc2D(std::vector< float > info, vtkPen *p, vtkBrush *b, vtkTransform2D *t)
Class for storing Points.
void draw(vtkContext2D *painter) override
FPoints2D(std::vector< float > info, vtkPen *p, vtkBrush *b, vtkTransform2D *t)
FPolyLine2D(std::vector< float > info, vtkPen *p, vtkBrush *b, vtkTransform2D *t)
void draw(vtkContext2D *painter) override
void draw(vtkContext2D *painter) override
FPolygon2D(std::vector< float > info, vtkPen *p, vtkBrush *b, vtkTransform2D *t)
FQuad2D(std::vector< float > info, vtkPen *p, vtkBrush *b, vtkTransform2D *t)
void draw(vtkContext2D *painter) override