diff --git a/app/static/app/js/vendor/potree/build/potree/potree.js b/app/static/app/js/vendor/potree/build/potree/potree.js index 5180268b8..ea2d957eb 100644 --- a/app/static/app/js/vendor/potree/build/potree/potree.js +++ b/app/static/app/js/vendor/potree/build/potree/potree.js @@ -54236,7 +54236,8 @@ { // coordinate labels let coordinateLabel = this.coordinateLabels[0]; - let msg = position.toArray().map(p => Utils.addCommas(p.toFixed(2))).join(" / "); + let positions = position.toArray(); + let msg = `${Utils.addCommas(positions[0].toFixed(3))} / ${Utils.addCommas(positions[1].toFixed(3))} / ${Utils.addCommas((positions[2] / window.viewer.lengthUnit.unitspermeter * window.viewer.lengthUnitDisplay.unitspermeter).toFixed(3))}`; coordinateLabel.setText(msg); coordinateLabel.visible = this.showCoordinates; @@ -54405,8 +54406,8 @@ const N = AC.clone().cross(AB).normalize(); const center = Potree.Utils.computeCircleCenter(A, B, C); - const radius = center.distanceTo(A); - + let radius = center.distanceTo(A); + if (isNaN(radius)) radius = 0; const scale = radius / 20; circleCenter.position.copy(center); @@ -54429,11 +54430,16 @@ circleLine.position.copy(center); circleLine.scale.set(radius, radius, radius); circleLine.lookAt(target); + + let suffix = ""; + if(this.lengthUnit != null && this.lengthUnitDisplay != null){ + radius = radius / this.lengthUnit.unitspermeter * this.lengthUnitDisplay.unitspermeter; + suffix = this.lengthUnitDisplay.code; + } circleRadiusLabel.visible = true; circleRadiusLabel.position.copy(center.clone().add(B).multiplyScalar(0.5)); - circleRadiusLabel.setText(`${radius.toFixed(3)}`); - + circleRadiusLabel.setText(`${radius.toFixed(3)} ${suffix}`); } } @@ -72569,6 +72575,8 @@ void main() { }); let headerValues = []; + const skipFields = ["intensity", "return number", "number of returns", "source id", "gpsTime"]; + for (let attribute of attributes) { let itemSize = points.data[attribute].length / points.numPoints; @@ -72580,16 +72588,17 @@ void main() { for (let i = 0; i < itemSize; i++) { headerValues.push(`${attribute}_${i}`); } - } else { + } else if (skipFields.indexOf(attribute) === -1){ headerValues.push(attribute); } } - string = headerValues.join(', ') + '\n'; + string = headerValues.join(',') + '\n'; for (let i = 0; i < points.numPoints; i++) { let values = []; for (let attribute of attributes) { + if (skipFields.indexOf(attribute) !== -1) continue; let itemSize = points.data[attribute].length / points.numPoints; let value = points.data[attribute] .subarray(itemSize * i, itemSize * i + itemSize) @@ -72597,7 +72606,7 @@ void main() { values.push(value); } - string += values.join(', ') + '\n'; + string += values.join(',') + '\n'; } return string; @@ -73116,24 +73125,20 @@ void main() { transform = value => value / scale + offset; } - - - - if (attributeName === 'position') { - let values = [...position].map(v => Utils.addCommas(v.toFixed(3))); + let values = [...position]; html += ` x - ${values[0]} + ${Utils.addCommas(values[0].toFixed(3))} y - ${values[1]} + ${Utils.addCommas(values[1].toFixed(3))} z - ${values[2]} + ${Utils.addCommas((values[2] / this.viewer.lengthUnit.unitspermeter * this.viewer.lengthUnitDisplay.unitspermeter).toFixed(3))} `; } else if (attributeName === 'rgba') { html += ` @@ -73149,10 +73154,10 @@ void main() { ${attributeName} ${value.toFixed(3)} `; - } else { + } else if (attributeName === "classification") { html += ` - ${attributeName} + ${attributeName} ${transform(value)} `; } @@ -73229,6 +73234,7 @@ void main() { let trueElevationPosition = new Float32Array(originPos); for(let i = 0; i < pointSet.numPoints; i++){ trueElevationPosition[3 * i + 2] += pointcloud.position.z; + trueElevationPosition[3 * i + 2] = trueElevationPosition[3 * i + 2] / this.viewer.lengthUnit.unitspermeter * this.viewer.lengthUnitDisplay.unitspermeter; } pointSet.data.position = trueElevationPosition; @@ -73440,6 +73446,7 @@ void main() { .innerTickSize(-width) .outerTickSize(1) .tickPadding(10) + .tickFormat(v => (v / this.viewer.lengthUnit.unitspermeter * this.viewer.lengthUnitDisplay.unitspermeter).toFixed(0)) .ticks(height / 20); this.elXAxis = this.svg.append('g') @@ -73566,7 +73573,7 @@ void main() { .range([0, width]); this.scaleY.domain([this.camera.bottom + this.camera.position.z, this.camera.top + this.camera.position.z]) .range([height, 0]); - + let marginLeft = this.renderArea[0].offsetLeft; this.xAxis.scale(this.scaleX) @@ -74176,13 +74183,13 @@ ENDSEC for (let point of points) { let x = Utils.addCommas(point.x.toFixed(3)); let y = Utils.addCommas(point.y.toFixed(3)); - let z = Utils.addCommas(point.z.toFixed(3)); + let z = Utils.addCommas((point.z / this.viewer.lengthUnit.unitspermeter * this.viewer.lengthUnitDisplay.unitspermeter).toFixed(3)); let row = $(` ${x} ${y} - ${z} + ${z} @@ -74411,7 +74418,10 @@ ENDSEC elCoordiantesContainer.append(this.createCoordinatesTable(this.measurement.points.map(p => p.position))); let elArea = this.elContent.find(`#measurement_area`); - elArea.html(this.measurement.getArea().toFixed(3)); + let area = this.measurement.getArea(); + elArea.html((area / (this.viewer.lengthUnit.unitspermeter * this.viewer.lengthUnit.unitspermeter) * (this.viewer.lengthUnitDisplay.unitspermeter * this.viewer.lengthUnitDisplay.unitspermeter)).toFixed(3)); + elArea.attr('data-dyn-value', area); + elArea.attr('data-dyn-type', 'area'); } }; @@ -74536,10 +74546,13 @@ ENDSEC return Potree.Utils.addCommas(number.toFixed(3)); }; + const convFactor = (1.0 / this.viewer.lengthUnit.unitspermeter) * this.viewer.lengthUnitDisplay.unitspermeter; + - const txtCenter = `${format(center.x)} ${format(center.y)} ${format(center.z)}`; - const txtRadius = format(radius); - const txtCircumference = format(circumference); + const txtXYCenter = `${format(center.x)} ${format(center.y)}`; + const txtZCenter = format(center.z * convFactor); + const txtRadius = format(radius * convFactor); + const txtCircumference = format(circumference * convFactor); const thStyle = `style="text-align: left"`; const tdStyle = `style="width: 100%; padding: 5px;"`; @@ -74551,16 +74564,16 @@ ENDSEC - ${txtCenter} + ${txtXYCenter} ${txtZCenter} Radius: - ${txtRadius} + ${txtRadius} Circumference: - ${txtCircumference} + ${txtCircumference} `); } @@ -74575,7 +74588,7 @@ ENDSEC

- Height:
+ Height:
@@ -74612,10 +74625,11 @@ ENDSEC let min = lowPoint.z; let max = highPoint.z; let height = max - min; - height = height.toFixed(3); + let displayHeight = height / this.viewer.lengthUnit.unitspermeter * this.viewer.lengthUnitDisplay.unitspermeter; this.elHeightLabel = this.elContent.find(`#height_label`); - this.elHeightLabel.html(`Height: ${height}`); + this.elHeightLabel.text(`${displayHeight.toFixed(3)}`); + this.elHeightLabel.attr('data-dyn-value', height); } } }; @@ -75024,7 +75038,7 @@ ENDSEC
- +
@@ -88731,6 +88745,26 @@ ENDSEC } this.dispatchEvent({ 'type': 'length_unit_changed', 'viewer': this, value: lengthUnitValue }); + + let self = this; + $('#potree_sidebar_container [data-dyn-value]').each(function(){ + const $el = $(this); + const dynValue = parseFloat($el.attr('data-dyn-value')); + if (isNaN(dynValue)) return; + + const dynType = $el.attr('data-dyn-type'); + + let lu = self.lengthUnit.unitspermeter; + let lud = self.lengthUnitDisplay.unitspermeter; + + // Update the unit text based on the new display unit + if (dynType === 'area') { + lud *= lud; + lu *= lu; + } + + $el.text((dynValue / lu * lud).toFixed(3)); + }); }; zoomTo(node, factor, animationDuration = 0){