changeset 464:41b7e844fdbc annotations

storing properties inside the openlayers features
author Sebastien Jodogne <s.jodogne@gmail.com>
date Sun, 02 Aug 2026 13:07:25 +0200
parents 9339edf2f19d
children 3b87594bff1a
files ViewerPlugin/WebApplication/viewer.js
diffstat 1 files changed, 10 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/ViewerPlugin/WebApplication/viewer.js	Sun Aug 02 13:01:34 2026 +0200
+++ b/ViewerPlugin/WebApplication/viewer.js	Sun Aug 02 13:07:25 2026 +0200
@@ -414,7 +414,8 @@
   selectAnnotation.on('select', function(e) {
     $('#annotation-info').empty();
     if (e.selected.length === 1) {
-      var geometry = e.selected[0].getGeometry();
+      var feature = e.selected[0];
+      var geometry = feature.getGeometry();
       if (geometry.getType() === 'LineString') {
         AddReadOnlyProperty('Length', FormatLength(geometry, map.getView().getProjection()));
       } else {
@@ -422,18 +423,18 @@
         AddReadOnlyProperty('Length', '1.23 mm');
         AddReadOnlyProperty('Bounding box', '100 x 200 px');
         AddReadOnlyProperty('Surface', '0.05 mm²');
-        AddEditableProperty('Taxonomy', 'Value', function(v) {
-          console.log('Taxonomy changed to: ' + v);
+        AddEditableProperty('Label', feature.get('label') || '', function(v) {
+          feature.set('label', v);
         });
-        AddDropdownProperty('Tissue type', [
-          { value: 'tumor',  label: 'Tumor' },
-          { value: 'stroma', label: 'Stroma' },
+        AddDropdownProperty('Category', [
+          { value: 'tumor',    label: 'Tumor' },
+          { value: 'stroma',   label: 'Stroma' },
           { value: 'necrosis', label: 'Necrosis' }
-        ], 'tumor', function(v) {
-          console.log('Tissue type changed to: ' + v);
+        ], feature.get('category') || '', function(v) {
+          feature.set('category', v);
         });
+        bootstrap.Offcanvas.getOrCreateInstance($('#right-panel')[0]).show();
       }
-      bootstrap.Offcanvas.getOrCreateInstance($('#right-panel')[0]).show();
     }
   });