3 #include <condition_variable>
15 #include <pcl/outofcore/outofcore.h>
16 #include <pcl/outofcore/outofcore_impl.h>
17 #include <pcl/outofcore/impl/lru_cache.hpp>
24 #include <vtkActorCollection.h>
25 #include <vtkAppendPolyData.h>
26 #include <vtkDataSetMapper.h>
27 #include <vtkPolyData.h>
28 #include <vtkSmartPointer.h>
45 using AlignedPointT = Eigen::aligned_allocator<PointT>;
49 using CloudActorMap = std::map<std::string, vtkSmartPointer<vtkActor> >;
77 using PcdQueue = std::priority_queue<PcdQueueItem>;
90 this->
item = cloud_data;
97 return item->GetActualMemorySize();
139 return cloud_actors_;
145 if (displayDepth < 0)
149 else if (
static_cast<unsigned int> (displayDepth) > octree_->getDepth ())
151 displayDepth = octree_->getDepth ();
154 if (display_depth_ !=
static_cast<std::uint64_t
> (displayDepth))
156 display_depth_ = displayDepth;
165 return display_depth_;
171 return points_loaded_;
195 voxel_actor_->SetVisibility (display_voxels);
201 return voxel_actor_->GetVisibility ();
207 render_camera_ = render_camera;
213 return lod_pixel_threshold_;
219 if (lod_pixel_threshold <= 1000)
220 lod_pixel_threshold = 1000;
222 lod_pixel_threshold_ = lod_pixel_threshold;
230 if (lod_pixel_threshold_ >= 50000)
232 if (lod_pixel_threshold_ >= 10000)
234 else if (lod_pixel_threshold_ >= 1000)
237 lod_pixel_threshold_ += value;
238 std::cout <<
"Increasing lod pixel threshold: " << lod_pixel_threshold_ << std::endl;
245 if (lod_pixel_threshold_ > 50000)
247 else if (lod_pixel_threshold_ > 10000)
249 else if (lod_pixel_threshold_ > 1000)
252 lod_pixel_threshold_ -= value;
254 if (lod_pixel_threshold_ < 100)
255 lod_pixel_threshold_ = 100;
256 std::cout <<
"Decreasing lod pixel threshold: " << lod_pixel_threshold_ << std::endl;
266 OctreeDiskPtr octree_;
268 std::uint64_t display_depth_{1};
269 std::uint64_t points_loaded_{0};
270 std::uint64_t data_loaded_{0};
272 Eigen::Vector3d bbox_min_, bbox_max_;
274 Camera *render_camera_{
nullptr};
276 int lod_pixel_threshold_{10000};
280 std::map<std::string, vtkSmartPointer<vtkActor> > cloud_actors_map_;
vtkSmartPointer< vtkPolyData > item
CloudDataCacheItem(std::string pcd_file, float coverage, vtkSmartPointer< vtkPolyData > cloud_data, std::size_t timestamp)
std::size_t sizeOf() const override
static std::condition_variable pcd_queue_ready
static std::mutex pcd_queue_mutex
void decreaseLodPixelThreshold()
void setLodPixelThreshold(int lod_pixel_threshold)
Eigen::Vector3d getBoundingBoxMax()
static std::mutex cloud_data_cache_mutex
int getLodPixelThreshold() const
void setDisplayVoxels(bool display_voxels)
void render(vtkRenderer *renderer) override
void increaseLodPixelThreshold()
static void pcdReaderThread()
std::uint64_t getPointsLoaded() const
std::uint64_t getDataLoaded() const
static std::shared_ptr< std::thread > pcd_reader_thread
void setRenderCamera(Camera *render_camera)
static CloudDataCache cloud_data_cache
OctreeDiskPtr getOctree()
int getDisplayDepth() const
std::priority_queue< PcdQueueItem > PcdQueue
vtkSmartPointer< vtkActorCollection > getCloudActors() const
static PcdQueue pcd_queue
Eigen::Vector3d getBoundingBoxMin()
OutofcoreCloud(std::string name, boost::filesystem::path &tree_root)
vtkSmartPointer< vtkActor > getVoxelActor() const
void setDisplayDepth(int displayDepth)
This code defines the octree used for point storage at Urban Robotics.
shared_ptr< OutofcoreOctreeBase< ContainerT, PointT > > Ptr
OutofcoreOctreeBaseNode Class internally representing nodes of an outofcore octree,...
Defines all the PCL implemented PointT point type structures.
#define PCL_MAKE_ALIGNED_OPERATOR_NEW
Macro to signal a class requires a custom allocator.
Defines functions, macros and traits for allocating and using memory.
Defines all the PCL and non-PCL macros used.
bool operator<(const PcdQueueItem &rhs) const
PcdQueueItem(std::string pcd_file, float coverage)
A point structure representing Euclidean xyz coordinates.