view WebApplications/o3dv.js @ 46:9b2a2fcc9878 nexus

added option to disable Nexus support
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 10 Apr 2024 07:49:45 +0200
parents 970994058acd
children
line wrap: on
line source

/**
 * SPDX-FileCopyrightText: 2023-2024 Sebastien Jodogne, UCLouvain, Belgium
 * SPDX-License-Identifier: GPL-3.0-or-later
 */

/**
 * STL plugin for Orthanc
 * Copyright (C) 2023-2024 Sebastien Jodogne, UCLouvain, Belgium
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 **/


// http://stackoverflow.com/a/21903119/881731
function GetUrlParameter(sParam)
{
  var sPageURL = decodeURIComponent(window.location.search.substring(1));
  var sURLVariables = sPageURL.split('&');

  for (var i = 0; i < sURLVariables.length; i++) {
    var sParameterName = sURLVariables[i].split('=');

    if (sParameterName[0] === sParam) {
      return sParameterName[1] === undefined ? '' : sParameterName[1];
    }
  }

  return '';
};

var instanceId = GetUrlParameter('instance');


window.addEventListener ('load', () => {
  let parentDiv = document.getElementById ('viewer');

  let viewer = new OV.EmbeddedViewer (parentDiv, {
    /*backgroundColor : new OV.RGBAColor (255, 255, 255, 255),
    defaultColor : new OV.RGBColor (200, 200, 200),
    edgeSettings : new OV.EdgeSettings (false, new OV.RGBColor (0, 0, 0), 1)*/

    backgroundColor : new OV.RGBAColor (0, 0, 0, 255),
    defaultColor : new OV.RGBColor (200, 200, 200),
    edgeSettings : new OV.EdgeSettings (false, new OV.RGBColor (255, 255, 255), 1)
  });

  viewer.LoadModelFromInputFiles ([
    new OV.InputFile('model.stl', OV.FileSource.Url, '../../instances/' + instanceId + '/stl'),
  ]);
});