Vegetation Processor class
The VegetationProcessor
class is used to process the trees in the scene. It contains the necessary attributes to describe the trees, such as the tree library, the configuration, the output folder, the reference origin coordinates, the height range, and the number of trees without height on the database. It also contains methods to process the trees, wrap the trees with CGAL Alpha Wrapping
at execution time, set the tree foliage, process the tree height with the height range
set by the user in the config file
for trees without height on the database, and write the metrics to save usefull information on the program execution an results.
class VegetationProcessor {
// using K = CGAL::Simple_cartesian<double>;
using K = CGAL::Exact_predicates_inexact_constructions_kernel;
using Point_3 = K::Point_3;
using MeshCgal = CGAL::Surface_mesh<Point_3>;
using MeshGeom = Feel::Ktirio::Geom::Mesh;
private:
std::vector<Tree<MeshCgal, K>> M_treeLibrary;
Config M_config;
std::string M_output_folder;
std::array<double, 2> M_origin;
std::array<double, 2> M_height_range;
int M_nNoHeight;
public:
// Constructors
VegetationProcessor() = default;
VegetationProcessor(const std::string &config_file, const std::string &gis,
const std::string &output_folder);
// Getters
....
// Methods
//! Alpha Wrap ref tree
MeshCgal wrap_tree(int lod, const std::string &shape);
void setTreeFoliage(Tree<MeshCgal, K> &tree, const MeshCgal &round,
const MeshCgal &oval, const MeshCgal &cone);
void processTreeHeight(Tree<MeshCgal, K> &tree, double min_height,
double max_height, int &nNoHeight);
void writeMetrics(const std::string &output_folder,
size_t num_faces_terrain, size_t num_faces_vege,
double time);
The processTree
logic has its own function not only to factorize the code but also to be able to parallize it later with async
more easily.
//! Process the tree
void processTree(Tree<MeshCgal, K> &tree, const MeshCgal &foliage_round,
const MeshCgal &foliage_oval, const MeshCgal &foliage_cone,
const std::array<double, 2> &M_origin,
const std::array<double, 2> &M_height_range,
int &M_nNoHeight, const Config &config,
std::shared_ptr<MeshGeom> terrainMesh);
//! Use `processTree` for each tree in the library
void processVegetation();
};