ReUseX  0.0.1
3D Point Cloud Processing for Building Reuse
Loading...
Searching...
No Matches
Visualizer.hpp
Go to the documentation of this file.
1// SPDX-FileCopyrightText: 2025 Povl Filip Sonne-Frederiksen
2//
3// SPDX-License-Identifier: GPL-3.0-or-later
4
5#pragma once
6#include "reusex/geometry/CellComplex.hpp"
7#include "reusex/types.hpp"
8
9#include <functional>
10#include <memory>
11#include <string>
12#include <string_view>
13#include <unordered_map>
14#include <vector>
15
16namespace ReUseX::visualize {
17
25 public:
30 Visualizer(std::shared_ptr<std::vector<int>> vps = nullptr);
31
36
37 // Delete copy constructor and copy assignment operator
38 Visualizer(const Visualizer &) = delete;
39 Visualizer &operator=(const Visualizer &) = delete;
40
41 // Delete move constructor and move assignment operator
42 Visualizer(Visualizer &&) = delete;
44
45 public:
50 std::shared_ptr<const std::vector<int>> getViewports() const;
51
56 void reset_camera_viewpoint(const std::string &name = "");
57
64 void add_point_cloud(CloudConstPtr cloud, std::string name = "cloud",
65 int vp = 0);
66
75 void add_plane(const Eigen::Vector4d &plane, const Eigen::Vector3d &origin,
76 const pcl::RGB &color, const std::string_view &name = "plane",
77 int vp = 0);
78
85 void add_planes(const std::vector<Pair> &planes,
86 const std::string_view &name = "plane", int vp = 0);
87
94 void add_pair(const PlanePair &plane_pair,
95 const std::string_view &name = "plane_pair", int vp = 0);
96
103 void add_plane_pairs(const std::vector<PlanePair> &plane_pairs,
104 const std::string_view &name = "plane_pair", int vp = 0);
105
114 void add_floor(const double height, const Eigen::Vector3d &min,
115 const Eigen::Vector3d &max,
116 const std::string_view &name = "floor", int vp = 0);
117
126 void add_floors(const std::vector<double> &heights,
127 const Eigen::Vector3d &min, const Eigen::Vector3d &max,
128 const std::string_view &name = "floor", int vp = 0);
129
130 void
131 add_cell_complex(const std::shared_ptr<ReUseX::geometry::CellComplex> &cc,
132 const std::string_view &name = "cell_complex", int vp = 0);
133
135
136 const std::shared_ptr<ReUseX::geometry::CellComplex> &cc,
137 const std::string_view &name = "room_probabilities", int vp = 0);
138
140
141 const std::shared_ptr<ReUseX::geometry::CellComplex> &cc,
142 const std::string_view &name = "support_probabilities", int vp = 0);
143
144 void
145 add_rooms(const std::shared_ptr<ReUseX::geometry::CellComplex> &cc,
146 const std::pair<
147 std::unordered_map<ReUseX::geometry::CellComplex::Vertex, int>,
148 std::unordered_map<ReUseX::geometry::CellComplex::Vertex,
149 std::set<int>>> &results,
150 const std::string_view &name = "rooms", int vp = 0);
151
152 // Deprecated aliases for backward compatibility
153 [[deprecated("Use reset_camera_viewpoint instead")]] void
154 resetCameraViewpoint(const std::string &name = "") {
156 }
157 [[deprecated("Use add_point_cloud instead")]] void
158 addPointCloud(CloudConstPtr cloud, std::string name = "cloud", int vp = 0) {
159 add_point_cloud(cloud, name, vp);
160 }
161 [[deprecated("Use add_plane instead")]] void
162 addPlane(const Eigen::Vector4d &plane, const Eigen::Vector3d &origin,
163 const pcl::RGB &color, const std::string_view &name = "plane",
164 int vp = 0) {
165 add_plane(plane, origin, color, name, vp);
166 }
167 [[deprecated("Use add_planes instead")]] void
168 addPlanes(const std::vector<Pair> &planes,
169 const std::string_view &name = "plane", int vp = 0) {
170 add_planes(planes, name, vp);
171 }
172 [[deprecated("Use add_pair instead")]] void
173 addPair(const PlanePair &plane_pair,
174 const std::string_view &name = "plane_pair", int vp = 0) {
175 add_pair(plane_pair, name, vp);
176 }
177 [[deprecated("Use add_plane_pairs instead")]] void
178 addPlanePairs(const std::vector<PlanePair> &plane_pairs,
179 const std::string_view &name = "plane_pair", int vp = 0) {
180 add_plane_pairs(plane_pairs, name, vp);
181 }
182 [[deprecated("Use add_floor instead")]] void
183 addFloor(const double height, const Eigen::Vector3d &min,
184 const Eigen::Vector3d &max, const std::string_view &name = "floor",
185 int vp = 0) {
186 add_floor(height, min, max, name, vp);
187 }
188 [[deprecated("Use add_floors instead")]] void
189 addFloors(const std::vector<double> &heights, const Eigen::Vector3d &min,
190 const Eigen::Vector3d &max, const std::string_view &name = "floor",
191 int vp = 0) {
192 add_floors(heights, min, max, name, vp);
193 }
194 [[deprecated("Use add_cell_complex instead")]] void
195 addCellComplex(const std::shared_ptr<ReUseX::geometry::CellComplex> &cc,
196 const std::string_view &name = "cell_complex", int vp = 0) {
197 add_cell_complex(cc, name, vp);
198 }
199 [[deprecated("Use add_room_probabilities instead")]] void
200 addRoomProbabilities(const std::shared_ptr<ReUseX::geometry::CellComplex> &cc,
201 const std::string_view &name = "room_probabilities",
202 int vp = 0) {
203 add_room_probabilities(cc, name, vp);
204 }
205 [[deprecated("Use add_support_probabilities instead")]] void
207 const std::shared_ptr<ReUseX::geometry::CellComplex> &cc,
208 const std::string_view &name = "support_probabilities", int vp = 0) {
209 add_support_probabilities(cc, name, vp);
210 }
211 [[deprecated("Use add_rooms instead")]] void
212 addRooms(const std::shared_ptr<ReUseX::geometry::CellComplex> &cc,
213 const std::pair<
214 std::unordered_map<ReUseX::geometry::CellComplex::Vertex, int>,
215 std::unordered_map<ReUseX::geometry::CellComplex::Vertex,
216 std::set<int>>> &results,
217 const std::string_view &name = "rooms", int vp = 0) {
218 add_rooms(cc, results, name, vp);
219 }
220
221 private:
222 class Impl;
223 std::unique_ptr<Impl> pimpl_;
224};
225} // namespace ReUseX::visualize
boost::graph_traits< Graph >::vertex_descriptor Vertex
void addSupportProbabilities(const std::shared_ptr< ReUseX::geometry::CellComplex > &cc, const std::string_view &name="support_probabilities", int vp=0)
void add_room_probabilities(const std::shared_ptr< ReUseX::geometry::CellComplex > &cc, const std::string_view &name="room_probabilities", int vp=0)
void addRooms(const std::shared_ptr< ReUseX::geometry::CellComplex > &cc, const std::pair< std::unordered_map< ReUseX::geometry::CellComplex::Vertex, int >, std::unordered_map< ReUseX::geometry::CellComplex::Vertex, std::set< int > > > &results, const std::string_view &name="rooms", int vp=0)
void add_floors(const std::vector< double > &heights, const Eigen::Vector3d &min, const Eigen::Vector3d &max, const std::string_view &name="floor", int vp=0)
Add multiple floor planes at different heights.
void add_plane_pairs(const std::vector< PlanePair > &plane_pairs, const std::string_view &name="plane_pair", int vp=0)
Add multiple plane pairs to the visualization.
void addFloors(const std::vector< double > &heights, const Eigen::Vector3d &min, const Eigen::Vector3d &max, const std::string_view &name="floor", int vp=0)
void add_cell_complex(const std::shared_ptr< ReUseX::geometry::CellComplex > &cc, const std::string_view &name="cell_complex", int vp=0)
Visualizer(const Visualizer &)=delete
~Visualizer()
Destroy the Visualizer object.
void addPlane(const Eigen::Vector4d &plane, const Eigen::Vector3d &origin, const pcl::RGB &color, const std::string_view &name="plane", int vp=0)
void resetCameraViewpoint(const std::string &name="")
void addRoomProbabilities(const std::shared_ptr< ReUseX::geometry::CellComplex > &cc, const std::string_view &name="room_probabilities", int vp=0)
Visualizer & operator=(Visualizer &&)=delete
void addFloor(const double height, const Eigen::Vector3d &min, const Eigen::Vector3d &max, const std::string_view &name="floor", int vp=0)
void reset_camera_viewpoint(const std::string &name="")
Reset camera viewpoint to default.
void addPointCloud(CloudConstPtr cloud, std::string name="cloud", int vp=0)
void addCellComplex(const std::shared_ptr< ReUseX::geometry::CellComplex > &cc, const std::string_view &name="cell_complex", int vp=0)
void add_support_probabilities(const std::shared_ptr< ReUseX::geometry::CellComplex > &cc, const std::string_view &name="support_probabilities", int vp=0)
void add_pair(const PlanePair &plane_pair, const std::string_view &name="plane_pair", int vp=0)
Add a plane pair to the visualization.
void add_floor(const double height, const Eigen::Vector3d &min, const Eigen::Vector3d &max, const std::string_view &name="floor", int vp=0)
Add a floor plane at specified height.
Visualizer & operator=(const Visualizer &)=delete
void add_rooms(const std::shared_ptr< ReUseX::geometry::CellComplex > &cc, const std::pair< std::unordered_map< ReUseX::geometry::CellComplex::Vertex, int >, std::unordered_map< ReUseX::geometry::CellComplex::Vertex, std::set< int > > > &results, const std::string_view &name="rooms", int vp=0)
void addPlanePairs(const std::vector< PlanePair > &plane_pairs, const std::string_view &name="plane_pair", int vp=0)
Visualizer(std::shared_ptr< std::vector< int > > vps=nullptr)
Construct a new Visualizer object.
void addPlanes(const std::vector< Pair > &planes, const std::string_view &name="plane", int vp=0)
std::shared_ptr< const std::vector< int > > getViewports() const
Get the configured viewports.
void addPair(const PlanePair &plane_pair, const std::string_view &name="plane_pair", int vp=0)
void add_planes(const std::vector< Pair > &planes, const std::string_view &name="plane", int vp=0)
Add multiple planes to the visualization.
void add_point_cloud(CloudConstPtr cloud, std::string name="cloud", int vp=0)
Add a point cloud to the visualization.
void add_plane(const Eigen::Vector4d &plane, const Eigen::Vector3d &origin, const pcl::RGB &color, const std::string_view &name="plane", int vp=0)
Add a single plane to the visualization.
Visualizer(Visualizer &&)=delete
std::pair< Pair, Pair > PlanePair
Definition types.hpp:46
typename Cloud::ConstPtr CloudConstPtr
Definition types.hpp:26