enhance profile; add remaining properties to saved profiles; add clip mode and minNodeSize to GUI
This commit is contained in:
parent
0de4687b4b
commit
c5e971dc31
@ -141,7 +141,10 @@ Potree.Viewer.MapView = function(viewer){
|
||||
var feature = features[i];
|
||||
|
||||
if(feature.source){
|
||||
content += feature.source.name + "\n";
|
||||
var cloudjsurl = feature.pointcloud.pcoGeometry.url;
|
||||
var pcurl = cloudjsurl.substring(0, cloudjsurl.lastIndexOf("/") + 1);
|
||||
var sourceurl = pcurl + "/source";
|
||||
content += sourceurl + "/" + feature.source.name + "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -428,6 +431,7 @@ Potree.Viewer.MapView = function(viewer){
|
||||
'geometry': new ol.geom.LineString([p1, p2, p3, p4, p1])
|
||||
});
|
||||
feature.source = source;
|
||||
feature.pointcloud = pointcloud;
|
||||
scope.sourcesLayer.getSource().addFeature(feature);
|
||||
|
||||
|
||||
|
||||
@ -1,22 +1,34 @@
|
||||
<div id="profile_window" style="position: absolute; width: 100%; height: 30%; bottom: 0px; border: 1px solid black; display: none">
|
||||
<div id="profile_window" style="position: absolute; width: 100%; height: 30%; bottom: 0px; border: 1px solid black; display: none; box-sizing: border-box;">
|
||||
|
||||
<div id="profile_titlebar" class="pv-titlebar" style="display: flex; position: absolute; height: 30px; width: 100%;">
|
||||
<span style="padding-right: 10px">Height Profile</span>
|
||||
<span id="profileInfo" style="flex-grow: 1; flex-direction: row"> </span>
|
||||
<span id="profile_toggle_size_button" class="ui-icon ui-icon-newwin profile-button"> </span>
|
||||
<span id="closeProfileContainer" class="ui-icon ui-icon-close profile-button"> </span>
|
||||
<div id="profile_titlebar" class="pv-titlebar" style="display: flex; position: absolute; height: 30px; width: 100%; box-sizing: border-box;">
|
||||
<span style="padding-right: 10px">Height Profile</span>
|
||||
<span id="profileInfo" style="flex-grow: 1; flex-direction: row"> </span>
|
||||
<span id="profile_toggle_size_button" class="ui-icon ui-icon-newwin profile-button"> </span>
|
||||
<span id="closeProfileContainer" class="ui-icon ui-icon-close profile-button"> </span>
|
||||
</div>
|
||||
|
||||
<div style="position: absolute; top: 30px; width: 100%; height: calc(100% - 30px);" class="pw_content">
|
||||
<div style="position: absolute; top: 30px; width: 100%; height: calc(100% - 30px); box-sizing: border-box;" class="pw_content">
|
||||
|
||||
<span class="pv-main-color" style="height: 100%; width: 100%; padding: 5px; display:flex; flex-direction: column">
|
||||
<div style=" width: 100%; color: #9d9d9d; margin: 5px;">Points in profile: <span id="profile_num_points">-</span>
|
||||
<span class="pv-main-color" style="height: 100%; width: 100%; padding: 5px; display:flex; flex-direction: column; box-sizing: border-box;">
|
||||
<div style=" width: 100%; color: #9d9d9d; margin: 5px; display: flex; flex-direction: row; box-sizing: border-box;">
|
||||
<span>Points in profile: </span>
|
||||
<span id="profile_num_points">-</span>
|
||||
<!--<span id="profile_threshold" style="width: 300px">
|
||||
Threshold: <span id="potree_profile_threshold_label">123</span> <div id="potree_profile_threshold_slider"></div>
|
||||
</span>-->
|
||||
<span style="flex-grow: 1;"></span>
|
||||
<span>
|
||||
<a id="potree_download_profile_link" href="#" download="profile.las">
|
||||
<input id="potree_download_profile_button" type="button" value="save">
|
||||
</a>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<div id="profile_draw_container" style="
|
||||
width: 100%;
|
||||
flex-grow: 1;
|
||||
position: relative; height: 100%">
|
||||
position: relative; height: 100%;
|
||||
box-sizing: border-box;">
|
||||
<div style="
|
||||
position: absolute;
|
||||
left: 41px;
|
||||
@ -49,4 +61,33 @@
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
|
||||
//$( "#potree_profile_threshold_slider" ).slider({
|
||||
// value: 20*1000,
|
||||
// min: 5000,
|
||||
// max: 100*1000,
|
||||
// step: 100,
|
||||
// slide: function( event, ui ) {viewer._2dprofile.setThreshold(ui.value);}
|
||||
// });
|
||||
|
||||
$('#potree_download_profile_button').click(function(){
|
||||
var las = viewer._2dprofile.getLAS();
|
||||
var u8view = new Uint8Array(las);
|
||||
|
||||
var binString = "";
|
||||
for(var i = 0; i < u8view.length; i++){
|
||||
binString += String.fromCharCode(u8view[i]);
|
||||
}
|
||||
|
||||
var uri = "data:application/octet-stream;base64,"+btoa(binString);
|
||||
$('#potree_download_profile_link').attr("href", uri);
|
||||
//elDownloadProfileLink.href = uri;
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
@ -10,6 +10,7 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
this.pointsProcessed = 0;
|
||||
this.margin = {top: 0, right: 0, bottom: 20, left: 40};
|
||||
this.maximized = false;
|
||||
this.threshold = 20*1000;
|
||||
|
||||
|
||||
$('#closeProfileContainer').click(function(){
|
||||
@ -125,9 +126,17 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
view.setUint32(boffset + 4, uy, true);
|
||||
view.setUint32(boffset + 8, uz, true);
|
||||
|
||||
// intensity
|
||||
// return number
|
||||
// number of returns
|
||||
view.setUint16(boffset + 12, (point.intensity), true);
|
||||
var rt = point.returnNumber;
|
||||
rt += (point.numberOfReturns << 3);
|
||||
view.setUint8(boffset + 14, rt);
|
||||
|
||||
// classification
|
||||
view.setUint8(boffset + 15, point.classification);
|
||||
// scan angle rank
|
||||
// user data
|
||||
// point source id
|
||||
view.setUint16(boffset + 18, point.pointSourceID);
|
||||
|
||||
view.setUint16(boffset + 20, (point.color[0] * 255), true);
|
||||
view.setUint16(boffset + 22, (point.color[1] * 255), true);
|
||||
@ -223,13 +232,12 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
d.z = p.z;
|
||||
d.altitude = p.z;
|
||||
d.heightColor = colorRamp(p.z);
|
||||
//d.color = points.color ? 'rgb(' + points.color[j][0] * 100 + '%,' + points.color[j][1] * 100 + '%,' + points.color[j][2] * 100 + '%)' : 'rgb(0,0,0)';
|
||||
d.color = points.color ? points.color[j] : [0, 0, 0];
|
||||
d.intensity = points.intensity ? 'rgb(' + points.intensity[j] + '%,' + points.intensity[j] + '%,' + points.intensity[j] + '%)' : 'rgb(0,0,0)';
|
||||
d.intensityCode = points.intensity ? points.intensity[j] : 0;
|
||||
d.classificationCode = points.classification ? points.classification[j] : 0;
|
||||
d.intensity = points.intensity ? points.intensity[j] : 0;
|
||||
d.classification = points.classification ? points.classification[j] : 0;
|
||||
d.returnNumber = points.returnNumber ? points.returnNumber[j] : 0;
|
||||
d.numberOfReturns = points.numberOfReturns ? points.numberOfReturns[j] : 0;
|
||||
d.pointSourceID = points.pointSourceID ? points.pointSourceID[j] : 0;
|
||||
data.push(d);
|
||||
}
|
||||
}
|
||||
@ -316,9 +324,9 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
//html += i18n.t('tools.intensity') + ': ' + p.intensityCode;
|
||||
|
||||
var html = 'x: ' + Math.round(10 * p.x) / 10 + ' y: ' + Math.round(10 * p.y) / 10 + ' z: ' + Math.round( 10 * p.altitude) / 10 + ' - ';
|
||||
html += "offset: " + p.distance + ' - ';
|
||||
html += "Classification: " + p.classificationCode + ' - ';
|
||||
html += "Intensity: " + p.intensityCode;
|
||||
html += "offset: " + p.distance.toFixed(3) + ' - ';
|
||||
html += "Classification: " + p.classification + ' - ';
|
||||
html += "Intensity: " + p.intensity;
|
||||
|
||||
$('#profileInfo').css('color', 'yellow');
|
||||
$('#profileInfo').html(html);
|
||||
@ -338,13 +346,14 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
//return d.color;
|
||||
return 'rgb(' + (d.color[0] * 100) + '%,' + (d.color[1] * 100) + '%,' + (d.color[2] * 100) + '%)';
|
||||
} else if (material === Potree.PointColorType.INTENSITY) {
|
||||
return d.intensity;
|
||||
//return d.intensity;
|
||||
return 'rgb(' + points.intensity + '%,' + points.intensity + '%,' + points.intensity + '%)';
|
||||
} else if (material === Potree.PointColorType.CLASSIFICATION) {
|
||||
var classif = scope.viewer.pointclouds[0].material.classification;
|
||||
if (typeof classif[d.classificationCode] != 'undefined'){
|
||||
var color = 'rgb(' + classif[d.classificationCode].x * 100 + '%,';
|
||||
color += classif[d.classificationCode].y * 100 + '%,';
|
||||
color += classif[d.classificationCode].z * 100 + '%)';
|
||||
if (typeof classif[d.classification] != 'undefined'){
|
||||
var color = 'rgb(' + classif[d.classification].x * 100 + '%,';
|
||||
color += classif[d.classification].y * 100 + '%,';
|
||||
color += classif[d.classification].z * 100 + '%)';
|
||||
return color;
|
||||
} else {
|
||||
return 'rgb(255,255,255)';
|
||||
@ -600,7 +609,7 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
|
||||
drawPoints(scope.points, scope.rangeX, scope.rangeY);
|
||||
|
||||
document.getElementById("profile_num_points").innerHTML = Potree.utils.addCommas(scope.pointsProcessed) + " ( threshold: 20k )";
|
||||
document.getElementById("profile_num_points").innerHTML = Potree.utils.addCommas(scope.pointsProcessed) + " ";
|
||||
};
|
||||
|
||||
|
||||
@ -632,7 +641,7 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
|
||||
setupAndDraw();
|
||||
|
||||
if(scope.pointsProcessed > 20*1000){
|
||||
if(scope.pointsProcessed > scope.threshold){
|
||||
scope.cancel();
|
||||
}
|
||||
},
|
||||
@ -652,6 +661,12 @@ Potree.Viewer.Profile = function(viewer, element){
|
||||
}
|
||||
};
|
||||
|
||||
this.setThreshold = function(value){
|
||||
scope.threshold = value;
|
||||
|
||||
scope.redraw();
|
||||
};
|
||||
|
||||
var drawOnChange = function(event){
|
||||
if(event.profile === scope.currentProfile){
|
||||
scope.redraw();
|
||||
|
||||
@ -87,6 +87,15 @@
|
||||
<h3>Settings</h3>
|
||||
<div>
|
||||
<ul class="pv-menu-list">
|
||||
<li>Min Node Size: <span id="lblMinNodeSize"></span><div id="sldMinNodeSize"></div> </li>
|
||||
<li>
|
||||
<label for="optClipMode" class="pv-select-label">Clip Mode </label>
|
||||
<select id="optClipMode" name="optClipMode">
|
||||
<option>No Clipping</option>
|
||||
<option>Highlight Inside</option>
|
||||
<option>Clip Outside</option>
|
||||
</select>
|
||||
</li>
|
||||
<li><label><input type="checkbox" onClick="viewer.setShowBoundingBox(this.checked)"/> show bounding box</label></li>
|
||||
<li><label><input type="checkbox" onClick="viewer.setFreeze(this.checked)"/> freeze</label></li>
|
||||
|
||||
@ -875,29 +884,29 @@ function initMeasurementDetails(){
|
||||
};
|
||||
$(elPanelBody).append(elOpenProfileWindow);
|
||||
|
||||
// download points in profile button
|
||||
var elDownloadProfileLink = document.createElement("a");
|
||||
elDownloadProfileLink.href = "#";
|
||||
elDownloadProfileLink.download = "profile.las";
|
||||
|
||||
var elDownloadProfileButton = $('<input type="button" value="download">')
|
||||
.addClass("measurement-detail-button");
|
||||
elDownloadProfileButton[0].onclick = function(){
|
||||
var las = viewer._2dprofile.getLAS();
|
||||
var u8view = new Uint8Array(las);
|
||||
|
||||
var binString = "";
|
||||
for(var i = 0; i < u8view.length; i++){
|
||||
binString += String.fromCharCode(u8view[i]);
|
||||
}
|
||||
|
||||
var uri = "data:application/octet-stream;base64,"+btoa(binString);
|
||||
elDownloadProfileLink.href = uri;
|
||||
};
|
||||
|
||||
elDownloadProfileLink.appendChild(elDownloadProfileButton[0]);
|
||||
|
||||
$(elPanelBody).append(elDownloadProfileLink);
|
||||
//// download points in profile button
|
||||
//var elDownloadProfileLink = document.createElement("a");
|
||||
//elDownloadProfileLink.href = "#";
|
||||
//elDownloadProfileLink.download = "profile.las";
|
||||
//
|
||||
//var elDownloadProfileButton = $('<input type="button" value="download">')
|
||||
// .addClass("measurement-detail-button");
|
||||
//elDownloadProfileButton[0].onclick = function(){
|
||||
// var las = viewer._2dprofile.getLAS();
|
||||
// var u8view = new Uint8Array(las);
|
||||
//
|
||||
// var binString = "";
|
||||
// for(var i = 0; i < u8view.length; i++){
|
||||
// binString += String.fromCharCode(u8view[i]);
|
||||
// }
|
||||
//
|
||||
// var uri = "data:application/octet-stream;base64,"+btoa(binString);
|
||||
// elDownloadProfileLink.href = uri;
|
||||
//};
|
||||
//
|
||||
//elDownloadProfileLink.appendChild(elDownloadProfileButton[0]);
|
||||
//
|
||||
//$(elPanelBody).append(elDownloadProfileLink);
|
||||
}
|
||||
|
||||
};
|
||||
@ -988,6 +997,52 @@ function initSceneList(){
|
||||
});
|
||||
};
|
||||
|
||||
initSettings = function(){
|
||||
//<li>Min Node Size: <span id="lblMinNodeSize"></span><div id="sldMinNodeSize"></div> </li>
|
||||
|
||||
$( "#sldMinNodeSize" ).slider({
|
||||
value: viewer.getMinNodeSize(),
|
||||
min: 0,
|
||||
max: 1000,
|
||||
step: 0.01,
|
||||
slide: function( event, ui ) {viewer.setMinNodeSize(ui.value);}
|
||||
});
|
||||
|
||||
viewer.addEventListener("minnodesize_changed", function(event){
|
||||
$('#lblMinNodeSize')[0].innerHTML = parseInt(viewer.getMinNodeSize());
|
||||
$( "#lblMinNodeSize" ).slider({value: viewer.getMinNodeSize()});
|
||||
});
|
||||
|
||||
|
||||
var toClipModeCode = function(string){
|
||||
if(string === "No Clipping"){
|
||||
return Potree.ClipMode.DISABLED;
|
||||
}else if(string === "Highlight Inside"){
|
||||
return Potree.ClipMode.HIGHLIGHT_INSIDE;
|
||||
}else if(string === "Clip Outside"){
|
||||
return Potree.ClipMode.CLIP_OUTSIDE;
|
||||
}
|
||||
};
|
||||
|
||||
var toClipModeString = function(code){
|
||||
if(code === Potree.ClipMode.DISABLED){
|
||||
return "No Clipping";
|
||||
}else if(code === Potree.ClipMode.HIGHLIGHT_INSIDE){
|
||||
return "Highlight Inside";
|
||||
}else if(code === Potree.ClipMode.CLIP_OUTSIDE){
|
||||
return "Clip Outside";
|
||||
}
|
||||
};
|
||||
|
||||
$("#optClipMode").selectmenu();
|
||||
$("#optClipMode").val(toClipModeString(viewer.getClipMode())).selectmenu("refresh")
|
||||
$("#optClipMode").selectmenu({
|
||||
change: function(event, ui){
|
||||
viewer.setClipMode(toClipModeCode(ui.item.value));
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
$(document).ready( function() {
|
||||
|
||||
@ -999,6 +1054,7 @@ $(document).ready( function() {
|
||||
initClassificationList();
|
||||
initMeasurementDetails();
|
||||
initSceneList();
|
||||
initSettings()
|
||||
|
||||
});
|
||||
|
||||
|
||||
@ -196,10 +196,16 @@ Potree.Viewer = function(domElement, args){
|
||||
return geoPos;
|
||||
}
|
||||
})(this);
|
||||
|
||||
|
||||
this.getMinNodeSize = function(){
|
||||
return scope.minNodeSize;
|
||||
};
|
||||
|
||||
this.setMinNodeSize = function(value){
|
||||
scope.minNodeSize = value;
|
||||
if(scope.minNodeSize !== value){
|
||||
scope.minNodeSize = value;
|
||||
scope.dispatchEvent({"type": "minnodesize_changed", "viewer": scope});
|
||||
}
|
||||
};
|
||||
|
||||
this.setDescription = function(value){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user