comparison WebApplications/o3dv.js @ 36:13698d34e059

preparing to include O3DV
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 05 Apr 2024 07:42:06 +0200
parents
children 970994058acd
comparison
equal deleted inserted replaced
35:ee3bc8f7df5b 36:13698d34e059
1 /**
2 * SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium
3 * SPDX-License-Identifier: GPL-3.0-or-later
4 */
5
6 /**
7 * STL plugin for Orthanc
8 * Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium
9 *
10 * This program is free software: you can redistribute it and/or
11 * modify it under the terms of the GNU General Public License as
12 * published by the Free Software Foundation, either version 3 of the
13 * License, or (at your option) any later version.
14 *
15 * This program is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program. If not, see <http://www.gnu.org/licenses/>.
22 **/
23
24
25 // http://stackoverflow.com/a/21903119/881731
26 function GetUrlParameter(sParam)
27 {
28 var sPageURL = decodeURIComponent(window.location.search.substring(1));
29 var sURLVariables = sPageURL.split('&');
30
31 for (var i = 0; i < sURLVariables.length; i++) {
32 var sParameterName = sURLVariables[i].split('=');
33
34 if (sParameterName[0] === sParam) {
35 return sParameterName[1] === undefined ? '' : sParameterName[1];
36 }
37 }
38
39 return '';
40 };
41
42 var instanceId = GetUrlParameter('instance');
43
44
45 window.addEventListener ('load', () => {
46 let parentDiv = document.getElementById ('viewer');
47
48 let viewer = new OV.EmbeddedViewer (parentDiv, {
49 /*backgroundColor : new OV.RGBAColor (255, 255, 255, 255),
50 defaultColor : new OV.RGBColor (200, 200, 200),
51 edgeSettings : new OV.EdgeSettings (false, new OV.RGBColor (0, 0, 0), 1)*/
52
53 backgroundColor : new OV.RGBAColor (0, 0, 0, 255),
54 defaultColor : new OV.RGBColor (200, 200, 200),
55 edgeSettings : new OV.EdgeSettings (false, new OV.RGBColor (255, 255, 255), 1)
56 });
57
58 viewer.LoadModelFromInputFiles ([
59 new OV.InputFile('model.stl', OV.FileSource.Url, '../../instances/' + instance + '/stl'),
60 ]);
61 });