From 95c5a87bab995bc6cc6983b4f0f7d1433d4a98aa Mon Sep 17 00:00:00 2001 From: Cyrille Pierre Henri Favreau Date: Mon, 9 Oct 2023 17:00:52 +0200 Subject: [PATCH] Additional information in models metadata --- .../backend/science/BioExplorerPlugin.cpp | 23 ++++++++++++++++--- .../backend/science/fields/FieldsHandler.cpp | 2 +- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/bioexplorer/backend/science/BioExplorerPlugin.cpp b/bioexplorer/backend/science/BioExplorerPlugin.cpp index b429cd85b..479acaf5e 100644 --- a/bioexplorer/backend/science/BioExplorerPlugin.cpp +++ b/bioexplorer/backend/science/BioExplorerPlugin.cpp @@ -1243,7 +1243,9 @@ Response BioExplorerPlugin::_addSpheres(const AddSpheresDetails &payload) model->addSphere(materialId, {position, static_cast(payload.radii[i])}); } model->updateBounds(); - scene.addModel(std::make_shared(std::move(model), payload.name)); + ModelMetadata metadata; + metadata["Number of spheres"] = std::to_string(payload.radii.size()); + scene.addModel(std::make_shared(std::move(model), payload.name, metadata)); } CATCH_STD_EXCEPTION() return response; @@ -1279,6 +1281,8 @@ Response BioExplorerPlugin::_addCones(const AddConesDetails &payload) material->setOpacity(payload.opacity); PLUGIN_INFO(3, "Adding cones " + payload.name + " to the scene"); + uint64_t nbCones = 0; + uint64_t nbCylinders = 0; for (uint64_t i = 0; i < payload.originsRadii.size(); ++i) { const auto origin = Vector3d(origins[i * 3], origins[i * 3 + 1], origins[i * 3 + 2]); @@ -1286,11 +1290,20 @@ Response BioExplorerPlugin::_addCones(const AddConesDetails &payload) const auto originRadius = payload.originsRadii[i]; const auto targetRadius = payload.targetsRadii[i]; if (originRadius == targetRadius) + { model->addCylinder(0, {origin, target, static_cast(originRadius)}); + ++nbCylinders; + } else + { model->addCone(0, {origin, target, static_cast(originRadius), static_cast(targetRadius)}); + ++nbCones; + } } - scene.addModel(std::make_shared(std::move(model), payload.name)); + ModelMetadata metadata; + metadata["Number of cones"] = std::to_string(nbCones); + metadata["Number of cylinders"] = std::to_string(nbCylinders); + scene.addModel(std::make_shared(std::move(model), payload.name, metadata)); } CATCH_STD_EXCEPTION() return response; @@ -1417,6 +1430,7 @@ Response BioExplorerPlugin::_addStreamlines(const AddStreamlinesDetails &payload auto material = model->createMaterial(0, "Streamlines"); material->setDiffuseColor({1, 1, 1}); + uint64_t nbStreamlines = 0; for (uint64_t index = 0; index < nbIndices - 1; ++index) { // Create streamline geometry @@ -1455,9 +1469,12 @@ Response BioExplorerPlugin::_addStreamlines(const AddStreamlinesDetails &payload const Streamline streamline(points, colors, radii); model->addStreamline(materialId, streamline); + ++nbStreamlines; } - auto modelDescriptor = std::make_shared(std::move(model), name); + ModelMetadata metadata; + metadata["Number of streamlines"] = std::to_string(nbStreamlines); + auto modelDescriptor = std::make_shared(std::move(model), name, metadata); scene.addModel(modelDescriptor); PLUGIN_INFO(1, nbIndices << " streamlines added"); diff --git a/bioexplorer/backend/science/fields/FieldsHandler.cpp b/bioexplorer/backend/science/fields/FieldsHandler.cpp index 3ce731aad..430a98705 100644 --- a/bioexplorer/backend/science/fields/FieldsHandler.cpp +++ b/bioexplorer/backend/science/fields/FieldsHandler.cpp @@ -160,7 +160,7 @@ void FieldsHandler::_buildOctree(const Scene& scene, const double voxelSize, con _frameSize = _frameData.size(); PLUGIN_INFO(1, "--------------------------------------------"); - PLUGIN_INFO(1, "Octree information"); + PLUGIN_INFO(1, "Octree information (" << events.size() / 5 << " events)"); PLUGIN_INFO(1, "--------------------------------------------"); PLUGIN_INFO(1, "Scene AABB : " << bounds); PLUGIN_INFO(1, "Scene dimension : " << sceneSize);