18 namespace visualization {
21 std::shared_ptr<ccHObject> g,
29 std::shared_ptr<t::geometry::Geometry> tg,
37 std::shared_ptr<rendering::TriangleMeshModel> m,
45 void Draw(
const std::vector<std::shared_ptr<ccHObject>> &geometries,
46 const std::string &window_name ,
49 const std::vector<DrawAction> &actions ) {
50 std::vector<DrawObject> objs;
51 objs.reserve(geometries.size());
52 for (
size_t i = 0; i < geometries.size(); ++i) {
53 std::stringstream
name;
54 name <<
"Object " << (i + 1);
55 objs.emplace_back(
name.str(), geometries[i]);
61 const std::vector<std::shared_ptr<t::geometry::Geometry>> &tgeometries,
62 const std::string &window_name ,
65 const std::vector<DrawAction> &actions ) {
66 std::vector<DrawObject> objs;
67 objs.reserve(tgeometries.size());
68 for (
size_t i = 0; i < tgeometries.size(); ++i) {
69 std::stringstream
name;
70 name <<
"Object " << (i + 1);
71 objs.emplace_back(
name.str(), tgeometries[i]);
76 void Draw(
const std::vector<std::shared_ptr<rendering::TriangleMeshModel>>
78 const std::string &window_name ,
81 const std::vector<DrawAction> &actions ) {
82 std::vector<DrawObject> objs;
83 objs.reserve(models.size());
84 for (
size_t i = 0; i < models.size(); ++i) {
85 std::stringstream
name;
86 name <<
"Object " << (i + 1);
87 objs.emplace_back(
name.str(), models[i]);
92 void Draw(
const std::vector<DrawObject> &objects,
93 const std::string &window_name ,
96 const std::vector<DrawAction> &actions ) {
98 auto draw = std::make_shared<visualizer::O3DVisualizer>(window_name,
width,
100 for (
auto &o : objects) {
102 draw->AddGeometry(o.name, o.geometry);
103 }
else if (o.tgeometry) {
104 draw->AddGeometry(o.name, o.tgeometry);
105 }
else if (o.model) {
106 draw->AddGeometry(o.name, o.model);
110 draw->ShowGeometry(o.name, o.is_visible);
113 for (
auto &act : actions) {
114 draw->AddAction(act.name, act.callback);
117 draw->ResetCameraToDefault();
static Application & GetInstance()
void Run()
Does not return until the UI is completely finished.
void AddWindow(std::shared_ptr< Window > window)
Must be called on the same thread that calls Run()
void Draw(const std::vector< std::shared_ptr< ccHObject >> &geometries, const std::string &window_name, int width, int height, const std::vector< DrawAction > &actions)
Generic file read and write utility for python interface.
std::shared_ptr< ccHObject > geometry
DrawObject(const std::string &n, std::shared_ptr< ccHObject > g, bool vis=true)
std::shared_ptr< t::geometry::Geometry > tgeometry
std::shared_ptr< rendering::TriangleMeshModel > model