TinyURDF 1.0.0
A Modern C++ Library for Parsing and Visualizing URDF Model Files
Loading...
Searching...
No Matches
vtk_link_renderer.h
Go to the documentation of this file.
1#ifndef TINYURDF_VTK_LINK_RENDERER_H
2#define TINYURDF_VTK_LINK_RENDERER_H
3
4// Copyright 2025 Wissem CHIHA
5
6#include <thread>
7#include <vector>
8
9#include <vtkNew.h>
10#include <vtkActor.h>
11#include <vtkCamera.h>
12#include <vtkTextActor3D.h>
13#include <vtkCubeSource.h>
14#include <vtkSphereSource.h>
15#include <vtkNamedColors.h>
16#include <vtkCylinderSource.h>
17#include <vtkArrowSource.h>
18#include <vtkSphereSource.h>
19#include <vtkNamedColors.h>
20#include <vtkElevationFilter.h>
21#include <vtkPolyDataMapper.h>
22#include <vtkProperty.h>
23#include <vtkTextProperty.h>
24#include <vtkRenderWindow.h>
25#include <vtkAxesActor.h>
26#include <vtkRenderer.h>
27#include <vtkTransform.h>
28#include <vtkDataSetMapper.h>
29#include <vtkTransformFilter.h>
30#include <vtkMatrix4x4.h>
31#include <vtkSTLReader.h>
32#include <vtkCaptionActor2D.h>
33
34#include "renderer_base.h"
35#include "link.h"
36#include "pose.h"
37#include "box.h"
38#include "cylinder.h"
39#include "sphere.h"
40#include "mesh.h"
41
42class VtkLinkRenderer : public RendererBase<Link>{
43public:
45 void show() override;
46 void update() override;
47 void setRenderer(vtkSmartPointer<vtkRenderer> renderer);
48 void setWindowSize(const int32_t width, const int32_t height) override;
49 void setBackrgournd(double r, double g, double b, double a) override;
50 void setLabelsVisibility(bool isVisible) override;
51 vtkSmartPointer<vtkRenderer> getRenderer();
52 void setLink(const Link& link);
53 void clear() override;
54 bool isA(const char* name) override;
55 void print(std::ostream& os) override;
56 bool empty() const override;
57 const char* getTypename() override;
58 void setLinks(const std::vector<Link>& links);
60private:
61 int32_t width_ = 800;
62 int32_t height_ = 600;
63 vtkSmartPointer<vtkRenderer> renderer_;
64 vtkSmartPointer<vtkRenderWindow> window_;
65 std::vector<Link> links_;
66 bool labels_ = false;
67 void Pose2vtkMatrix(Pose& pose, vtkSmartPointer<vtkMatrix4x4> matrix);
68};
69#endif // TINYURDF_VTK_LINK_RENDERER_H
Represents a pose, consisting of position and rotation.
Definition pose.h:13
this is a base class for all renderers all renderers impentation should inherit from this class at th...
Definition renderer_base.h:15
Definition vtk_link_renderer.h:42
void setLabelsVisibility(bool isVisible) override
Definition vtk_link_renderer.cc:128
const char * getTypename() override
Definition vtk_link_renderer.cc:174
void setBackrgournd(double r, double g, double b, double a) override
Definition vtk_link_renderer.cc:119
void print(std::ostream &os) override
Definition vtk_link_renderer.cc:153
vtkSmartPointer< vtkRenderer > getRenderer()
Definition vtk_link_renderer.cc:133
void setWindowSize(const int32_t width, const int32_t height) override
Definition vtk_link_renderer.cc:113
~VtkLinkRenderer()
Definition vtk_link_renderer.cc:192
void clear() override
Definition vtk_link_renderer.cc:143
bool isA(const char *name) override
Definition vtk_link_renderer.cc:148
bool empty() const override
Definition vtk_link_renderer.cc:169
void show() override
Definition vtk_link_renderer.cc:95
VtkLinkRenderer()
Definition vtk_link_renderer.cc:4
void setRenderer(vtkSmartPointer< vtkRenderer > renderer)
Definition vtk_link_renderer.cc:107
void setLinks(const std::vector< Link > &links)
Definition vtk_link_renderer.cc:179
void update() override
Definition vtk_link_renderer.cc:10
void setLink(const Link &link)
Definition vtk_link_renderer.cc:138