diff --git a/src/utils.js b/src/utils.js index 5d30ea8c..5d75ee1e 100644 --- a/src/utils.js +++ b/src/utils.js @@ -189,6 +189,7 @@ Potree.utils = class{ let selectedPointcloud = null; let closestDistance = Infinity; let closestIntersection = null; + let closestPoint = null; for(let pointcloud of pointclouds){ let point = pointcloud.pick(renderer, camera, ray); @@ -203,6 +204,7 @@ Potree.utils = class{ closestDistance = distance; selectedPointcloud = pointcloud; closestIntersection = point.position; + closestPoint = point; } } @@ -210,7 +212,8 @@ Potree.utils = class{ return { location: closestIntersection, distance: closestDistance, - pointcloud: selectedPointcloud + pointcloud: selectedPointcloud, + point: closestPoint }; }else{ return null; diff --git a/src/utils/Measure.js b/src/utils/Measure.js index d1483561..5961400f 100644 --- a/src/utils/Measure.js +++ b/src/utils/Measure.js @@ -150,6 +150,12 @@ Potree.Measure = class Measure extends THREE.Object3D{ if(I){ let i = this.spheres.indexOf(e.drag.object); if(i !== -1){ + + let point = this.points[i]; + for(let key of Object.keys(I.point).filter(e => e !== "position")){ + point[key] = I.point[key]; + } + this.setPosition(i, I.location); this.dispatchEvent({ "type": "marker_moved", diff --git a/src/viewer/sidebar.js b/src/viewer/sidebar.js index cc1516b3..d5f19f87 100644 --- a/src/viewer/sidebar.js +++ b/src/viewer/sidebar.js @@ -1,22 +1,24 @@ -var createToolIcon = function(icon, title, callback){ - var elImg = document.createElement("img"); - elImg.src = icon; - elImg.onclick = callback; - elImg.style.width = "32px"; - elImg.style.height = "32px"; - elImg.classList.add("button-icon"); - elImg.setAttribute("data-i18n", title); - return elImg; +let createToolIcon = function(icon, title, callback){ + let element = $(` + + `); + + element.click(callback); + + return element; }; function initToolbar(){ // ANGLE - let elToolbar = document.getElementById("tools"); - elToolbar.appendChild(createToolIcon( + let elToolbar = $("#tools"); + elToolbar.append(createToolIcon( Potree.resourcePath + "/icons/angle.png", "[title]tt.angle_measurement", function(){ @@ -31,7 +33,7 @@ function initToolbar(){ )); // POINT - elToolbar.appendChild(createToolIcon( + elToolbar.append(createToolIcon( Potree.resourcePath + "/icons/point.svg", "[title]tt.angle_measurement", function(){ @@ -47,7 +49,7 @@ function initToolbar(){ )); // DISTANCE - elToolbar.appendChild(createToolIcon( + elToolbar.append(createToolIcon( Potree.resourcePath + "/icons/distance.svg", "[title]tt.distance_measurement", function(){ @@ -60,7 +62,7 @@ function initToolbar(){ )); // HEIGHT - elToolbar.appendChild(createToolIcon( + elToolbar.append(createToolIcon( Potree.resourcePath + "/icons/height.svg", "[title]tt.height_measurement", function(){ @@ -75,7 +77,7 @@ function initToolbar(){ )); // AREA - elToolbar.appendChild(createToolIcon( + elToolbar.append(createToolIcon( Potree.resourcePath + "/icons/area.svg", "[title]tt.area_measurement", function(){ @@ -88,14 +90,14 @@ function initToolbar(){ )); // VOLUME - elToolbar.appendChild(createToolIcon( + elToolbar.append(createToolIcon( Potree.resourcePath + "/icons/volume.svg", "[title]tt.volume_measurement", function(){viewer.volumeTool.startInsertion()} )); // PROFILE - elToolbar.appendChild(createToolIcon( + elToolbar.append(createToolIcon( Potree.resourcePath + "/icons/profile.svg", "[title]tt.height_profile", function(){ @@ -105,14 +107,14 @@ function initToolbar(){ )); // CLIP VOLUME - elToolbar.appendChild(createToolIcon( + elToolbar.append(createToolIcon( Potree.resourcePath + "/icons/clip_volume.svg", "[title]tt.clip_volume", function(){viewer.volumeTool.startInsertion({clip: true})} )); // REMOVE ALL - elToolbar.appendChild(createToolIcon( + elToolbar.append(createToolIcon( Potree.resourcePath + "/icons/reset_tools.svg", "[title]tt.remove_all_measurement", function(){ @@ -259,7 +261,7 @@ function initMaterials(){ slide: function( event, ui ) {viewer.setWeightSourceID(ui.value);} }); - var updateHeightRange = function(){ + let updateHeightRange = function(){ let box = viewer.getBoundingBox(); let bWidth = box.max.z - box.min.z; bMin = box.min.z - 0.2 * bWidth; @@ -346,7 +348,7 @@ function initMaterials(){ $('#lblRGBContrast')[0].innerHTML = viewer.getRGBContrast().toFixed(2); $('#lblRGBBrightness')[0].innerHTML = viewer.getRGBBrightness().toFixed(2); - var options = [ + let options = [ "RGB", "RGB and Elevation", "Color", @@ -361,15 +363,16 @@ function initMaterials(){ "Composite", ]; - var elMaterialList = document.getElementById("optMaterial"); - for(var i = 0; i < options.length; i++){ - var option = options[i]; - - var elOption = document.createElement("option"); - elOption.innerHTML = option; - elOption.id = "optMaterial_" + option; - - elMaterialList.appendChild(elOption); + let elMaterialList = $("#optMaterial"); + for(let i = 0; i < options.length; i++){ + let option = options[i]; + let id = "optMaterial_" + option; + + let elOption = $(` + `); + elMaterialList.append(elOption); } let updateMaterialPanel = function(event, ui){ @@ -429,27 +432,28 @@ function initMaterials(){ } function initClassificationList(){ - var addClassificationItem = function(code, name){ - var elClassificationList = document.getElementById("classificationList"); + let elClassificationList = $("#classificationList"); + + let addClassificationItem = function(code, name){ - var elLi = document.createElement("li"); - var elLabel = document.createElement("label"); - var elInput = document.createElement("input"); - var elText = document.createTextNode(" " + name); + let inputID = "chkClassification_" + code; - elInput.id = "chkClassification_" + code; - elInput.type = "checkbox"; - elInput.checked = true; - elInput.onclick = function(event){ + let element = $(` +
  • + +
  • + `); + + let elInput = element.find("input"); + + elInput.click(event => { viewer.setClassificationVisibility(code, event.target.checked); - } + }); - elLabel.style.whiteSpace = "nowrap"; - - elClassificationList.appendChild(elLi); - elLi.appendChild(elLabel); - elLabel.appendChild(elInput); - elLabel.appendChild(elText); + elClassificationList.append(element); }; addClassificationItem(0, "never classified"); @@ -631,57 +635,57 @@ function initAppearance(){ function initNavigation(){ - var elNavigation = document.getElementById("navigation"); + let elNavigation = $("#navigation"); - elNavigation.appendChild(createToolIcon( + elNavigation.append(createToolIcon( Potree.resourcePath + "/icons/earth_controls_1.png", "[title]tt.earth_control", function(){viewer.setNavigationMode(Potree.EarthControls)} )); - elNavigation.appendChild(createToolIcon( + elNavigation.append(createToolIcon( Potree.resourcePath + "/icons/fps_controls.png", "[title]tt.flight_control", function(){viewer.setNavigationMode(Potree.FirstPersonControls)} )); - elNavigation.appendChild(createToolIcon( + elNavigation.append(createToolIcon( Potree.resourcePath + "/icons/orbit_controls.svg", "[title]tt.orbit_control", function(){viewer.setNavigationMode(Potree.OrbitControls)} )); - elNavigation.appendChild(createToolIcon( + elNavigation.append(createToolIcon( Potree.resourcePath + "/icons/focus.svg", "[title]tt.focus_control", function(){viewer.fitToScreen()} )); - elNavigation.appendChild(createToolIcon( + elNavigation.append(createToolIcon( Potree.resourcePath + "/icons/topview.svg", "[title]tt.top_view_control", function(){viewer.setTopView()} )); - elNavigation.appendChild(createToolIcon( + elNavigation.append(createToolIcon( Potree.resourcePath + "/icons/frontview.svg", "[title]tt.front_view_control", function(){viewer.setFrontView()} )); - elNavigation.appendChild(createToolIcon( + elNavigation.append(createToolIcon( Potree.resourcePath + "/icons/leftview.svg", "[title]tt.left_view_control", function(){viewer.setLeftView()} )); - var speedRange = new THREE.Vector2(1, 10*1000); + let speedRange = new THREE.Vector2(1, 10*1000); - var toLinearSpeed = function(value){ + let toLinearSpeed = function(value){ return Math.pow(value, 4) * speedRange.y + speedRange.x; }; - var toExpSpeed = function(value){ + let toExpSpeed = function(value){ return Math.pow((value - speedRange.x) / speedRange.y, 1 / 4); }; @@ -847,10 +851,10 @@ function initAnnotationDetails(){ function initMeasurementDetails(){ - var id = 0; + let id = 0; let trackedItems = new Map(); - var trackMeasurement = function(scene, measurement){ + let trackMeasurement = function(scene, measurement){ id++; let track = { @@ -860,77 +864,93 @@ function initMeasurementDetails(){ }; trackedItems.set(measurement, track); - - var elLi = document.createElement("li"); - var elPanel = document.createElement("div"); - var elPanelHeader = document.createElement("div"); - var elPanelBody = document.createElement("div"); - var elPanelIcon = document.createElement("img"); - var elPanelStretch = document.createElement("span"); - var elPanelRemove = document.createElement("img"); - - elPanel.classList.add("potree-panel", "panel-default"); - elPanelHeader.classList.add("potree-panel-heading", "pv-panel-heading"); + let panelIcon = ""; + let panelTitle = ""; + let removeCallback; if(measurement instanceof Potree.Measure){ if(measurement.showDistances && !measurement.showArea && !measurement.showAngles){ - elPanelIcon.src = Potree.resourcePath + "/icons/distance.svg"; - elPanelStretch.innerHTML = "Distance"; + panelIcon = Potree.resourcePath + "/icons/distance.svg"; + panelTitle = "Distance"; }else if(measurement.showDistances && measurement.showArea && !measurement.showAngles){ - elPanelIcon.src = Potree.resourcePath + "/icons/area.svg"; - elPanelStretch.innerHTML = "Area"; + panelIcon = Potree.resourcePath + "/icons/area.svg"; + panelTitle = "Area"; }else if(measurement.maxMarkers === 1){ - elPanelIcon.src = Potree.resourcePath + "/icons/point.svg"; - elPanelStretch.innerHTML = "Coordinate"; + panelIcon = Potree.resourcePath + "/icons/point.svg"; + panelTitle = "Coordinate"; }else if(!measurement.showDistances && !measurement.showArea && measurement.showAngles){ - elPanelIcon.src = Potree.resourcePath + "/icons/angle.png"; - elPanelStretch.innerHTML = "Angle"; + panelIcon = Potree.resourcePath + "/icons/angle.png"; + panelTitle = "Angle"; }else if(measurement.showHeight){ - elPanelIcon.src = Potree.resourcePath + "/icons/height.svg"; - elPanelStretch.innerHTML = "Height"; + panelIcon = Potree.resourcePath + "/icons/height.svg"; + panelTitle = "Height"; } - elPanelRemove.onclick = function(){scene.removeMeasurement(measurement);}; + removeCallback = () => scene.removeMeasurement(measurement); } else if(measurement instanceof Potree.Profile){ - elPanelIcon.src = Potree.resourcePath + "/icons/profile.svg"; - elPanelStretch.innerHTML = "Profile"; + panelIcon = Potree.resourcePath + "/icons/profile.svg"; + panelTitle = "Profile"; - elPanelRemove.onclick = function(){scene.removeProfile(measurement);}; + removeCallback = () => scene.removeProfile(measurement); } else if(measurement instanceof Potree.Volume){ - elPanelIcon.src = Potree.resourcePath + "/icons/volume.svg"; - elPanelStretch.innerHTML = "Volume"; + panelIcon = Potree.resourcePath + "/icons/volume.svg"; + panelTitle = "Volume"; - elPanelRemove.onclick = function(){scene.removeVolume(volume);}; + removeCallback = () => scene.removeVolume(measurement); } - elPanelIcon.style.width = "16px"; - elPanelIcon.style.height = "16px"; - elPanelStretch.style.flexGrow = 1; - elPanelStretch.style.textAlign = "center"; - elPanelRemove.src = Potree.resourcePath + "/icons/remove.svg"; - elPanelRemove.style.width = "16px"; - elPanelRemove.style.height = "16px"; - elPanelBody.classList.add("panel-body"); + let removeIconPath = Potree.resourcePath + "/icons/remove.svg"; - elLi.appendChild(elPanel); - elPanel.appendChild(elPanelHeader); - elPanelHeader.appendChild(elPanelIcon); - elPanelHeader.appendChild(elPanelStretch); - elPanelHeader.appendChild(elPanelRemove); - elPanel.appendChild(elPanelBody); + let elLi = $(` +
  • +
    + + +
    + + ${panelTitle} + +
    + + +
    + +
    +
    +
  • + `); + $("#measurement_details").append(elLi); - document.getElementById("measurement_details").appendChild(elLi); + let elPanelBody = elLi.find(".panel-body"); + let elPanelHeader = elLi.find(".potree-panel-heading"); + let elRemove = elPanelHeader.find("img:last"); + elRemove.click(removeCallback); + let widthListener = null; - var updateDisplay = function(event){ + let updateDisplay = function(event){ - $(elPanelBody).empty(); + elPanelBody.empty(); + measurement.removeEventListener("width_changed", widthListener); + if(measurement instanceof Potree.Profile){ - var elLi = $('
  • '); - var elText = document.createTextNode("width: "); - var elWidthLabel = $(''); - var elWidthSlider = $('
    '); + + let widthText = measurement.getWidth() ? + Potree.utils.addCommas(measurement.getWidth().toFixed(3)) : "-"; + + let labelID = "lblProfileWidth_" + id; + let sliderID = "sldProfileWidth_" + id; + + let elLi = $(` +
  • + width: ${widthText} +
    +
  • ` + ); + + let elWidthLabel = elLi.find(`#${labelID}`); + let elWidthSlider = elLi.find(`#${sliderID}`); elWidthSlider.slider({ value: Math.pow((measurement.getWidth() / 1000), 1/4).toFixed(3), @@ -938,43 +958,32 @@ function initMeasurementDetails(){ max: 1, step: 0.01, slide: function(event, ui){ - var val = Math.pow(ui.value, 4) * 1000; + let val = Math.pow(ui.value, 4) * 1000; measurement.setWidth(val); } }); - if(measurement.getWidth()){ - elWidthLabel.html(Potree.utils.addCommas(measurement.getWidth().toFixed(3))); - }else{ - elWidthLabel.html("-"); - } - if(widthListener === null){ - widthListener = function(event){ - var val = Math.pow((event.width / 1000), 1/4); - elWidthLabel.html(Potree.utils.addCommas(event.width.toFixed(3))); - elWidthSlider.slider({value: val}); - }; - } - if(!measurement.hasEventListener("width_changed", widthListener)){ - measurement.addEventListener("width_changed", widthListener); - } - elLi.append(elText); - elLi.append(elWidthLabel); - elLi.append(elWidthSlider); + widthListener = (event) => { + let val = Math.pow((event.width / 1000), 1/4); + elWidthLabel.html(Potree.utils.addCommas(event.width.toFixed(3))); + elWidthSlider.slider({value: val}); + }; - elPanelBody.appendChild(elLi[0]); + measurement.addEventListener("width_changed", widthListener); + + elPanelBody.append(elLi); } - var positions = []; - var points; + let positions = []; + let points; if(measurement instanceof Potree.Measure){ points = measurement.points; - for(var i = 0; i < points.length; i++){ + for(let i = 0; i < points.length; i++){ positions.push(points[i].position); } - } else if(measurement instanceof Potree.Profile){ + }else if(measurement instanceof Potree.Profile){ positions = measurement.points; } @@ -990,188 +999,170 @@ function initMeasurementDetails(){ let txt = height.toFixed(3); - var elNodeHeight = $('
    ').addClass("measurement-detail-node-marker"); - elNodeHeight.html(txt); - $(elPanelBody).append(elNodeHeight); + let elNodeHeight = $(` +
    + ${txt} +
    `); + elPanelBody.append(elNodeHeight); } - for(var i = 0; i < positions.length; i++){ - // TODO clean this up from the toGeo legacy - var point = positions[i]; - var geoCoord = point; - - var txt = geoCoord.x.toFixed(2) + ", "; - txt += (geoCoord.y).toFixed(2) + ", "; - txt += geoCoord.z.toFixed(2); + for(let i = 0; i < positions.length; i++){ + let point = positions[i]; + + let txt = [point.x, point.y, point.z].map(p => p.toFixed(3)).join(", "); if(measurement && !measurement.showHeight){ - var elNodeMarker = $('
    ').addClass("measurement-detail-node-marker"); - elNodeMarker.html(txt); - $(elPanelBody).append(elNodeMarker); + let elNodeMarker = $(` +
    + ${txt} +
    `); + elPanelBody.append(elNodeMarker); } if(i < positions.length - 1){ if(measurement && measurement.showDistances){ - var elEdge = $('
    ').addClass("measurement-detail-edge"); - $(elPanelBody).append(elEdge); + let elEdge = $('
    '); + elPanelBody.append(elEdge); - var nextPoint = positions[i+1]; - var nextGeo = nextPoint; - var distance = nextGeo.distanceTo(geoCoord); - var txt = Potree.utils.addCommas(distance.toFixed(2)); + let nextPoint = positions[i+1]; + let distance = nextPoint.distanceTo(point); + let txt = Potree.utils.addCommas(distance.toFixed(3)); - var elNodeDistance = $('
    ').addClass("measurement-detail-node-distance"); - elNodeDistance.html(txt); + let elNodeDistance = $(` +
    + ${txt} +
    `); - $(elPanelBody).append(elNodeDistance); + elPanelBody.append(elNodeDistance); } } if(measurement && measurement.showAngles){ - var elEdge = $('
    ').addClass("measurement-detail-edge"); + let elEdge = $('
    '); $(elPanelBody).append(elEdge); - var angle = measurement.getAngle(i); - var txt = Potree.utils.addCommas((angle*(180.0/Math.PI)).toFixed(1)) + '\u00B0'; - var elNodeAngle = $('
    ').addClass("measurement-detail-node-angle"); - elNodeAngle.html(txt); + let angle = measurement.getAngle(i); + let txt = Potree.utils.addCommas((angle*(180.0/Math.PI)).toFixed(1)) + '\u00B0'; + let elNodeAngle = $(`
    ${txt}
    `); $(elPanelBody).append(elNodeAngle); } if(i < positions.length - 1){ - var elEdge = $('
    ').addClass("measurement-detail-edge"); + let elEdge = $('
    '); $(elPanelBody).append(elEdge); } } if(points && points.length === 1){ - var point = points[0]; + let point = points[0]; - var elTable = $('').css("width", "100%"); + let elTable = $('
    '); $(elPanelBody).append(elTable); if(point.color){ - var color = point.color; + let color = point.color; + let text = color.join(", "); - var elTr = $(''); - var elKey = $(' + + + + `)); } - if(typeof point.intensity !== "undefined"){ - var intensity = point.intensity; + if(point.intensity !== undefined){ + let intensity = point.intensity; - var elTr = $(''); - var elKey = $(' + + + + `)); } - if(typeof point.classification !== "undefined"){ - var classification = point.classification; + if(point.classification !== undefined){ + let classification = point.classification; - var elTr = $(''); - var elKey = $(' + + + + `)); } - if(typeof point.returnNumber !== "undefined"){ - var returnNumber = point.returnNumber; + if(point.returnNumber !== undefined){ + let returnNumber = point.returnNumber; - var elTr = $(''); - var elKey = $(' + + + + `)); } if(typeof point.pointSourceID !== "undefined"){ - var source = point.pointSourceID; + let source = point.pointSourceID; - var elTr = $(''); - var elKey = $(' + + + + `)); } } if(measurement && measurement.showDistances && measurement.points.length > 1){ - var txt = "Total: " + Potree.utils.addCommas(measurement.getTotalDistance().toFixed(3)); + let txt = "Total: " + Potree.utils.addCommas(measurement.getTotalDistance().toFixed(3)); - var elNodeTotalDistance = $('
    ').addClass("measurement-detail-node-distance"); - elNodeTotalDistance.html(txt); - - $(elPanelBody).append(elNodeTotalDistance); + $(elPanelBody).append($(` +
    ${txt}
    + `)); } if(measurement && measurement.showArea){ - var txt = Potree.utils.addCommas(measurement.getArea().toFixed(1)) + "\u00B2"; + let txt = Potree.utils.addCommas(measurement.getArea().toFixed(1)) + "\u00B2"; - var elNodeArea = $('
    ').addClass("measurement-detail-node-area"); - elNodeArea.html(txt); - - $(elPanelBody).append(elNodeArea); + $(elPanelBody).append($(` +
    ${txt}
    + `)); } if(measurement instanceof Potree.Profile){ - var elOpenProfileWindow = $('') - .addClass("measurement-detail-button"); - elOpenProfileWindow[0].onclick = function(){ + let elOpenProfileWindow = $(` + + `); + + elOpenProfileWindow.click(e => { viewer._2dprofile.show(); viewer._2dprofile.draw(measurement); - }; - $(elPanelBody).append(elOpenProfileWindow); + }); + + elPanelBody.append(elOpenProfileWindow); } let doExport = measurement.showDistances && !measurement.showAngles; if(doExport){ - let elBottomBar = $(` - - `); + let elBottomBar = $(` + + + `); $(elPanelBody).append(elBottomBar); { let icon = Potree.resourcePath + "/icons/file_geojson.svg"; - let elDownload = $(``); + let elDownload = $(` + + + `); elDownload.click(function(e){ let geojson = Potree.GeoJSONExporter.toString(measurement); @@ -1184,7 +1175,10 @@ function initMeasurementDetails(){ { let icon = Potree.resourcePath + "/icons/file_dxf.svg"; - let elDownload = $(``); + let elDownload = $(` + + + `); elDownload.click(function(e){ let dxf = Potree.DXFExporter.toString(measurement); @@ -1202,9 +1196,6 @@ function initMeasurementDetails(){ if(measurement instanceof Potree.Measure){ let onremove = function(event){ if(event.measurement === measurement){ - //scene.removeEventListener("marker_added", updateDisplay); - //scene.removeEventListener("marker_removed", updateDisplay); - //scene.removeEventListener("marker_moved", updateDisplay); $(elLi).remove(); } }; @@ -1265,11 +1256,11 @@ function initMeasurementDetails(){ trackedItem.stopTracking(); }); - for(var i = 0; i < scene.measurements.length; i++){ + for(let i = 0; i < scene.measurements.length; i++){ trackMeasurement(scene, scene.measurements[i]); } - for(var i = 0; i < scene.profiles.length; i++){ + for(let i = 0; i < scene.profiles.length; i++){ trackMeasurement(scene, scene.profiles[i]); } @@ -1289,64 +1280,60 @@ function initMeasurementDetails(){ function initSceneList(){ - var scenelist = $('#sceneList'); + let scenelist = $('#sceneList'); - var id = 0; - // this works but it looks so wrong. any better way to create a closure around pointcloud? - var addPointcloud = function(pointcloud){ - (function(pointcloud){ - var elLi = $('
  • '); - var elLabel = $('
  • + +
  • + `); + + let elInput = elPointclouds.find("input"); + let elPointCloudLabel = elPointclouds.find("span"); + + elInput.click(function(event){ + pointcloud.visible = event.target.checked; + if(viewer._2dprofile){ + viewer._2dprofile.redraw(); + } + }); + + scenelist.append(elPointclouds); + + pointcloud.addEventListener("name_changed", function(e){ + if(e.name){ + elPointCloudLabel.innerHTML = " " + e.name; + }else{ + elPointCloudLabel.innerHTML = " point cloud " + id; + } + }); + + id++; }; - for(var i = 0; i < viewer.scene.pointclouds.length; i++){ - var pointcloud = viewer.scene.pointclouds[i]; + for(let pointcloud of viewer.scene.pointclouds){ addPointcloud(pointcloud); } viewer.addEventListener("scene_changed", (e) => { scenelist.empty(); - let scene = e.scene; - for(var i = 0; i < scene.pointclouds.length; i++){ - var pointcloud = scene.pointclouds[i]; + for(let pointcloud of e.scene.pointclouds){ addPointcloud(pointcloud); } }); - // TODO update scene list on scene switch viewer.addEventListener("pointcloud_loaded", function(event){ addPointcloud(event.pointcloud); }); @@ -1373,7 +1360,6 @@ function initSceneList(){ }; initSettings = function(){ - //
  • Min Node Size:
  • $( "#sldMinNodeSize" ).slider({ value: viewer.getMinNodeSize(), @@ -1389,7 +1375,7 @@ initSettings = function(){ }); - var toClipModeCode = function(string){ + let toClipModeCode = function(string){ if(string === "No Clipping"){ return Potree.ClipMode.DISABLED; }else if(string === "Highlight Inside"){ @@ -1399,7 +1385,7 @@ initSettings = function(){ } }; - var toClipModeString = function(code){ + let toClipModeString = function(code){ if(code === Potree.ClipMode.DISABLED){ return "No Clipping"; }else if(code === Potree.ClipMode.HIGHLIGHT_INSIDE){ diff --git a/src/viewer/viewer.js b/src/viewer/viewer.js index 0474ab51..b7427517 100644 --- a/src/viewer/viewer.js +++ b/src/viewer/viewer.js @@ -1577,7 +1577,6 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{ let expand = screenSize > annotation.collapseThreshold || annotation.boundingBox.containsPoint(this.scene.camera.position); if(!expand){ - // TODO make sure descendants are invisible annotation.traverseDescendants(descendant => { if(!descendant.visible){ return; @@ -1603,65 +1602,6 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{ } } }); - - //let distances = []; - //let annotations = this.scene.annotations.descendants(); - // - //let i = 0; - //for(let annotation of annotations){ - // - // let element = annotation.domElement[0]; - // - // let position = annotation.position; - // if(!position){ - // position = annotation.boundingBox.getCenter(); - // } - // - // let distance = viewer.scene.camera.position.distanceTo(position); - // - // let screenPos = new THREE.Vector3(); - // let screenSize = 0; - // { - // // SCREEN POS - // screenPos.copy(position).project(this.scene.camera); - // screenPos.x = this.renderArea.clientWidth * (screenPos.x + 1) / 2; - // screenPos.y = this.renderArea.clientHeight * (1 - (screenPos.y + 1) / 2); - // - // screenPos.x = Math.floor(screenPos.x - element.clientWidth / 2); - // screenPos.y = Math.floor(screenPos.y - annotation.elTitlebar[0].clientHeight / 2); - // - // // SCREEN SIZE - // let fov = Math.PI * viewer.scene.camera.fov / 180; - // let slope = Math.tan(fov / 2.0); - // let projFactor = 0.5 * this.renderArea.clientHeight / (slope * distance); - // - // let radius = annotation.boundingBox.getBoundingSphere().radius; - // screenSize = radius * projFactor; - // } - // - // element.style.left = screenPos.x + "px"; - // element.style.top = screenPos.y + "px"; - // - // - // let visible = screenSize > 100 && (-1 <= screenPos.z && screenPos.z <= 1); - // - // if(visible){ - // element.style.display = "inline-block"; - // }else{ - // element.style.display = "none"; - // } - // - // annotation.visible = visible; - // - // let zIndex = 10000000 - distance * (10000000 / this.scene.camera.far); - // if(annotation.descriptionVisible){ - // zIndex += 10000000; - // } - // - // element.style.zIndex = parseInt(zIndex); - // - // i++; - //} } update(delta, timestamp){
    ').css("padding", "1px 5px"); - var elValue = $('').css("width", "100%").css("padding", "1px 5px"); - - var value = parseInt(color[0]) - + ", " + parseInt(color[1]) - + ", " + parseInt(color[2]); - - elKey.html("rgb"); - elValue.html(value); - - elTable.append(elTr); - elTr.append(elKey); - elTr.append(elValue); + elTable.append($(` +
    rgb${text}
    ').css("padding", "1px 5px"); - var elValue = $('').css("width", "100%").css("padding", "1px 5px"); - - elKey.html("intensity"); - elValue.html(intensity); - - elTable.append(elTr); - elTr.append(elKey); - elTr.append(elValue); + elTable.append($(` +
    intensity${intensity}
    ').css("padding", "1px 5px"); - var elValue = $('').css("width", "100%").css("padding", "1px 5px"); - - elKey.html("classification"); - elValue.html(classification); - - elTable.append(elTr); - elTr.append(elKey); - elTr.append(elValue); + elTable.append($(` +
    classification${classification}
    ').css("padding", "1px 5px"); - var elValue = $('').css("width", "100%").css("padding", "1px 5px"); - - elKey.html("return nr."); - elValue.html(returnNumber); - - elTable.append(elTr); - elTr.append(elKey); - elTr.append(elValue); + elTable.append($(` +
    return nr.${returnNumber}
    ').css("padding", "1px 5px"); - var elValue = $('').css("width", "100%").css("padding", "1px 5px"); - - elKey.html("source"); - elValue.html(source); - - elTable.append(elTr); - elTr.append(elKey); - elTr.append(elValue); + elTable.append($(` +
    source${source}