diff Applications/StoneWebViewer/WebApplication/app.js @ 1714:a878e807cd96

configuration option "DicomCacheSize", warning if cache should be larger
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 30 Nov 2020 17:57:10 +0100
parents aec45e0b2528
children 65c03d33c345
line wrap: on
line diff
--- a/Applications/StoneWebViewer/WebApplication/app.js	Mon Nov 30 17:09:46 2020 +0100
+++ b/Applications/StoneWebViewer/WebApplication/app.js	Mon Nov 30 17:57:10 2020 +0100
@@ -1023,6 +1023,11 @@
   stone.SetDicomWebRoot(app.globalConfiguration.DicomWebRoot,
                         true /* assume "/rendered" is available in DICOMweb (could be a configuration option) */);
   stone.SetSoftwareRendering(localStorage.settingSoftwareRendering == '1');
+
+  if ('DicomCacheSize' in app.globalConfiguration) {
+    stone.SetDicomCacheSize(app.globalConfiguration.DicomCacheSize);
+  }
+  
   console.warn('Stone properly initialized');
 
   app.SetCombinedToolActions();
@@ -1176,29 +1181,30 @@
 
 
 window.addEventListener('message', function(e) {
-  if ('type' in e.data &&
-      (e.data.type == 'show-osirix-annotations')) {
-    var expectedOrigin = app.globalConfiguration['ExpectedMessageOrigin'];
-    
-    if (expectedOrigin === undefined) {
-      alert('Dynamic actions are disabled in the Stone Web viewer, ' +
-            'set the configuration option "ExpectedMessageOrigin".');
-    }    
-    else if (expectedOrigin != '*' &&
-             e.origin !== expectedOrigin) {
-      alert('Bad origin for a dynamic action in the Stone Web viewer: "' + e.origin +
-            '", whereas the message must have origin: "' + expectedOrigin + '"');
+  if ('type' in e.data) {
+    if (e.data.type == 'show-osirix-annotations') {
+      var expectedOrigin = app.globalConfiguration['ExpectedMessageOrigin'];
+      
+      if (expectedOrigin === undefined) {
+        alert('Dynamic actions are disabled in the Stone Web viewer, ' +
+              'set the configuration option "ExpectedMessageOrigin".');
+      }    
+      else if (expectedOrigin != '*' &&
+               e.origin !== expectedOrigin) {
+        alert('Bad origin for a dynamic action in the Stone Web viewer: "' + e.origin +
+              '", whereas the message must have origin: "' + expectedOrigin + '"');
+      }
+      else if (e.data.type == 'show-osirix-annotations') {
+        var clear = true;  // Whether to clear previous annotations
+        if ('clear' in e.data) {
+          clear = e.data.clear;
+        }
+        
+        app.LoadOsiriXAnnotations(e.data.xml, clear);
+      }
     }
-    else if (e.data.type == 'show-osirix-annotations') {
-      var clear = true;  // Whether to clear previous annotations
-      if ('clear' in e.data) {
-        clear = e.data.clear;
-      }
-      
-      app.LoadOsiriXAnnotations(e.data.xml, clear);
+    else {
+      console.log('Unknown type of dynamic action in the Stone Web viewer: ' + e.data.type);
     }
   }
-  else {
-    console.log('Unknown type of dynamic action in the Stone Web viewer: ' + e.data.type);
-  }
 });