changed clip mode
added more properties to clip volumes
This commit is contained in:
parent
3bf5cda240
commit
c363738bb1
6
TODO.txt
6
TODO.txt
@ -10,4 +10,8 @@ TODO clipping:
|
||||
- polygon clipping (define polygon in screenspace)
|
||||
- profile clipping
|
||||
- resize after 1st click
|
||||
- properties
|
||||
- visualize local coordinate system of plane
|
||||
- properties
|
||||
+ width/length/thickness spinner
|
||||
+ translate locally/globally
|
||||
+ rotate locally/globally
|
||||
@ -689,7 +689,7 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree{
|
||||
pickMaterial.maxSize = this.material.maxSize;
|
||||
pickMaterial.classification = this.material.classification;
|
||||
|
||||
if(pickOutsideClipRegion){
|
||||
/*if(pickOutsideClipRegion){
|
||||
pickMaterial.clipMode = Potree.ClipMode.DISABLED;
|
||||
}else{
|
||||
pickMaterial.clipMode = this.material.clipMode;
|
||||
@ -698,7 +698,7 @@ Potree.PointCloudOctree = class extends Potree.PointCloudTree{
|
||||
}else{
|
||||
pickMaterial.setClipBoxes([]);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
this.updateMaterial(pickMaterial, nodes, camera, renderer);
|
||||
|
||||
|
||||
@ -398,7 +398,7 @@ Potree.PointCloudArena4D.prototype.pick = function(renderer, camera, ray, params
|
||||
pickMaterial.maxSize = this.material.maxSize;
|
||||
pickMaterial.classification = this.material.classification;
|
||||
|
||||
if(pickOutsideClipRegion){
|
||||
/*if(pickOutsideClipRegion){
|
||||
pickMaterial.clipMode = Potree.ClipMode.DISABLED;
|
||||
}else{
|
||||
pickMaterial.clipMode = this.material.clipMode;
|
||||
@ -407,7 +407,7 @@ Potree.PointCloudArena4D.prototype.pick = function(renderer, camera, ray, params
|
||||
}else{
|
||||
pickMaterial.setClipBoxes([]);
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
this.updateMaterial(pickMaterial, nodes, camera, renderer);
|
||||
|
||||
|
||||
@ -75,11 +75,11 @@ Potree.PointColorType = {
|
||||
COMPOSITE: 50
|
||||
};
|
||||
|
||||
Potree.ClipMode = {
|
||||
/*Potree.ClipMode = {
|
||||
DISABLED: 0,
|
||||
CLIP_OUTSIDE: 1,
|
||||
HIGHLIGHT_INSIDE: 2
|
||||
};
|
||||
};*/
|
||||
|
||||
Potree.TreeType = {
|
||||
OCTREE: 0,
|
||||
@ -171,7 +171,7 @@ Potree.PointCloudMaterial = class PointCloudMaterial extends THREE.RawShaderMate
|
||||
wSourceID: { type: "f", value: 0 },
|
||||
useOrthographicCamera: { type: "b", value: false },
|
||||
orthoRange: { type: "f", value: 10.0 },
|
||||
clipInside: { type: "b", value: false}
|
||||
clipMode: { type: "i", value: 0}
|
||||
};
|
||||
|
||||
this.defaultAttributeValues.normal = [0,0,0];
|
||||
@ -396,12 +396,12 @@ Potree.PointCloudMaterial = class PointCloudMaterial extends THREE.RawShaderMate
|
||||
}
|
||||
|
||||
|
||||
get clipInside() {
|
||||
return this.uniforms.clipInside.value;
|
||||
get clipMode() {
|
||||
return this.uniforms.clipMode.value;
|
||||
}
|
||||
|
||||
set clipInside(inside) {
|
||||
this.uniforms.clipInside.value = inside;
|
||||
set clipMode(mode) {
|
||||
this.uniforms.clipMode.value = mode;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -33,7 +33,7 @@ uniform float near;
|
||||
uniform float far;
|
||||
uniform float orthoRange;
|
||||
|
||||
uniform bool clipInside;
|
||||
uniform int clipMode;
|
||||
#if defined use_clip_box
|
||||
uniform mat4 clipBoxes[max_clip_boxes];
|
||||
#endif
|
||||
@ -424,8 +424,10 @@ void main() {
|
||||
inside = inside && -0.5 <= clipPosition.z && clipPosition.z <= 0.5;
|
||||
insideAny = insideAny || inside;
|
||||
}
|
||||
if(insideAny && clipInside || !insideAny && !clipInside) {
|
||||
if(insideAny && clipMode == 1 || !insideAny && clipMode == 2) {
|
||||
gl_Position = vec4(1000.0, 1000.0, 1000.0, 1.0);
|
||||
} else if(clipMode == 0 && insideAny) {
|
||||
vColor.r += 0.5;
|
||||
}
|
||||
/*if(!insideAny){
|
||||
|
||||
|
||||
@ -2,24 +2,24 @@
|
||||
|
||||
Potree.ClipVolume = class extends THREE.Object3D{
|
||||
|
||||
constructor(axis){
|
||||
constructor(args){
|
||||
super();
|
||||
|
||||
this.constructor.counter = (this.constructor.counter === undefined) ? 0 : this.constructor.counter + 1;
|
||||
this.name = "clip_volume_" + this.constructor.counter;
|
||||
|
||||
this.axis = axis;
|
||||
this.volWidth = 0.1;
|
||||
this.clipOffset = 0.001;
|
||||
this.clipRotOffset = 1;
|
||||
|
||||
if(axis != -1) {
|
||||
this.scale.set(1, 1, 1);
|
||||
if(axis == Potree.ClipVolume.Axis.X)
|
||||
this.scale.x = this.volWidth;
|
||||
else if(axis == Potree.ClipVolume.Axis.Y)
|
||||
this.scale.y = this.volWidth;
|
||||
else if(axis == Potree.ClipVolume.Axis.Z)
|
||||
this.scale.z = this.volWidth;
|
||||
}
|
||||
this.scale.z = 0.1;
|
||||
|
||||
let alpha = args.alpha || 0;
|
||||
let beta = args.beta || 0;
|
||||
let gamma = args.gamma || 0;
|
||||
|
||||
this.rotation.x = alpha;
|
||||
this.rotation.y = beta;
|
||||
this.rotation.z = gamma;
|
||||
|
||||
let boxGeometry = new THREE.BoxGeometry(1, 1, 1);
|
||||
boxGeometry.computeBoundingBox();
|
||||
@ -101,20 +101,78 @@ Potree.ClipVolume = class extends THREE.Object3D{
|
||||
this.update();
|
||||
};
|
||||
|
||||
offset(value) {
|
||||
if(this.axis == Potree.ClipVolume.Axis.X) {
|
||||
this.position.x = this.position.x + value;
|
||||
} else if(this.axis == Potree.ClipVolume.Axis.Y) {
|
||||
this.position.y = this.position.y + value;
|
||||
} else if(this.axis == Potree.ClipVolume.Axis.Z) {
|
||||
this.position.z = this.position.z + value;
|
||||
} else {
|
||||
// TODO, offset box?
|
||||
}
|
||||
setClipOffset(offset) {
|
||||
if(this.clipOffset == offset) return;
|
||||
|
||||
this.clipOffset = offset;
|
||||
this.dispatchEvent({"type": "clip_volume_changed", "viewer": viewer, "volume": this});
|
||||
}
|
||||
|
||||
setClipRotOffset(offset) {
|
||||
if(this.clipRotOffset == offset) return;
|
||||
|
||||
this.clipRotOffset = offset;
|
||||
this.dispatchEvent({"type": "clip_volume_changed", "viewer": viewer, "volume": this});
|
||||
}
|
||||
|
||||
offset(args) {
|
||||
let cs = args.cs || null;
|
||||
let axis = args.axis || null;
|
||||
let dir = args.dir || null;
|
||||
|
||||
if(!cs || !axis || !dir) return;
|
||||
|
||||
if(axis == "x") {
|
||||
if(cs == "local") {
|
||||
|
||||
} else if(cs == "global") {
|
||||
this.position.x = this.position.x + dir * this.clipOffset;
|
||||
}
|
||||
}else if(axis == "y") {
|
||||
if(cs == "local") {
|
||||
|
||||
} else if(cs == "global") {
|
||||
this.position.y = this.position.y + dir * this.clipOffset;
|
||||
}
|
||||
}else if(axis == "z") {
|
||||
if(cs == "local") {
|
||||
|
||||
} else if(cs == "global") {
|
||||
this.position.z = this.position.z + dir * this.clipOffset;
|
||||
}
|
||||
}
|
||||
this.dispatchEvent({"type": "clip_volume_changed", "viewer": viewer, "volume": this});
|
||||
}
|
||||
|
||||
rotate(args) {
|
||||
let cs = args.cs || null;
|
||||
let axis = args.axis || null;
|
||||
let dir = args.dir || null;
|
||||
|
||||
if(!cs || !axis || !dir) return;
|
||||
|
||||
if(axis == "x") {
|
||||
if(cs == "local") {
|
||||
|
||||
} else if(cs == "global") {
|
||||
this.rotation.x = this.rotation.x + dir * this.clipRotOffset * Math.PI/180;
|
||||
}
|
||||
}else if(axis == "y") {
|
||||
if(cs == "local") {
|
||||
|
||||
} else if(cs == "global") {
|
||||
this.rotation.y = this.rotation.y + dir * this.clipRotOffset * Math.PI/180;
|
||||
}
|
||||
}else if(axis == "z") {
|
||||
if(cs == "local") {
|
||||
|
||||
} else if(cs == "global") {
|
||||
this.rotation.z = this.rotation.z + dir * this.clipRotOffset * Math.PI/180;
|
||||
}
|
||||
}
|
||||
this.dispatchEvent({"type": "clip_volume_changed", "viewer": viewer, "volume": this});
|
||||
}
|
||||
|
||||
this.dispatchEvent({"type": "clip_volume_changed", "volume": this});
|
||||
};
|
||||
|
||||
update(){
|
||||
this.boundingBox = this.box.geometry.boundingBox;
|
||||
this.boundingSphere = this.boundingBox.getBoundingSphere();
|
||||
@ -138,9 +196,3 @@ Potree.ClipVolume = class extends THREE.Object3D{
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
Potree.ClipVolume.Axis = {
|
||||
X: 0,
|
||||
Y: 1,
|
||||
Z: 2
|
||||
};
|
||||
@ -1,4 +1,11 @@
|
||||
|
||||
|
||||
Potree.ClipMode = {
|
||||
HIGHLIGHT: 0,
|
||||
INSIDE: 1,
|
||||
OUTSIDE: 2
|
||||
};
|
||||
|
||||
Potree.ClippingTool = class ClippingTool extends THREE.EventDispatcher{
|
||||
|
||||
constructor(viewer){
|
||||
@ -6,8 +13,7 @@ Potree.ClippingTool = class ClippingTool extends THREE.EventDispatcher{
|
||||
|
||||
this.viewer = viewer;
|
||||
|
||||
this.clipInside = false;
|
||||
this.clipOffset = 0.1;
|
||||
this.clipMode = Potree.ClipMode.HIGHLIGHT;
|
||||
|
||||
this.addEventListener("start_inserting_clipping_volume", e => {
|
||||
this.viewer.dispatchEvent({
|
||||
@ -49,25 +55,15 @@ Potree.ClippingTool = class ClippingTool extends THREE.EventDispatcher{
|
||||
this.scene.addEventListener("clip_volume_removed", this.onRemove);
|
||||
}
|
||||
|
||||
setClipInside(inside) {
|
||||
if(this.clipInside == inside) return;
|
||||
setClipMode(mode) {
|
||||
if(this.clipMode == mode) return;
|
||||
|
||||
this.clipInside = inside;
|
||||
viewer.dispatchEvent({"type": "clipper.clipInside_changed", "viewer": viewer, "inside": inside});
|
||||
this.clipMode = mode;
|
||||
viewer.dispatchEvent({"type": "clipper.clipMode_changed", "viewer": viewer, "mode": mode});
|
||||
}
|
||||
|
||||
setClipOffset(offset) {
|
||||
if(this.clipOffset == offset) return;
|
||||
|
||||
this.clipOffset = offset;
|
||||
viewer.dispatchEvent({"type": "clipper.clipOffset_changed", "viewer": viewer, "offset": offset});
|
||||
}
|
||||
|
||||
startInsertion(args = {}) {
|
||||
let axis = -1;
|
||||
if(args.axis + 1)
|
||||
axis = args.axis;
|
||||
let clipVolume = new Potree.ClipVolume(axis);
|
||||
startInsertion(args = {}) {
|
||||
let clipVolume = new Potree.ClipVolume(args);
|
||||
|
||||
this.dispatchEvent({"type": "start_inserting_clipping_volume"});
|
||||
|
||||
@ -164,11 +160,4 @@ Potree.ClippingTool = class ClippingTool extends THREE.EventDispatcher{
|
||||
update() {
|
||||
|
||||
}
|
||||
};
|
||||
|
||||
Potree.ClippingTool.ClipMode = {
|
||||
NONE: 0,
|
||||
BOX: 1,
|
||||
POLYGON: 2,
|
||||
PROFILE: 3
|
||||
};
|
||||
@ -769,3 +769,16 @@ label:hover{
|
||||
|
||||
|
||||
|
||||
/* Clipping sidebar */
|
||||
.cv_btn_offset {
|
||||
width: 20px;
|
||||
margin: 0px 5px;
|
||||
}
|
||||
|
||||
.cv_btn_offset_incr {
|
||||
|
||||
}
|
||||
|
||||
.cv_btn_offset_decr {
|
||||
|
||||
}
|
||||
@ -111,10 +111,11 @@
|
||||
<div>
|
||||
<ul class="pv-menu-list">
|
||||
<li>
|
||||
<label for="optClipInside" class="pv-select-label">Clip</label>
|
||||
<select id="optClipInside" name="optClipInside">
|
||||
<option value="0">Inside</option>
|
||||
<option value="1">Outside</option>
|
||||
<label for="optClipMode" class="pv-select-label">Clip mode</label>
|
||||
<select id="optClipMode" name="optClipMode">
|
||||
<option value="0">Highlight</option>
|
||||
<option value="1">Inside</option>
|
||||
<option value="2">Outside</option>
|
||||
</select>
|
||||
</li>
|
||||
<div id="clipping_tools_container">
|
||||
|
||||
@ -1442,16 +1442,16 @@ function initMeasurementDetails(){
|
||||
function initClippingTool() {
|
||||
$("#clipping_volumes_container").hide();
|
||||
|
||||
$("#optClipInside").selectmenu();
|
||||
$("#optClipInside").val(1).selectmenu("refresh");
|
||||
$("#optClipInside").selectmenu({
|
||||
$("#optClipMode").selectmenu();
|
||||
$("#optClipMode").val(0).selectmenu("refresh");
|
||||
$("#optClipMode").selectmenu({
|
||||
change: function(event, ui){
|
||||
viewer.clippingTool.setClipInside(ui.item.value == "0");
|
||||
viewer.clippingTool.setClipMode(parseInt(ui.item.value));
|
||||
}
|
||||
});
|
||||
|
||||
viewer.addEventListener("clipper.clipInside_changed", function(event){
|
||||
$("#optClipInside").val(viewer.clippingTool.clipInside == true ? 0 : 1).selectmenu("refresh");
|
||||
viewer.addEventListener("clipper.clipMode_changed", function(event){
|
||||
$("#optClipMode").val(viewer.clippingTool.clipMode).selectmenu("refresh");
|
||||
});
|
||||
|
||||
|
||||
@ -1461,7 +1461,6 @@ function initClippingTool() {
|
||||
Potree.resourcePath + "/icons/clip_volume.svg",
|
||||
"[title]tt.clip_volume",
|
||||
function(){
|
||||
//viewer.volumeTool.startInsertion({clip: true})
|
||||
viewer.clippingTool.startInsertion();
|
||||
}
|
||||
));
|
||||
@ -1478,7 +1477,7 @@ function initClippingTool() {
|
||||
Potree.resourcePath + "/icons/profile.svg",
|
||||
"[title]tt.height_profile",
|
||||
function(){
|
||||
viewer.clippingTool.startInsertion({axis: Potree.ClipVolume.Axis.X});
|
||||
viewer.clippingTool.startInsertion({alpha: 0, beta: Math.PI/2, gamma: 0});
|
||||
}
|
||||
));
|
||||
|
||||
@ -1486,7 +1485,7 @@ function initClippingTool() {
|
||||
Potree.resourcePath + "/icons/profile.svg",
|
||||
"[title]tt.height_profile",
|
||||
function(){
|
||||
viewer.clippingTool.startInsertion({axis: Potree.ClipVolume.Axis.Y});
|
||||
viewer.clippingTool.startInsertion({alpha: Math.PI/2, beta: 0, gamma: 0});
|
||||
}
|
||||
));
|
||||
|
||||
@ -1494,7 +1493,7 @@ function initClippingTool() {
|
||||
Potree.resourcePath + "/icons/profile.svg",
|
||||
"[title]tt.height_profile",
|
||||
function(){
|
||||
viewer.clippingTool.startInsertion({axis: Potree.ClipVolume.Axis.Z});
|
||||
viewer.clippingTool.startInsertion({alpha: 0, beta: 0, gamma: Math.PI/2});
|
||||
}
|
||||
));
|
||||
|
||||
@ -1516,98 +1515,244 @@ function initClippingTool() {
|
||||
let x = Potree.utils.addCommas(volume.position.x.toFixed(3));
|
||||
let y = Potree.utils.addCommas(volume.position.y.toFixed(3));
|
||||
let z = Potree.utils.addCommas(volume.position.z.toFixed(3));
|
||||
let rot_alpha = (volume.rotation.x * 180/Math.PI).toFixed(0);
|
||||
let rot_beta = (volume.rotation.y * 180/Math.PI).toFixed(0);
|
||||
let rot_gamma = (volume.rotation.z * 180/Math.PI).toFixed(0);
|
||||
let sc_width = Potree.utils.addCommas(volume.scale.x.toFixed(3));
|
||||
let sc_height = Potree.utils.addCommas(volume.scale.y.toFixed(3));
|
||||
let sc_length = Potree.utils.addCommas(volume.scale.y.toFixed(3));
|
||||
let sc_thickness = Potree.utils.addCommas(volume.scale.z.toFixed(3));
|
||||
let removeIconPath = Potree.resourcePath + "/icons/remove.svg";
|
||||
let icon = "/icons/clip_volume.svg";
|
||||
if(volume.axis == Potree.ClipVolume.Axis.X) {
|
||||
icon = "/icons/profile.svg";
|
||||
sc_width = Potree.utils.addCommas(volume.scale.y.toFixed(3));
|
||||
sc_height = Potree.utils.addCommas(volume.scale.z.toFixed(3));
|
||||
sc_thickness = Potree.utils.addCommas(volume.scale.x.toFixed(3));
|
||||
} else if(volume.axis == Potree.ClipVolume.Axis.Y) {
|
||||
icon = "/icons/profile.svg";
|
||||
sc_width = Potree.utils.addCommas(volume.scale.x.toFixed(3));
|
||||
sc_height = Potree.utils.addCommas(volume.scale.z.toFixed(3));
|
||||
sc_thickness = Potree.utils.addCommas(volume.scale.y.toFixed(3));
|
||||
} else if(volume.axis == Potree.ClipVolume.Axis.Z) {
|
||||
icon = "/icons/profile.svg";
|
||||
sc_width = Potree.utils.addCommas(volume.scale.x.toFixed(3));
|
||||
sc_height = Potree.utils.addCommas(volume.scale.y.toFixed(3));
|
||||
sc_thickness = Potree.utils.addCommas(volume.scale.z.toFixed(3));
|
||||
}
|
||||
let cvItem = $(`
|
||||
<span class="scene_item" id="${volume.name}">
|
||||
<!-- HEADER -->
|
||||
<div class="scene_header" onclick="$(this).next().slideToggle(200)">
|
||||
<span class="scene_icon"><img src="${Potree.resourcePath + icon}" class="scene_item_icon" /></span>
|
||||
<span class="scene_header_title">${volume.name}</span>
|
||||
|
||||
let cvItem = $(`
|
||||
<div class="clip_volume_body" style="margin: 5px 0px">
|
||||
<div class="divider">
|
||||
<span>Size</span>
|
||||
</div>
|
||||
<div style="margin: 10px 0px">
|
||||
<span class="coordinates_table_container">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th>width</th>
|
||||
<th>length</th>
|
||||
<th>thickness</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><input class="clip_volume_spinner" id="cv_sp_width_${volume.id}" style="width: 55px" value="${sc_width}" /></td>
|
||||
<td><input class="clip_volume_spinner" id="cv_sp_length_${volume.id}" style="width: 55px" value="${sc_length}" /></td>
|
||||
<td><input class="clip_volume_spinner" id="cv_sp_thickness_${volume.id}" style="width: 55px" value="${sc_thickness}" /></td>
|
||||
</tr>
|
||||
</table>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<!-- DETAIL -->
|
||||
<div class="measurement_content selectable" style="display: none">
|
||||
<div>
|
||||
<span class="coordinates_table_container">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${x}</td>
|
||||
<td>${y}</td>
|
||||
<td>${z}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</span>
|
||||
<br />
|
||||
<span class="coordinates_table_container">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th>width</th>
|
||||
<th>height</th>
|
||||
<th>thickness</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${sc_width}${viewer.lengthUnit.code}</td>
|
||||
<td>${sc_height}${viewer.lengthUnit.code}</td>
|
||||
<td>${sc_thickness}${viewer.lengthUnit.code}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</span>
|
||||
<br />
|
||||
<div class="clip_offset_container">
|
||||
<label for="${volume.name}_offset">Offset</label>
|
||||
<input type="text" id="${volume.name}_offset" name="${volume.name}_offset" value="0.1" />
|
||||
<button id="${volume.name}_neg_offset" class="clip_offset_negative"><</button>
|
||||
<button id="${volume.name}_pos_offset" class="clip_offset_positive">></button>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; margin-top: 12px">
|
||||
<span></span>
|
||||
<span style="flex-grow: 1"></span>
|
||||
<img class="clipping_volume_action_remove" src="${removeIconPath}" style="width: 16px; height: 16px">
|
||||
</div>
|
||||
<div class="divider" style="padding-top: 10px">
|
||||
<span>Position</span>
|
||||
</div>
|
||||
<div style="margin: 10px 0px">
|
||||
<span class="coordinates_table_container">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th>x</th>
|
||||
<th>y</th>
|
||||
<th>z</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${x}</td>
|
||||
<td>${y}</td>
|
||||
<td>${z}</td>
|
||||
</tr>
|
||||
</table>
|
||||
</span>
|
||||
</div>
|
||||
<div style="margin: 10px 0px">
|
||||
<div style="display:flex; margin: 7px 0px">
|
||||
<span style="display:flex; align-items: center; padding-right: 10px">Offset: </span>
|
||||
<input class="clip_volume_spinner" id="cv_sp_offset_${volume.id}" value="${volume.clipOffset}" style="flex-grow: 1; width:100%">
|
||||
</div>
|
||||
<div style="display:flex; margin: 7px 0px">
|
||||
<span style="display:flex; align-items: center; padding-right: 10px; width: 55px">Global: </span>
|
||||
<div style="display:flex; flex-grow: 1; width:100%">
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_global_x_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">x</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_global_x_incr_${volume.id}">></button>
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_global_y_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">y</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_global_y_incr_${volume.id}">></button>
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_global_z_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">z</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_global_z_incr_${volume.id}">></button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; margin: 7px 0px">
|
||||
<span style="display:flex; align-items: center; padding-right: 10px; width: 55px">Local: </span>
|
||||
<div style="display:flex; flex-grow: 1; width:100%">
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_local_x_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">x</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_local_x_incr_${volume.id}">></button>
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_local_y_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">y</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_local_y_incr_${volume.id}">></button>
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_local_z_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">z</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_local_z_incr_${volume.id}">></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</span>
|
||||
|
||||
<div class="divider" style="padding-top: 10px">
|
||||
<span>Rotation</span>
|
||||
</div>
|
||||
<div style="margin: 10px 0px;">
|
||||
<span class="coordinates_table_container">
|
||||
<table style="width: 100%">
|
||||
<tr>
|
||||
<th>α</th>
|
||||
<th>β</th>
|
||||
<th>γ</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>${rot_alpha}°</td>
|
||||
<td>${rot_beta}°</td>
|
||||
<td>${rot_gamma}°</td>
|
||||
</tr>
|
||||
</table>
|
||||
</span>
|
||||
</div>
|
||||
<div style="margin: 10px 0px; padding-bottom: 10px">
|
||||
<div style="display:flex; margin: 7px 0px">
|
||||
<span style="display:flex; align-items: center; padding-right: 10px">Angle: </span>
|
||||
<input class="clip_volume_spinner" id="cv_sp_rot_offset_${volume.id}" value="${volume.clipRotOffset}" style="flex-grow: 1; width:100%">
|
||||
</div>
|
||||
<div style="display:flex; margin: 7px 0px">
|
||||
<span style="display:flex; align-items: center; padding-right: 10px; width: 55px">Global: </span>
|
||||
<div style="display:flex; flex-grow: 1; width:100%">
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_global_alpha_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">α</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_global_alpha_incr_${volume.id}">></button>
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_global_beta_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">β</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_global_beta_incr_${volume.id}">></button>
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_global_gamma_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">γ</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_global_gamma_incr_${volume.id}">></button>
|
||||
</div>
|
||||
</div>
|
||||
<div style="display:flex; margin: 7px 0px">
|
||||
<span style="display:flex; align-items: center; padding-right: 10px; width: 55px">Local: </span>
|
||||
<div style="display:flex; flex-grow: 1; width:100%">
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_local_alpha_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">α</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_local_alpha_incr_${volume.id}">></button>
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_local_beta_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">β</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_local_beta_incr_${volume.id}">></button>
|
||||
<button class="cv_btn_offset cv_btn_offset_decr" id="cv_btn_local_gamma_decr_${volume.id}"><</button>
|
||||
<span style="padding:2px">γ</span>
|
||||
<button class="cv_btn_offset cv_btn_offset_incr" id="cv_btn_local_gamma_incr_${volume.id}">></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; margin-top: 5px">
|
||||
<span></span>
|
||||
<span style="flex-grow: 1"></span>
|
||||
<img class="clipping_volume_action_remove" src="${removeIconPath}" style="width: 16px; height: 16px">
|
||||
</div>
|
||||
</div>
|
||||
`);
|
||||
|
||||
let clipOffsetInputs = cvItem.find(".clip_offset_container input");
|
||||
clipOffsetInputs.change(function(e) {
|
||||
viewer.clippingTool.setClipOffset(parseInt(e.target.value());
|
||||
|
||||
cvItem.find(".clip_volume_spinner").spinner();
|
||||
|
||||
let cv_btn_offset = cvItem.find(".cv_btn_offset");
|
||||
cv_btn_offset.button();
|
||||
cv_btn_offset.css("padding", "2px");
|
||||
cv_btn_offset.css("margin", "0px 3px");
|
||||
|
||||
let cv_sp_offset = cvItem.find("#cv_sp_offset_" + volume.id);
|
||||
cv_sp_offset.spinner({
|
||||
min: 0.001,
|
||||
max: 1000,
|
||||
step: 1.0,
|
||||
numberFormat: "n",
|
||||
spin: (event, ui) => {
|
||||
let value = cv_sp_offset.spinner("value");
|
||||
volume.setClipOffset(value);
|
||||
},
|
||||
stop: (event, ui) => {
|
||||
let value = cv_sp_offset.spinner("value");
|
||||
volume.setClipOffset(value);
|
||||
}
|
||||
});
|
||||
|
||||
let clipOffsetButtonNeg = cvItem.find(".clip_offset_container .clip_offset_negative");
|
||||
let clipOffsetButtonPos = cvItem.find(".clip_offset_container .clip_offset_positive");
|
||||
clipOffsetButtonNeg.click(function(e) {
|
||||
volume.offset(-viewer.clippingTool.clipOffset);
|
||||
let cv_sp_rot_offset = cvItem.find("#cv_sp_rot_offset_" + volume.id);
|
||||
cv_sp_rot_offset.spinner({
|
||||
min: 1,
|
||||
max: 360,
|
||||
step: 1,
|
||||
numberFormat: "n",
|
||||
spin: (event, ui) => {
|
||||
let value = cv_sp_rot_offset.spinner("value");
|
||||
volume.setClipRotOffset(value);
|
||||
},
|
||||
stop: (event, ui) => {
|
||||
let value = cv_sp_rot_offset.spinner("value");
|
||||
volume.setClipRotOffset(value);
|
||||
}
|
||||
});
|
||||
clipOffsetButtonPos.click(function(e) {
|
||||
volume.offset(viewer.clippingTool.clipOffset);
|
||||
|
||||
let cv_btn_global_x_decr = cvItem.find("#cv_btn_global_x_decr_" + volume.id);
|
||||
let cv_btn_global_x_incr = cvItem.find("#cv_btn_global_x_incr_" + volume.id);
|
||||
let cv_btn_global_y_decr = cvItem.find("#cv_btn_global_y_decr_" + volume.id);
|
||||
let cv_btn_global_y_incr = cvItem.find("#cv_btn_global_y_incr_" + volume.id);
|
||||
let cv_btn_global_z_decr = cvItem.find("#cv_btn_global_z_decr_" + volume.id);
|
||||
let cv_btn_global_z_incr = cvItem.find("#cv_btn_global_z_incr_" + volume.id);
|
||||
|
||||
cv_btn_global_x_decr.click(function(event) {
|
||||
volume.offset({cs: "global", axis: "x", dir: -1});
|
||||
});
|
||||
cv_btn_global_x_incr.click(function(event) {
|
||||
volume.offset({cs: "global", axis: "x", dir: 1});
|
||||
});
|
||||
cv_btn_global_y_decr.click(function(event) {
|
||||
volume.offset({cs: "global", axis: "y", dir: -1});
|
||||
});
|
||||
cv_btn_global_y_incr.click(function(event) {
|
||||
volume.offset({cs: "global", axis: "y", dir: 1});
|
||||
});
|
||||
cv_btn_global_z_decr.click(function(event) {
|
||||
volume.offset({cs: "global", axis: "z", dir: -1});
|
||||
});
|
||||
cv_btn_global_z_incr.click(function(event) {
|
||||
volume.offset({cs: "global", axis: "z", dir: 1});
|
||||
});
|
||||
|
||||
|
||||
let cv_btn_global_alpha_decr = cvItem.find("#cv_btn_global_alpha_decr_" + volume.id);
|
||||
let cv_btn_global_alpha_incr = cvItem.find("#cv_btn_global_alpha_incr_" + volume.id);
|
||||
let cv_btn_global_beta_decr = cvItem.find("#cv_btn_global_beta_decr_" + volume.id);
|
||||
let cv_btn_global_beta_incr = cvItem.find("#cv_btn_global_beta_incr_" + volume.id);
|
||||
let cv_btn_global_gamma_decr = cvItem.find("#cv_btn_global_gamma_decr_" + volume.id);
|
||||
let cv_btn_global_gamma_incr = cvItem.find("#cv_btn_global_gamma_incr_" + volume.id);
|
||||
|
||||
cv_btn_global_alpha_decr.click(function(event) {
|
||||
volume.rotate({cs: "global", axis: "x", dir: -1});
|
||||
});
|
||||
cv_btn_global_alpha_incr.click(function(event) {
|
||||
volume.rotate({cs: "global", axis: "x", dir: 1});
|
||||
});
|
||||
cv_btn_global_beta_decr.click(function(event) {
|
||||
volume.rotate({cs: "global", axis: "y", dir: -1});
|
||||
});
|
||||
cv_btn_global_beta_incr.click(function(event) {
|
||||
volume.rotate({cs: "global", axis: "y", dir: 1});
|
||||
});
|
||||
cv_btn_global_gamma_decr.click(function(event) {
|
||||
volume.rotate({cs: "global", axis: "z", dir: -1});
|
||||
});
|
||||
cv_btn_global_gamma_incr.click(function(event) {
|
||||
volume.rotate({cs: "global", axis: "z", dir: 1});
|
||||
});
|
||||
|
||||
|
||||
let cvRemove = cvItem.find(".clipping_volume_action_remove");
|
||||
cvRemove.click(() => {viewer.scene.removeClipVolume(cv)});
|
||||
@ -1615,19 +1760,32 @@ function initClippingTool() {
|
||||
return cvItem;
|
||||
};
|
||||
|
||||
|
||||
cv.addEventListener("clip_volume_changed", function(event) {
|
||||
let cv = event.volume;
|
||||
let prevCVItem = $("span#" + cv.name);
|
||||
prevCVItem.after(createCVitem(cv));
|
||||
let prevCVItem = $("span#" + cv.name + " .clip_volume_body");
|
||||
let cvItem = createCVitem(cv);
|
||||
prevCVItem.after(cvItem);
|
||||
prevCVItem.remove();
|
||||
});
|
||||
|
||||
|
||||
viewer.addEventListener("clipper.clipOffset_changed", function(event){
|
||||
$(".clip_offset_container input").val(viewer.clippingTool.clipOffset);
|
||||
});
|
||||
let icon = "/icons/clip_volume.svg";
|
||||
let cvWrapper = $(`
|
||||
<span class="scene_item" id="${cv.name}">
|
||||
<!-- HEADER -->
|
||||
<div class="scene_header" onclick="$(this).next().slideToggle(200)">
|
||||
<span class="scene_icon"><img src="${Potree.resourcePath + icon}" class="scene_item_icon" /></span>
|
||||
<span class="scene_header_title">${cv.name}</span>
|
||||
</div>
|
||||
|
||||
<!-- DETAIL -->
|
||||
<div class="measurement_content selectable" style="display: none">
|
||||
${createCVitem(cv).get(0).outerHTML}
|
||||
</div>
|
||||
</span>
|
||||
`);
|
||||
|
||||
cvList.append(createCVitem(cv));
|
||||
cvList.append(cvWrapper);
|
||||
});
|
||||
|
||||
viewer.scene.addEventListener("clip_volume_removed", function(event) {
|
||||
|
||||
@ -1524,7 +1524,7 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
|
||||
|
||||
for(let pointcloud of this.scene.pointclouds){
|
||||
pointcloud.material.setClipBoxes(clipBoxes);
|
||||
pointcloud.material.clipInside = this.clippingTool.clipInside;
|
||||
pointcloud.material.clipMode = this.clippingTool.clipMode;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user