changeset 558:76d788aef4b0 annotations

refactoring
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 01 Sep 2026 15:31:04 +0200
parents 79205cedcf39
children d90ff66a934b
files ViewerPlugin/Annotations/AnnotationsRestApi.cpp
diffstat 1 files changed, 22 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/ViewerPlugin/Annotations/AnnotationsRestApi.cpp	Tue Sep 01 15:25:22 2026 +0200
+++ b/ViewerPlugin/Annotations/AnnotationsRestApi.cpp	Tue Sep 01 15:31:04 2026 +0200
@@ -725,9 +725,24 @@
       return AddUserLayer(new UserLayer(color, name));
     }
 
-    void DeleteUserLayer(const std::string& layerId)  // TODO REMOVE
+    LayersCollection& GetUserLayers()
+    {
+      return userLayers_;
+    }
+
+    const LayersCollection& GetUserLayers() const
     {
-      userLayers_.DeleteLayer(layerId);
+      return userLayers_;
+    }
+
+    LayersCollection& GetSharedLayers()
+    {
+      return sharedLayers_;
+    }
+
+    const LayersCollection& GetSharedLayers() const
+    {
+      return sharedLayers_;
     }
 
     virtual void Serialize(Json::Value& serialized) const ORTHANC_OVERRIDE
@@ -737,14 +752,14 @@
       sharedLayers_.Serialize(serialized[KEY_SHARED_LAYERS]);
     }
 
-    bool HasLayerSharedWith(const UserId& user) const  // TODO REMOVE
+    bool HasLayerSharedWith(const UserId& user) const
     {
       return userLayers_.HasLayerSharedWith(user);
     }
 
     void ListLayersSharedWith(Json::Value& target,
                               const UserId& author,
-                              const UserId& user) const  // TODO REMOVE
+                              const UserId& user) const
     {
       return userLayers_.ListLayersSharedWith(target, author, user);
     }
@@ -761,16 +776,6 @@
         sharedLayers_.AddLayer(new SharedLayer(author, layer));
       }
     }
-
-    void RemoveSharedLayer(const std::string& layerId)  // TODO REMOVE
-    {
-      sharedLayers_.DeleteLayer(layerId);
-    }
-
-    void ListSharedLayers(std::list<std::string>& target) const  // TODO REMOVE
-    {
-      sharedLayers_.ListLayers(target);
-    }
   };
 
 
@@ -1074,7 +1079,7 @@
         if (IsValid())
         {
           std::list<std::string> layerIds;
-          userSettings_->ListSharedLayers(layerIds);
+          userSettings_->GetSharedLayers().ListLayers(layerIds);
 
           for (std::list<std::string>::const_iterator it = layerIds.begin(); it != layerIds.end(); ++it)
           {
@@ -1150,7 +1155,7 @@
       void DeleteUserLayer(const std::string& layerId)
       {
         assert(userSettings_ != NULL);
-        userSettings_->DeleteUserLayer(layerId);
+        userSettings_->GetUserLayers().DeleteLayer(layerId);
         Commit();
       }
 
@@ -1181,7 +1186,7 @@
       void RemoveSharedLayer(const std::string& layerId)
       {
         assert(userSettings_ != NULL);
-        userSettings_->RemoveSharedLayer(layerId);
+        userSettings_->GetSharedLayers().DeleteLayer(layerId);
         Commit();
       }