changeset 525:1ad50524d089 annotations

save the creation time of annotations
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 27 Aug 2026 07:09:30 +0200
parents 23d3f07a2314
children e005c429ce05
files ViewerPlugin/WebApplication/viewer.js
diffstat 1 files changed, 18 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/ViewerPlugin/WebApplication/viewer.js	Thu Aug 27 06:40:45 2026 +0200
+++ b/ViewerPlugin/WebApplication/viewer.js	Thu Aug 27 07:09:30 2026 +0200
@@ -247,6 +247,11 @@
                   feature.set('label', label);
                 }
 
+                var date = response.data.features[i]['creation-datetime'];  // This is a numerical timestamp
+                if (date !== undefined) {
+                  feature.set('creation-datetime', new Date(date));
+                }
+
                 that.drawSource.addFeature(feature);
               }
             }
@@ -287,6 +292,11 @@
               item['label'] = label;
             }
 
+            var date = feature.get('creation-datetime');
+            if (date !== undefined) {
+              item['creation-datetime'] = date.getTime();
+            }
+
             features.push(item);
           }
         });
@@ -945,6 +955,7 @@
 
       function onDrawEnd(e, callPreventDoubleClickZoom) {
         e.feature.set('layer-id', app.activeUserLayerId);
+        e.feature.set('creation-datetime', new Date());
         if (callPreventDoubleClickZoom) {
           preventDoubleClickZoom();
         }
@@ -971,6 +982,13 @@
           var feature = e.selected[0];
           that.selectedFeature = feature;
 
+          var date = feature.get('creation-datetime');
+          if (date === undefined) {
+            that.AddReadOnlyProperty('Date', '');
+          } else {
+            that.AddReadOnlyProperty('Date', date.toLocaleString());
+          }
+
           var geometry = feature.getGeometry();
 
           if (geometry.getType() === 'LineString') {