various fixes
This commit is contained in:
parent
6baeea6529
commit
bcbcafb6fc
4
.vscode/settings.json
vendored
4
.vscode/settings.json
vendored
@ -11,4 +11,8 @@
|
||||
"editor.renderWhitespace": "all",
|
||||
"editor.insertSpaces": false,
|
||||
"editor.minimap.enabled": false,
|
||||
"editor.autoClosingBrackets": false,
|
||||
"editor.formatOnType": false,
|
||||
"editor.acceptSuggestionOnEnter": "off",
|
||||
"editor.acceptSuggestionOnCommitCharacter": false,
|
||||
}
|
||||
@ -99,6 +99,31 @@
|
||||
|
||||
//Potree.measureTimings = true;
|
||||
|
||||
|
||||
//{
|
||||
// let volume = new Potree.Volume();
|
||||
// volume.clip = true;
|
||||
// volume.position.set(-2.628, -1.647, 5.946);
|
||||
// volume.scale.set(20, 20, 20);
|
||||
// viewer.scene.addVolume(volume);
|
||||
//}
|
||||
|
||||
{
|
||||
let volume = new Potree.Volume();
|
||||
volume.clip = true;
|
||||
volume.position.set(-2.628, -1.647, 5.946);
|
||||
volume.scale.set(7.82, 1.32, 16.03);
|
||||
viewer.scene.addVolume(volume);
|
||||
}
|
||||
|
||||
{
|
||||
let volume = new Potree.Volume();
|
||||
volume.clip = true;
|
||||
volume.position.set(-2.344, 3.199, 5.647);
|
||||
volume.scale.set(9.04, 17.52, 1.11);
|
||||
viewer.scene.addVolume(volume);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@ -16,6 +16,7 @@ var server;
|
||||
|
||||
var paths = {
|
||||
potree : [
|
||||
"src/KeyCodes.js",
|
||||
"src/extensions/EventDispatcher.js",
|
||||
"src/extensions/PerspectiveCamera.js",
|
||||
"src/extensions/OrthographicCamera.js",
|
||||
|
||||
106
resources/icons/copy.svg
Normal file
106
resources/icons/copy.svg
Normal file
@ -0,0 +1,106 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
width="32px"
|
||||
height="32px"
|
||||
id="svg3797"
|
||||
version="1.1"
|
||||
inkscape:version="0.92.2 (5c3e80d, 2017-08-06)"
|
||||
sodipodi:docname="copy.svg"
|
||||
inkscape:export-filename="D:\dev\workspaces\potree\develop\resources\icons\volume.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<defs
|
||||
id="defs3799" />
|
||||
<sodipodi:namedview
|
||||
id="base"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#666666"
|
||||
borderopacity="1.0"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="31.672167"
|
||||
inkscape:cx="20.254778"
|
||||
inkscape:cy="10.53881"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="3840"
|
||||
inkscape:window-height="2066"
|
||||
inkscape:window-x="-11"
|
||||
inkscape:window-y="-11"
|
||||
inkscape:window-maximized="1">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3805" />
|
||||
</sodipodi:namedview>
|
||||
<metadata
|
||||
id="metadata3802">
|
||||
<rdf:RDF>
|
||||
<cc:Work
|
||||
rdf:about="">
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<rect
|
||||
style="fill:#fffffa;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1"
|
||||
id="rect829"
|
||||
width="15"
|
||||
height="22"
|
||||
x="7"
|
||||
y="7"
|
||||
rx="1"
|
||||
ry="1" />
|
||||
<rect
|
||||
ry="1"
|
||||
rx="1"
|
||||
y="3"
|
||||
x="12"
|
||||
height="22"
|
||||
width="15"
|
||||
id="rect831"
|
||||
style="fill:#fffffa;fill-opacity:1;stroke:#000000;stroke-width:2;stroke-linecap:butt;stroke-linejoin:round;stroke-miterlimit:4;stroke-dasharray:none;stroke-opacity:1" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;stroke-miterlimit:4;stroke-dasharray:none"
|
||||
d="m 15,6 h 9"
|
||||
id="path833"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 15,9 h 9"
|
||||
id="path835"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 15,12 h 9"
|
||||
id="path837"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 15,15 h 9"
|
||||
id="path841"
|
||||
inkscape:connector-curvature="0" />
|
||||
<path
|
||||
style="fill:none;stroke:#000000;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
|
||||
d="m 15,18 h 3"
|
||||
id="path845"
|
||||
inkscape:connector-curvature="0" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 3.4 KiB |
3
src/KeyCodes.js
Normal file
3
src/KeyCodes.js
Normal file
@ -0,0 +1,3 @@
|
||||
Potree.KeyCodes = {
|
||||
DELETE: 46
|
||||
};
|
||||
@ -472,9 +472,67 @@ Potree.updateVisibility = function(pointclouds, camera, renderer){
|
||||
visible = visible && !(numVisiblePointsInPointclouds.get(pointcloud) + node.getNumPoints() > pointcloud.pointBudget);
|
||||
visible = visible && level < maxLevel;
|
||||
|
||||
if(pointcloud.material.clipBoxes.length > 0 && !window.warned125){
|
||||
console.log("TODO");
|
||||
window.warned125 = true;
|
||||
if(false && pointcloud.material.clipBoxes.length > 0){
|
||||
|
||||
if(!window.warned125){
|
||||
console.log("TODO");
|
||||
window.warned125 = true;
|
||||
}
|
||||
|
||||
//node.debug = false;
|
||||
|
||||
let numIntersecting = 0;
|
||||
let numIntersectionVolumes = 0;
|
||||
|
||||
for(let clipBox of pointcloud.material.clipBoxes){
|
||||
|
||||
let pcWorldInverse = new THREE.Matrix4().getInverse(pointcloud.matrixWorld);
|
||||
let toPCObject = pcWorldInverse.multiply(clipBox.box.matrixWorld);
|
||||
|
||||
let px = new THREE.Vector3(+1, 0, 0).applyMatrix4(toPCObject);
|
||||
let nx = new THREE.Vector3(-1, 0, 0).applyMatrix4(toPCObject);
|
||||
let py = new THREE.Vector3(0, +1, 0).applyMatrix4(toPCObject);
|
||||
let ny = new THREE.Vector3(0, -1, 0).applyMatrix4(toPCObject);
|
||||
let pz = new THREE.Vector3(0, 0, +1).applyMatrix4(toPCObject);
|
||||
let nz = new THREE.Vector3(0, 0, -1).applyMatrix4(toPCObject);
|
||||
|
||||
let pxN = new THREE.Vector3().subVectors(nx, px).normalize();
|
||||
let nxN = pxN.clone().multiplyScalar(-1);
|
||||
let pyN = new THREE.Vector3().subVectors(ny, py).normalize();
|
||||
let nyN = pyN.clone().multiplyScalar(-1);
|
||||
let pzN = new THREE.Vector3().subVectors(nz, pz).normalize();
|
||||
let nzN = pzN.clone().multiplyScalar(-1);
|
||||
|
||||
let pxPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(pxN, px);
|
||||
let nxPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(nxN, nx);
|
||||
let pyPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(pyN, py);
|
||||
let nyPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(nyN, ny);
|
||||
let pzPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(pzN, pz);
|
||||
let nzPlane = new THREE.Plane().setFromNormalAndCoplanarPoint(nzN, nz);
|
||||
|
||||
let frustum = new THREE.Frustum(pxPlane, nxPlane, pyPlane, nyPlane, pzPlane, nzPlane);
|
||||
let intersects = frustum.intersectsBox(box);
|
||||
|
||||
if(intersects){
|
||||
numIntersecting++;
|
||||
}
|
||||
numIntersectionVolumes++;
|
||||
}
|
||||
|
||||
let insideAny = numIntersecting > 0;
|
||||
let insideAll = numIntersecting === numIntersectionVolumes;
|
||||
|
||||
if(pointcloud.material.clipTask === Potree.ClipTask.SHOW_INSIDE){
|
||||
if(pointcloud.material.clipMethod === Potree.ClipMethod.INSIDE_ANY && insideAny){
|
||||
//node.debug = true
|
||||
}else if(pointcloud.material.clipMethod === Potree.ClipMethod.INSIDE_ALL && insideAll){
|
||||
//node.debug = true;
|
||||
}else{
|
||||
visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
// visible = ["r", "r0", "r06", "r060"].includes(node.name);
|
||||
|
||||
@ -622,6 +622,12 @@ Potree.Renderer = class Renderer {
|
||||
|
||||
let level = node.getLevel();
|
||||
|
||||
if(node.debug){
|
||||
shader.setUniform("uDebug", true);
|
||||
}else{
|
||||
shader.setUniform("uDebug", false);
|
||||
}
|
||||
|
||||
|
||||
// TODO consider passing matrices in an array to avoid uniformMatrix4fv overhead
|
||||
const lModel = shader.uniformLocations["modelMatrix"];
|
||||
|
||||
@ -25,6 +25,8 @@ uniform float fov;
|
||||
uniform float near;
|
||||
uniform float far;
|
||||
|
||||
uniform bool uDebug;
|
||||
|
||||
uniform bool uUseOrthographicCamera;
|
||||
uniform float uOrthoWidth;
|
||||
uniform float uOrthoHeight;
|
||||
@ -768,4 +770,10 @@ void main() {
|
||||
gl_Position = projectionMatrix * mvPosition;
|
||||
#endif
|
||||
|
||||
if(uDebug){
|
||||
vColor.b = (vColor.r + vColor.g + vColor.b) / 3.0;
|
||||
vColor.r = 1.0;
|
||||
vColor.g = 1.0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -115,7 +115,7 @@ Potree.EarthControls = class EarthControls extends THREE.EventDispatcher {
|
||||
this.scene.getActiveCamera(),
|
||||
this.viewer,
|
||||
this.scene.pointclouds,
|
||||
{pickClipped: true});
|
||||
{pickClipped: false});
|
||||
|
||||
if (I) {
|
||||
this.pivot = I.location;
|
||||
|
||||
@ -170,8 +170,8 @@ Potree.InputHandler = class InputHandler extends THREE.EventDispatcher {
|
||||
onKeyDown (e) {
|
||||
if (this.logMessages) console.log(this.constructor.name + ': onKeyDown');
|
||||
|
||||
if (e.keyCode === 46 && this.selection.length > 0) {
|
||||
// DELETE
|
||||
// DELETE
|
||||
if (e.keyCode === Potree.KeyCodes.DELETE && this.selection.length > 0) {
|
||||
this.dispatchEvent({
|
||||
type: 'delete',
|
||||
selection: this.selection
|
||||
|
||||
40
src/utils.js
40
src/utils.js
@ -524,6 +524,46 @@ Potree.utils = class {
|
||||
}
|
||||
window.history.replaceState({}, '', url);
|
||||
}
|
||||
|
||||
// see https://stackoverflow.com/questions/400212/how-do-i-copy-to-the-clipboard-in-javascript
|
||||
static clipboardCopy(text){
|
||||
let textArea = document.createElement("textarea");
|
||||
|
||||
textArea.style.position = 'fixed';
|
||||
textArea.style.top = 0;
|
||||
textArea.style.left = 0;
|
||||
|
||||
textArea.style.width = '2em';
|
||||
textArea.style.height = '2em';
|
||||
|
||||
textArea.style.padding = 0;
|
||||
|
||||
textArea.style.border = 'none';
|
||||
textArea.style.outline = 'none';
|
||||
textArea.style.boxShadow = 'none';
|
||||
|
||||
textArea.style.background = 'transparent';
|
||||
|
||||
textArea.value = text;
|
||||
|
||||
document.body.appendChild(textArea);
|
||||
|
||||
textArea.select();
|
||||
|
||||
try {
|
||||
let success = document.execCommand('copy');
|
||||
if(success){
|
||||
console.log("copied text to clipboard");
|
||||
}else{
|
||||
console.log("copy to clipboard failed");
|
||||
}
|
||||
} catch (err) {
|
||||
console.log("error while trying to copy to clipboard");
|
||||
}
|
||||
|
||||
document.body.removeChild(textArea);
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
Potree.utils.screenPass = new function () {
|
||||
|
||||
@ -76,14 +76,19 @@ class DistancePanel extends MeasurePanel{
|
||||
<table id="distances_table" class="measurement_value_table"></table>
|
||||
|
||||
<!-- ACTIONS -->
|
||||
<!--<div style="display: flex; margin-top: 12px">
|
||||
<div style="display: flex; margin-top: 12px">
|
||||
<span></span>
|
||||
<span style="flex-grow: 1"></span>
|
||||
<img class="measurement_action_remove" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>-->
|
||||
<img name="remove" class="button-icon" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.elRemove = this.elContent.find("img[name=remove]");
|
||||
this.elRemove.click( () => {
|
||||
viewer.scene.removeMeasurement(measurement);
|
||||
});
|
||||
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
|
||||
@ -139,14 +144,19 @@ class PointPanel extends MeasurePanel{
|
||||
<span class="attributes_table_container"></span>
|
||||
|
||||
<!-- ACTIONS -->
|
||||
<!--<div style="display: flex; margin-top: 12px">
|
||||
<div style="display: flex; margin-top: 12px">
|
||||
<span></span>
|
||||
<span style="flex-grow: 1"></span>
|
||||
<img class="measurement_action_remove" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>-->
|
||||
<img name="remove" class="button-icon" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.elRemove = this.elContent.find("img[name=remove]");
|
||||
this.elRemove.click( () => {
|
||||
viewer.scene.removeMeasurement(measurement);
|
||||
});
|
||||
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
|
||||
@ -179,14 +189,19 @@ class AreaPanel extends MeasurePanel{
|
||||
<span id="measurement_area"></span>
|
||||
|
||||
<!-- ACTIONS -->
|
||||
<!--<div style="display: flex; margin-top: 12px">
|
||||
<div style="display: flex; margin-top: 12px">
|
||||
<span></span>
|
||||
<span style="flex-grow: 1"></span>
|
||||
<img class="measurement_action_remove" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>-->
|
||||
<img name="remove" class="button-icon" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.elRemove = this.elContent.find("img[name=remove]");
|
||||
this.elRemove.click( () => {
|
||||
viewer.scene.removeMeasurement(measurement);
|
||||
});
|
||||
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
|
||||
@ -228,14 +243,19 @@ class AnglePanel extends MeasurePanel{
|
||||
</table>
|
||||
|
||||
<!-- ACTIONS -->
|
||||
<!--<div style="display: flex; margin-top: 12px">
|
||||
<div style="display: flex; margin-top: 12px">
|
||||
<span></span>
|
||||
<span style="flex-grow: 1"></span>
|
||||
<img class="measurement_action_remove" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>-->
|
||||
<img name="remove" class="button-icon" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.elRemove = this.elContent.find("img[name=remove]");
|
||||
this.elRemove.click( () => {
|
||||
viewer.scene.removeMeasurement(measurement);
|
||||
});
|
||||
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
|
||||
@ -277,14 +297,19 @@ class HeightPanel extends MeasurePanel{
|
||||
<span id="height_label">Height: </span><br>
|
||||
|
||||
<!-- ACTIONS -->
|
||||
<!--<div style="display: flex; margin-top: 12px">
|
||||
<div style="display: flex; margin-top: 12px">
|
||||
<span></span>
|
||||
<span style="flex-grow: 1"></span>
|
||||
<img class="measurement_action_remove" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>-->
|
||||
<img name="remove" class="button-icon" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.elRemove = this.elContent.find("img[name=remove]");
|
||||
this.elRemove.click( () => {
|
||||
viewer.scene.removeMeasurement(measurement);
|
||||
});
|
||||
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_added", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_removed", this._update);
|
||||
this.propertiesPanel.addVolatileListener(measurement, "marker_moved", this._update);
|
||||
@ -371,14 +396,19 @@ class VolumePanel extends MeasurePanel{
|
||||
|
||||
<!-- ACTIONS -->
|
||||
<input id="volume_reset_orientation" type="button" value="reset orientation"/>
|
||||
<!--<div style="display: flex; margin-top: 12px">
|
||||
<div style="display: flex; margin-top: 12px">
|
||||
<span></span>
|
||||
<span style="flex-grow: 1"></span>
|
||||
<img class="measurement_action_remove" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>-->
|
||||
<img name="remove" class="button-icon" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.elRemove = this.elContent.find("img[name=remove]");
|
||||
this.elRemove.click( () => {
|
||||
viewer.scene.removeVolume(measurement);
|
||||
});
|
||||
|
||||
this.elContent.find("#volume_reset_orientation").click(() => {
|
||||
measurement.rotation.set(0, 0, 0);
|
||||
});
|
||||
@ -468,14 +498,19 @@ class ProfilePanel extends MeasurePanel{
|
||||
<input type="button" id="show_2d_profile" value="show 2d profile" style="width: 100%"/>
|
||||
|
||||
<!-- ACTIONS -->
|
||||
<!--<div style="display: flex; margin-top: 12px">
|
||||
<div style="display: flex; margin-top: 12px">
|
||||
<span></span>
|
||||
<span style="flex-grow: 1"></span>
|
||||
<img class="measurement_action_remove" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>-->
|
||||
<img name="remove" class="button-icon" src="${removeIconPath}" style="width: 16px; height: 16px"/>
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.elRemove = this.elContent.find("img[name=remove]");
|
||||
this.elRemove.click( () => {
|
||||
viewer.scene.removeProfile(measurement);
|
||||
});
|
||||
|
||||
{ // download
|
||||
this.elDownloadButton = this.elContent.find(`#download_profile`);
|
||||
|
||||
@ -547,6 +582,75 @@ class ProfilePanel extends MeasurePanel{
|
||||
}
|
||||
}
|
||||
|
||||
class CameraPanel{
|
||||
constructor(viewer, propertiesPanel){
|
||||
this.viewer = viewer;
|
||||
this.propertiesPanel = propertiesPanel;
|
||||
|
||||
this._update = () => { this.update(); };
|
||||
|
||||
let copyIconPath = Potree.resourcePath + '/icons/copy.svg';
|
||||
this.elContent = $(`
|
||||
<div class="propertypanel_content">
|
||||
<table>
|
||||
<tr>
|
||||
<th colspan="3">position</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" id="camera_position_x" style="width: 25%"></td>
|
||||
<td align="center" id="camera_position_y" style="width: 25%"></td>
|
||||
<td align="center" id="camera_position_z" style="width: 25%"></td>
|
||||
<td align="right" id="copy_camera_position" style="width: 25%">
|
||||
<img name="copyPosition" class="button-icon" src="${copyIconPath}" style="width: 16px; height: 16px"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="3">target</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center" id="camera_target_x" style="width: 25%"></td>
|
||||
<td align="center" id="camera_target_y" style="width: 25%"></td>
|
||||
<td align="center" id="camera_target_z" style="width: 25%"></td>
|
||||
<td align="right" id="copy_camera_target" style="width: 25%">
|
||||
<img name="copyPosition" class="button-icon" src="${copyIconPath}" style="width: 16px; height: 16px"/>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
`);
|
||||
|
||||
this.elCopyPosition = this.elContent.find("img[name=copyPosition]");
|
||||
this.elCopyPosition.click( () => {
|
||||
let pos = this.viewer.scene.getActiveCamera().position.toArray();
|
||||
let msg = pos.map(c => c.toFixed(3)).join(", ");
|
||||
Potree.utils.clipboardCopy(msg);
|
||||
});
|
||||
|
||||
this.propertiesPanel.addVolatileListener(viewer, "camera_changed", this._update);
|
||||
|
||||
this.update();
|
||||
}
|
||||
|
||||
update(){
|
||||
console.log("updating camera panel");
|
||||
|
||||
let camera = this.viewer.scene.getActiveCamera();
|
||||
let view = this.viewer.scene.view;
|
||||
|
||||
let pos = camera.position.toArray().map(c => Potree.utils.addCommas(c.toFixed(3)));
|
||||
this.elContent.find("#camera_position_x").html(pos[0]);
|
||||
this.elContent.find("#camera_position_y").html(pos[1]);
|
||||
this.elContent.find("#camera_position_z").html(pos[2]);
|
||||
|
||||
let target = view.getPivot().toArray().map(c => Potree.utils.addCommas(c.toFixed(3)));
|
||||
this.elContent.find("#camera_target_x").html(target[0]);
|
||||
this.elContent.find("#camera_target_y").html(target[1]);
|
||||
this.elContent.find("#camera_target_z").html(target[2]);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Potree.PropertiesPanel = class PropertriesPanel{
|
||||
|
||||
@ -566,6 +670,8 @@ Potree.PropertiesPanel = class PropertriesPanel{
|
||||
if(this.object === object){
|
||||
return;
|
||||
}
|
||||
|
||||
this.object = object;
|
||||
|
||||
for(let task of this.cleanupTasks){
|
||||
task();
|
||||
@ -577,11 +683,9 @@ Potree.PropertiesPanel = class PropertriesPanel{
|
||||
this.setPointCloud(object);
|
||||
}else if(object instanceof Potree.Measure || object instanceof Potree.Profile || object instanceof Potree.Volume){
|
||||
this.setMeasurement(object);
|
||||
}else{
|
||||
|
||||
}else if(object instanceof THREE.Camera){
|
||||
this.setCamera(object);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -1101,9 +1205,11 @@ Potree.PropertiesPanel = class PropertriesPanel{
|
||||
|
||||
let panel = new Panel(this.scene, object, this);
|
||||
this.container.append(panel.elContent);
|
||||
}
|
||||
|
||||
|
||||
|
||||
setCamera(camera){
|
||||
let panel = new CameraPanel(this.viewer, this);
|
||||
this.container.append(panel.elContent);
|
||||
}
|
||||
|
||||
}
|
||||
@ -86,7 +86,8 @@
|
||||
top: 10px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
text-align: center
|
||||
text-align: center;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
#potree_sidebar_container{
|
||||
@ -334,6 +335,11 @@ body{
|
||||
/*background-color: rgba(0, 0, 0, 0.4);*/
|
||||
}
|
||||
|
||||
.propertypanel_content{
|
||||
padding: 5px 15px 5px 10px;
|
||||
/*background-color: rgba(0, 0, 0, 0.4);*/
|
||||
}
|
||||
|
||||
.measurement_value_table{
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@ -219,18 +219,29 @@ initSidebar = (viewer) => {
|
||||
tree.jstree("check_node", annotationsID);
|
||||
tree.jstree("check_node", otherID);
|
||||
|
||||
tree.on('create_node.jstree', function(e, data) {
|
||||
tree.on('create_node.jstree', function(e, data){
|
||||
tree.jstree("open_all");
|
||||
});
|
||||
|
||||
tree.on("select_node.jstree", function (e, data) {
|
||||
tree.on("select_node.jstree", function(e, data){
|
||||
let object = data.node.data;
|
||||
propertiesPanel.set(object);
|
||||
|
||||
viewer.inputHandler.deselectAll();
|
||||
|
||||
if(object instanceof Potree.Volume){
|
||||
viewer.inputHandler.deselectAll();
|
||||
viewer.inputHandler.toggleSelection(object);
|
||||
}
|
||||
|
||||
$(viewer.renderer.domElement).focus();
|
||||
});
|
||||
|
||||
tree.on("deselect_node.jstree", function(e, data){
|
||||
propertiesPanel.set(null);
|
||||
});
|
||||
|
||||
tree.on("delete_node.jstree", function(e, data){
|
||||
propertiesPanel.set(null);
|
||||
});
|
||||
|
||||
tree.on('dblclick','.jstree-anchor', function (e) {
|
||||
@ -371,10 +382,16 @@ initSidebar = (viewer) => {
|
||||
tree.jstree("delete_node", jsonNode.id);
|
||||
};
|
||||
|
||||
|
||||
let onProfileRemoved = (e) => {
|
||||
let measurementsRoot = $("#jstree_scene").jstree().get_json("measurements");
|
||||
let jsonNode = measurementsRoot.children.find(child => child.data.uuid === e.profile.uuid);
|
||||
|
||||
tree.jstree("delete_node", jsonNode.id);
|
||||
};
|
||||
|
||||
viewer.scene.addEventListener("measurement_removed", onMeasurementRemoved);
|
||||
viewer.scene.addEventListener("volume_removed", onVolumeRemoved);
|
||||
viewer.scene.addEventListener("profile_removed", onProfileRemoved);
|
||||
|
||||
{
|
||||
let annotationIcon = `${Potree.resourcePath}/icons/target.svg`;
|
||||
@ -404,6 +421,10 @@ initSidebar = (viewer) => {
|
||||
onProfileAdded({profile: profile});
|
||||
}
|
||||
|
||||
{
|
||||
createNode(otherID, "Camera", null, new THREE.Camera());
|
||||
}
|
||||
|
||||
viewer.addEventListener("scene_changed", (e) => {
|
||||
propertiesPanel.setScene(e.scene);
|
||||
|
||||
|
||||
@ -1232,6 +1232,31 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
||||
camera.updateMatrixWorld();
|
||||
camera.matrixWorldInverse.getInverse(camera.matrixWorld);
|
||||
|
||||
{
|
||||
if(this._previousCamera === undefined){
|
||||
this._previousCamera = this.scene.getActiveCamera().clone();
|
||||
this._previousCamera.rotation.copy(this.scene.getActiveCamera());
|
||||
}
|
||||
|
||||
if(!this._previousCamera.matrixWorld.equals(camera.matrixWorld)){
|
||||
this.dispatchEvent({
|
||||
type: "camera_changed",
|
||||
previous: this._previousCamera,
|
||||
camera: camera
|
||||
});
|
||||
}else if(!this._previousCamera.projectionMatrix.equals(camera.matrixWorld)){
|
||||
this.dispatchEvent({
|
||||
type: "camera_changed",
|
||||
previous: this._previousCamera,
|
||||
camera: camera
|
||||
});
|
||||
}
|
||||
|
||||
this._previousCamera = this.scene.getActiveCamera().clone();
|
||||
this._previousCamera.rotation.copy(this.scene.getActiveCamera());
|
||||
|
||||
}
|
||||
|
||||
{ // update clip boxes
|
||||
let boxes = [];
|
||||
|
||||
@ -1247,7 +1272,7 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
||||
box.updateMatrixWorld();
|
||||
let boxInverse = new THREE.Matrix4().getInverse(box.matrixWorld);
|
||||
let boxPosition = box.getWorldPosition();
|
||||
return {inverse: boxInverse, position: boxPosition};
|
||||
return {box: box, inverse: boxInverse, position: boxPosition};
|
||||
});
|
||||
|
||||
let clipPolygons = this.scene.polygonClipVolumes.filter(vol => vol.initialized);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user