comparison ViewerPlugin/Plugin.cpp @ 262:b9eab260a372 iiif

serving Mirador
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 10 Jul 2023 09:21:48 +0200
parents c72fbdecdc38
children 14f182958ca7
comparison
equal deleted inserted replaced
261:c72fbdecdc38 262:b9eab260a372
214 else if (f == "ol.css") 214 else if (f == "ol.css")
215 { 215 {
216 resource = Orthanc::EmbeddedResources::OPENLAYERS_CSS; 216 resource = Orthanc::EmbeddedResources::OPENLAYERS_CSS;
217 mime = "text/css"; 217 mime = "text/css";
218 } 218 }
219 else if (f == "mirador.html")
220 {
221 resource = Orthanc::EmbeddedResources::MIRADOR_HTML;
222 mime = "text/html";
223 }
219 else 224 else
220 { 225 {
221 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource); 226 throw Orthanc::OrthancException(Orthanc::ErrorCode_UnknownResource);
222 } 227 }
223 228
281 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(viewer.html)", true); 286 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(viewer.html)", true);
282 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(viewer.js)", true); 287 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(viewer.js)", true);
283 OrthancPlugins::RegisterRestCallback<ServePyramid>("/wsi/pyramids/([0-9a-f-]+)", true); 288 OrthancPlugins::RegisterRestCallback<ServePyramid>("/wsi/pyramids/([0-9a-f-]+)", true);
284 OrthancPlugins::RegisterRestCallback<ServeTile>("/wsi/tiles/([0-9a-f-]+)/([0-9-]+)/([0-9-]+)/([0-9-]+)", true); 289 OrthancPlugins::RegisterRestCallback<ServeTile>("/wsi/tiles/([0-9a-f-]+)/([0-9-]+)/([0-9-]+)/([0-9-]+)", true);
285 290
291 bool serveMirador = true; // TODO => CONFIG
292
293 if (serveMirador)
294 {
295 OrthancPlugins::RegisterRestCallback<ServeFile>("/wsi/app/(mirador.html)", true);
296 }
297
286 { 298 {
287 // TODO => CONFIG 299 // TODO => CONFIG
288 std::string url = "http://localhost:8042/wsi/iiif"; 300 std::string url = "http://localhost:8042/wsi/iiif";
289 301
290 if (url.empty() || 302 if (url.empty() ||
294 } 306 }
295 307
296 InitializeIIIF(url); 308 InitializeIIIF(url);
297 } 309 }
298 310
299 // Extend the default Orthanc Explorer with custom JavaScript for WSI 311 {
300 std::string explorer; 312 // Extend the default Orthanc Explorer with custom JavaScript for WSI
301 Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER); 313
302 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str()); 314 std::string explorer;
315 Orthanc::EmbeddedResources::GetFileResource(explorer, Orthanc::EmbeddedResources::ORTHANC_EXPLORER);
316
317 std::map<std::string, std::string> dictionary;
318 dictionary["SERVE_MIRADOR"] = (serveMirador ? "true" : "false");
319 explorer = Orthanc::Toolbox::SubstituteVariables(explorer, dictionary);
320
321 OrthancPluginExtendOrthancExplorer(OrthancPlugins::GetGlobalContext(), explorer.c_str());
322 }
303 323
304 return 0; 324 return 0;
305 } 325 }
306 326
307 327