Merge pull request #325 from potree/fprofile

Fprofile
This commit is contained in:
potree 2017-04-26 18:34:31 +02:00 committed by GitHub
commit 20cef3e364
12 changed files with 1973 additions and 1473 deletions

View File

@ -257,6 +257,9 @@ canvas {
body{
margin: 0;
padding: 0;
position: absolute;
width: 100%;
height: 100%;
}
.axis {
@ -265,17 +268,21 @@ body{
}
.axis path{
fill: none;
stroke: var(--font-color);
shape-rendering: crispEdges;
opacity: 0.7;
fill: rgba(255, 255, 255, 0.5);
stroke: var(--font-color);
shape-rendering: crispEdges;
opacity: 0.7;
}
.axis line {
fill: none;
stroke: var(--font-color);
shape-rendering: crispEdges;
opacity: 0.1;
fill: rgba(255, 255, 255, 0.5);
stroke: var(--font-color);
shape-rendering: crispEdges;
opacity: 0.1;
}
.tick text{
font-size: 12px;
}
.measurement_item{
@ -702,3 +709,36 @@ body{
bottom: -5px;
opacity: 1.0;
}
/*
.axis path,
.axis line{
fill: none;
stroke: white;
}
.line{
fill: none;
stroke: blue;
stroke-width: 2px;
}
.tick text{
font-size: 12px;
}
.tick line{
opacity: 0.2;
}
*/

File diff suppressed because it is too large Load Diff

View File

@ -1,9 +1,15 @@
<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_window" style="
position: absolute;
width: 70%; height: 40%;
left: 15%; top: 55%;
margin: 5px;
border: 1px solid black;
display: none; box-sizing: border-box; z-index:10000">
<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"><span data-i18n="profile.title"></span></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="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>
@ -34,7 +40,7 @@
width: 100%;
flex-grow: 1;
position: relative; height: 100%;
box-sizing: border-box;">
box-sizing: border-box; user-select: none">
<div style="
position: absolute;
left: 41px;
@ -52,7 +58,7 @@
width: 100%;
height: 100%;
"></svg>
<canvas id="profileCanvas" style="
<div id="profileCanvasContainer" style="
position: absolute;
left: 41px;
top: 0;
@ -60,8 +66,22 @@
width: calc(100% - 41px);
height: calc(100% - 20px);
/*background-color: #000000;*/
"></canvas>
<div id="profile_selection_marker" style="position: absolute; pointer-events:none;"></div>
"></div>
<div id="profileSelectionProperties" style="
position: absolute;
left: 50px;
top: 10px;
background-color: black;
color: white;
opacity: 0.7;
padding: 5px;
border: 1px solid white;
user-select: auto;
">
position: asdsadf asdf<br>
rgb: 123 423 123
</div>
</div>
</span>

View File

@ -57,7 +57,7 @@
window.viewer = new Potree.Viewer(document.getElementById("potree_render_area"));
viewer.setEDLEnabled(true);
viewer.setEDLEnabled(false);
viewer.setPointSize(1);
viewer.setMaterial("RGB");
viewer.setFOV(60);

View File

@ -78,7 +78,7 @@ Potree.ProfileData = function(profile){
var size = 0;
for(var i = 0; i < this.segments.length; i++){
if(this.segments[i].points){
size += this.segments[i].points.numPoints;
size += this.segments[i].numPoints;
}
}
return size;
@ -94,6 +94,7 @@ Potree.ProfileRequest = function(pointcloud, profile, maxDepth, callback){
this.callback = callback;
this.temporaryResult = new Potree.ProfileData(this.profile);
this.pointsServed = 0;
this.highestLevelServed = 0;
this.priorityQueue = new BinaryHeap(function(x){return 1 / x.weight;});
@ -149,12 +150,12 @@ Potree.ProfileRequest = function(pointcloud, profile, maxDepth, callback){
// add points to result
intersectedNodes.push(node);
Potree.getLRU().touch(node);
this.highestLevelServed = node.getLevel();
if((node.level % node.pcoGeometry.hierarchyStepSize) === 0 && node.hasChildren){
this.traverse(node);
}
}else{
console.log("loading " + node.name);
node.load();
this.priorityQueue.push(element);
}
@ -189,6 +190,7 @@ Potree.ProfileRequest = function(pointcloud, profile, maxDepth, callback){
this.getPointsInsideProfile = function(nodes, target){
let totalMileage = 0;
for(var pi = 0; pi < target.segments.length; pi++){
var segment = target.segments[pi];
@ -202,7 +204,7 @@ Potree.ProfileRequest = function(pointcloud, profile, maxDepth, callback){
if(!segment.points){
segment.points = {};
segment.points.boundingBox = new THREE.Box3();
segment.boundingBox = new THREE.Box3();
for (var property in geometry.attributes) {
if (geometry.attributes.hasOwnProperty(property)) {
@ -213,8 +215,13 @@ Potree.ProfileRequest = function(pointcloud, profile, maxDepth, callback){
}
}
}
segment.points["mileage"] = [];
}
let sv = new THREE.Vector3().subVectors(segment.end, segment.start).setZ(0);
let segmentDir = sv.clone().normalize();
for(var i = 0; i < numPoints; i++){
var pos = new THREE.Vector3(p[3*i], p[3*i+1], p[3*i+2]);
pos.applyMatrix4(pointcloud.matrixWorld);
@ -222,7 +229,13 @@ Potree.ProfileRequest = function(pointcloud, profile, maxDepth, callback){
var centerDistance = Math.abs(segment.halfPlane.distanceToPoint(pos));
if(distance < profile.width / 2 && centerDistance < segment.length / 2){
segment.points.boundingBox.expandByPoint(pos);
segment.boundingBox.expandByPoint(pos);
let svp = new THREE.Vector3().subVectors(pos, segment.start);
let localMileage = segmentDir.dot(svp);
let mileage = localMileage + totalMileage;
segment.points["mileage"].push(mileage);
for (var property in geometry.attributes) {
if (geometry.attributes.hasOwnProperty(property)) {
@ -252,18 +265,24 @@ Potree.ProfileRequest = function(pointcloud, profile, maxDepth, callback){
}
}
segment.points.numPoints = segment.points.position.length;
segment.numPoints = segment.points.position.length;
if(segment.points.numPoints > 0){
target.boundingBox.expandByPoint(segment.points.boundingBox.min);
target.boundingBox.expandByPoint(segment.points.boundingBox.max);
if(segment.numPoints > 0){
target.boundingBox.expandByPoint(segment.boundingBox.min);
target.boundingBox.expandByPoint(segment.boundingBox.max);
target.projectedBoundingBox.expandByPoint(new THREE.Vector2(0, target.boundingBox.min.y));
target.projectedBoundingBox.expandByPoint(new THREE.Vector2(0, target.boundingBox.max.y));
}
totalMileage += segment.length;
}
};
this.finishLevelThenCancel = function(){
this.maxDepth = this.highestLevelServed;
};
this.cancel = function(){
callback.onCancel();

File diff suppressed because it is too large Load Diff

View File

@ -39,8 +39,6 @@ uniform float far;
uniform float heightMin;
uniform float heightMax;
uniform float intensityMin;
uniform float intensityMax;
uniform float size; // pixel size factor
uniform float minSize; // minimum pixel size
uniform float maxSize; // maximum pixel size

View File

@ -184,7 +184,7 @@ Potree.InputHandler = class InputHandler extends THREE.EventDispatcher{
this.pressedKeys[e.keyCode] = true;
e.preventDefault();
//e.preventDefault();
}
onKeyUp(e){

View File

@ -257,6 +257,9 @@ canvas {
body{
margin: 0;
padding: 0;
position: absolute;
width: 100%;
height: 100%;
}
.axis {
@ -265,17 +268,21 @@ body{
}
.axis path{
fill: none;
stroke: var(--font-color);
shape-rendering: crispEdges;
opacity: 0.7;
fill: rgba(255, 255, 255, 0.5);
stroke: var(--font-color);
shape-rendering: crispEdges;
opacity: 0.7;
}
.axis line {
fill: none;
stroke: var(--font-color);
shape-rendering: crispEdges;
opacity: 0.1;
fill: rgba(255, 255, 255, 0.5);
stroke: var(--font-color);
shape-rendering: crispEdges;
opacity: 0.1;
}
.tick text{
font-size: 12px;
}
.measurement_item{
@ -436,12 +443,8 @@ body{
width: 100% !important;
}
.pv-menu-list .ui-selectmenu-button span.ui-selectmenu-text{
line-height: 0.8em;
}
.ui-selectmenu-text{
background-color: white;
.ui-widget{
box-sizing:border-box
}
.panel-body > li > .ui-slider{
@ -702,3 +705,8 @@ body{
bottom: -5px;
opacity: 1.0;
}

View File

@ -1,9 +1,15 @@
<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_window" style="
position: absolute;
width: 70%; height: 40%;
left: 15%; top: 55%;
margin: 5px;
border: 1px solid black;
display: none; box-sizing: border-box; z-index:10000">
<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"><span data-i18n="profile.title"></span></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="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>
@ -34,7 +40,7 @@
width: 100%;
flex-grow: 1;
position: relative; height: 100%;
box-sizing: border-box;">
box-sizing: border-box; user-select: none">
<div style="
position: absolute;
left: 41px;
@ -52,7 +58,7 @@
width: 100%;
height: 100%;
"></svg>
<canvas id="profileCanvas" style="
<div id="profileCanvasContainer" style="
position: absolute;
left: 41px;
top: 0;
@ -60,8 +66,22 @@
width: calc(100% - 41px);
height: calc(100% - 20px);
/*background-color: #000000;*/
"></canvas>
<div id="profile_selection_marker" style="position: absolute; pointer-events:none;"></div>
"></div>
<div id="profileSelectionProperties" style="
position: absolute;
left: 50px;
top: 10px;
background-color: black;
color: white;
opacity: 0.7;
padding: 5px;
border: 1px solid white;
user-select: auto;
">
position: asdsadf asdf<br>
rgb: 123 423 123
</div>
</div>
</span>

File diff suppressed because it is too large Load Diff

View File

@ -1466,14 +1466,22 @@ Potree.Viewer = class PotreeViewer extends THREE.EventDispatcher{
});
let elProfile = $('<div>').load(new URL(Potree.scriptPath + "/profile.html").href, () => {
$('#potree_render_area').append(elProfile.children());
this._2dprofile = new Potree.Viewer.Profile(this, document.getElementById("profile_draw_container"));
$(document.body).append(elProfile.children());
this._2dprofile = new Potree.Viewer.Profile(this);
$("#profile_window").draggable({
handle: $("#profile_titlebar"),
containment: $(document.body)
});
$("#profile_window").resizable();
if(callback){
$(callback);
}
});
});