diff --git a/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp b/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp index 91a9196beec405f386854d9f45f02ef5cd5bf1e7..fe8f00ff09d9fc87d9460974f7a097aefc35fa0f 100644 --- a/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp +++ b/source/RobotAPI/libraries/armem_objects/server/instance/Segment.cpp @@ -1,9 +1,11 @@ #include "Segment.h" +#include <RobotAPI/libraries/ArmarXObjects/Scene.h> +#include <RobotAPI/libraries/ArmarXObjects/json_conversions.h> + #include <RobotAPI/libraries/armem_objects/aron/ObjectClass.aron.generated.h> #include <RobotAPI/libraries/armem_objects/aron/ObjectInstance.aron.generated.h> #include <RobotAPI/libraries/armem_objects/aron_conversions.h> -#include <RobotAPI/libraries/armem_objects/SceneSnapshot.h> #include <RobotAPI/libraries/armem/core/aron_conversions.h> #include <RobotAPI/libraries/armem/core/error.h> @@ -802,7 +804,7 @@ namespace armarx::armem::server::obj::instance } - void Segment::storeScene(const std::string& filename, const armem::obj::SceneSnapshot& scene) + void Segment::storeScene(const std::string& filename, const armarx::objects::Scene& scene) { if (const std::optional<std::filesystem::path> path = resolveSceneFilename(filename)) { @@ -820,7 +822,7 @@ namespace armarx::armem::server::obj::instance } - std::optional<armem::obj::SceneSnapshot> + std::optional<armarx::objects::Scene> Segment::loadScene(const std::string& filename) { if (const std::optional<std::filesystem::path> path = resolveSceneFilename(filename)) @@ -834,7 +836,7 @@ namespace armarx::armem::server::obj::instance } - std::optional<armem::obj::SceneSnapshot> + std::optional<armarx::objects::Scene> Segment::loadScene(const std::filesystem::path& path) { ARMARX_INFO << "Loading scene snapshot from: \n" << path; @@ -849,7 +851,7 @@ namespace armarx::armem::server::obj::instance return std::nullopt; } - armem::obj::SceneSnapshot snapshot = j; + armarx::objects::Scene snapshot = j; return snapshot; } @@ -890,9 +892,9 @@ namespace armarx::armem::server::obj::instance } - armem::obj::SceneSnapshot Segment::getSceneSnapshot() const + armarx::objects::Scene Segment::getSceneSnapshot() const { - armem::obj::SceneSnapshot scene; + armarx::objects::Scene scene; segmentPtr->forEachEntity([&scene](wm::Entity & entity) { try @@ -901,7 +903,7 @@ namespace armarx::armem::server::obj::instance std::optional<arondto::ObjectInstance> objectInstance = tryCast<arondto::ObjectInstance>(entityInstance); if (objectInstance) { - armem::obj::SceneSnapshot::Object& object = scene.objects.emplace_back(); + armarx::objects::SceneObject& object = scene.objects.emplace_back(); // object.instanceID = entityInstance.id(); object.className = ObjectID(objectInstance->classID.entityName).getClassID().str(); object.collection = ""; @@ -919,7 +921,7 @@ namespace armarx::armem::server::obj::instance } - void Segment::commitSceneSnapshot(const armem::obj::SceneSnapshot& scene, const std::string& sceneName) + void Segment::commitSceneSnapshot(const armarx::objects::Scene& scene, const std::string& sceneName) { const Time now = TimeUtil::GetTime(); std::map<ObjectID, int> idCounters; @@ -1034,7 +1036,7 @@ namespace armarx::armem::server::obj::instance if (storeButton.wasClicked()) { - armem::obj::SceneSnapshot scene; + armarx::objects::Scene scene; segment.doLocked([&scene, &segment]() { scene = segment.getSceneSnapshot(); diff --git a/source/RobotAPI/libraries/armem_objects/server/instance/Segment.h b/source/RobotAPI/libraries/armem_objects/server/instance/Segment.h index 51972e678155c56e5dade67cc1a7076d773c569b..24f80704f8580c386bfaf346502cccd9fa86c1c6 100644 --- a/source/RobotAPI/libraries/armem_objects/server/instance/Segment.h +++ b/source/RobotAPI/libraries/armem_objects/server/instance/Segment.h @@ -24,9 +24,9 @@ #include "Decay.h" -namespace armarx::armem::obj +namespace armarx::objects { - struct SceneSnapshot; + struct Scene; } namespace armarx::armem::arondto { @@ -148,13 +148,13 @@ namespace armarx::armem::server::obj::instance private: - void storeScene(const std::string& filename, const armem::obj::SceneSnapshot& scene); - std::optional<armem::obj::SceneSnapshot> loadScene(const std::string& filename); - std::optional<armem::obj::SceneSnapshot> loadScene(const std::filesystem::path& path); + void storeScene(const std::string& filename, const armarx::objects::Scene& scene); + std::optional<armarx::objects::Scene> loadScene(const std::string& filename); + std::optional<armarx::objects::Scene> loadScene(const std::filesystem::path& path); std::optional<std::filesystem::path> resolveSceneFilename(const std::string& filename); - armem::obj::SceneSnapshot getSceneSnapshot() const; - void commitSceneSnapshot(const armem::obj::SceneSnapshot& scene, const std::string& sceneName); + armarx::objects::Scene getSceneSnapshot() const; + void commitSceneSnapshot(const armarx::objects::Scene& scene, const std::string& sceneName); void commitSceneSnapshotFromFilename(const std::string& filename, bool lockMemory);