some progress
@ -9,15 +9,19 @@
|
||||
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
|
||||
|
||||
<style>
|
||||
|
||||
.navbar-primary .navbar .nav > li > a:hover {background-color: #000000;}
|
||||
.navbar-primary .navbar .nav.pull-right {margin-left: 10px; margin-right: 0;}
|
||||
.navbar-xs .navbar-primary .navbar { min-height:34px; height: 34px; }
|
||||
.navbar-xs .navbar-primary .navbar { position: relative; margin: 0px; min-height:34px; height: 34px; }
|
||||
.navbar-xs .navbar-primary .navbar .navbar-brand{ padding: 3px 12px;font-size: 16px;line-height: 28px; }
|
||||
.navbar-xs .navbar-primary .navbar .navbar-nav > li > a { padding-top: 0px; padding-bottom: 0px; line-height: 34px; height: 34px;}
|
||||
.navbar-xs .navbar-primary .navbar .navbar-nav > li > a > img { padding-top: 2px; padding-bottom: 2px;}
|
||||
.nav > li > a{ padding: 10px 6px; }
|
||||
|
||||
.navbar{
|
||||
border-radius: 0px;
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.navbar-xs .navbar-primary .navbar .navbar-nav > li > div { padding-top: 0px; padding-bottom: 0px; line-height: 34px; height: 34px;}
|
||||
.nav > li > div{ margin: 10px; padding: 10px 6px; }
|
||||
.dropdown-menu > li > div{ padding: 3px 20px }
|
||||
@ -33,6 +37,7 @@
|
||||
-moz-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
min-width: 200px;
|
||||
}
|
||||
|
||||
li.dropdown.open > ul > li > label {
|
||||
@ -69,6 +74,7 @@
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
<script src="../libs/d3/d3.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
<script src="./js/viewer.js"></script>
|
||||
@ -111,9 +117,13 @@
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div style="height: 100%;">
|
||||
<div class="navbar-xs" id="navbar">
|
||||
<div class="navbar-primary">
|
||||
<nav class="navbar navbar-inverse navbar-fixed-top">
|
||||
<nav class="navbar navbar-primary navbar-inverse">
|
||||
<div class="navbar-collapse collapse">
|
||||
<!--
|
||||
<a class="navbar-brand" href="http://potree.org" target="_blank" title="Potree">
|
||||
@ -128,10 +138,11 @@
|
||||
|
||||
<li class="dropdown">
|
||||
<a href="#" class="dropdown-toggle" role="button" aria-haspopup="true" aria-expanded="false">
|
||||
Appearance
|
||||
Appearance
|
||||
<!--<img src="../resources/icons/distance.png" />-->
|
||||
</a>
|
||||
<ul class="dropdown-menu multi-level" role="menu" aria-labelledby="dLabel" style="width: 250px">
|
||||
<li tabIndex="-1"><a href="#" class="small" data-value="option3" tabIndex="-1">
|
||||
<li data-toggle="tooltip" data-placement="right" title="Maximum number of points that will be rendered."><a href="#" class="small" data-value="option3" tabIndex="-1">
|
||||
Point Budget: <span id="lblPointBudget"></span>
|
||||
<div id="sldPointBudget"></div>
|
||||
</a></li>
|
||||
@ -158,26 +169,26 @@
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Point Sizing</li>
|
||||
|
||||
<li><label><input type="radio" id="optPointSizing_Fixed" name="optPointSizing" onClick="viewer.setPointSizing(this.value);" value="Fixed" /> Fixed</label></li>
|
||||
<li><label><input type="radio" id="optPointSizing_Attenuated" name="optPointSizing" onClick="viewer.setPointSizing(this.value);" value="Attenuated" /> Attenuated</label></li>
|
||||
<li><label><input type="radio" id="optPointSizing_Adaptive" name="optPointSizing" onClick="viewer.setPointSizing(this.value);" value="Adaptive" /> Adaptive</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Point Size = pixel size. Same pixel size for all points"><label><input type="radio" id="optPointSizing_Fixed" name="optPointSizing" onClick="viewer.setPointSizing(this.value);" value="Fixed" /> Fixed</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Point Size = scene units, e.g. meters. Distant points become smaller."><label><input type="radio" id="optPointSizing_Attenuated" name="optPointSizing" onClick="viewer.setPointSizing(this.value);" value="Attenuated" /> Attenuated</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Point Size = factor. Points are automatically resized according to level of detail. Works best with a point size of 1 or smaller."><label><input type="radio" id="optPointSizing_Adaptive" name="optPointSizing" onClick="viewer.setPointSizing(this.value);" value="Adaptive" /> Adaptive</label></li>
|
||||
|
||||
|
||||
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Quality</li>
|
||||
|
||||
<li><label><input type="radio" id="optQuality_Squares" name="optQuality" onClick="viewer.setQuality(this.value);" value="Squares" /> Squares</label></li>
|
||||
<li><label><input type="radio" id="optQuality_Circles" name="optQuality" onClick="viewer.setQuality(this.value);" value="Circles" /> Circles</label></li>
|
||||
<li><label><input type="radio" id="optQuality_Interpolation" name="optQuality" onClick="viewer.setQuality(this.value);" value="Interpolation" /> Interpolation</label></li>
|
||||
<li><label><input type="radio" id="optQuality_Splats" name="optQuality" onClick="viewer.setQuality(this.value);" value="Splats" /> HQ-Splats</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Render each point as a square. Very fast."><label><input type="radio" id="optQuality_Squares" name="optQuality" onClick="viewer.setQuality(this.value);" value="Squares" /> Squares</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Render each point as a circle. Very fast."><label><input type="radio" id="optQuality_Circles" name="optQuality" onClick="viewer.setQuality(this.value);" value="Circles" /> Circles</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Nearest-neighbour-like interpolation between overlapping points. Better quality but slower. Only works if EDL is disabled, at the moment."><label><input type="radio" id="optQuality_Interpolation" name="optQuality" onClick="viewer.setQuality(this.value);" value="Interpolation" /> Interpolation</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Highest Quality but slowest. Only works if EDL is disabled, at the moment."><label><input type="radio" id="optQuality_Splats" name="optQuality" onClick="viewer.setQuality(this.value);" value="Splats" /> HQ-Splats</label></li>
|
||||
|
||||
|
||||
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Eye-Dome-Lighting</li>
|
||||
|
||||
<li><label><input type="checkbox" id="chkEDLEnabled" onClick="viewer.setEDLEnabled(this.checked)"/> enable</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Illumination for point clouds without normals. Must be disabled if you want to use interpolation or HQ-Splat modes."><label><input type="checkbox" id="chkEDLEnabled" onClick="viewer.setEDLEnabled(this.checked)"/> enable</label></li>
|
||||
<li><a href="#" class="small" data-value="option3" tabIndex="-1">
|
||||
radius <span id="lblEDLRadius"></span>
|
||||
<div id="sldEDLRadius"></div>
|
||||
@ -226,9 +237,9 @@
|
||||
|
||||
<li class="dropdown-header">Navigation Mode</li>
|
||||
|
||||
<li><label><input type="radio" id="optNavigation_Orbit" name="optNavigation" onClick="viewer.setNavigationMode(this.value);" value="Orbit" /> Orbit</label></li>
|
||||
<li><label><input type="radio" id="optNavigation_Flight" name="optNavigation" onClick="viewer.setNavigationMode(this.value);" value="Flight" /> Free-Flight</label></li>
|
||||
<li><label><input type="radio" id="optNavigation_Earth" name="optNavigation" onClick="viewer.setNavigationMode(this.value);" value="Earth" /> Earth</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Rotate around pivot point. Double click to set new pivot and zoom towards it."><label><input type="radio" id="optNavigation_Orbit" name="optNavigation" onClick="viewer.setNavigationMode(this.value);" value="Orbit" /> Orbit</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Fly through scene using W,A,S,D and left mouse button"><label><input type="radio" id="optNavigation_Flight" name="optNavigation" onClick="viewer.setNavigationMode(this.value);" value="Flight" /> Free-Flight</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Drag through scene with left button and rotate with right button."><label><input type="radio" id="optNavigation_Earth" name="optNavigation" onClick="viewer.setNavigationMode(this.value);" value="Earth" /> Earth</label></li>
|
||||
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Views</li>
|
||||
@ -252,16 +263,16 @@
|
||||
Settings
|
||||
</a>
|
||||
<ul class="dropdown-menu" >
|
||||
<li><a href="#" class="small" data-value="option3" tabIndex="-1">
|
||||
<li data-toggle="tooltip" data-placement="right" title="Nodes with smaller size on screen will not be rendered. Increase to improve performance."> <a href="#" class="small" data-value="option3" tabIndex="-1">
|
||||
Min Node Size<div id="minNodeSize"></div>
|
||||
</a></li>
|
||||
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Clip Mode</li>
|
||||
|
||||
<li><label><input type="radio" id="optClipMode_NoClipping" name="optClipMode" onClick="viewer.setClipMode(Potree.ClipMode.DISABLED);" /> No Clipping</label></li>
|
||||
<li><label><input type="radio" id="optClipMode_ClipOutside" name="optClipMode" onClick="viewer.setClipMode(Potree.ClipMode.CLIP_OUTSIDE);" /> Clip Outside</label></li>
|
||||
<li><label><input type="radio" id="optClipMode_HighlightInside" name="optClipMode" onClick="viewer.setClipMode(Potree.ClipMode.HIGHLIGHT_INSIDE);" /> Highlight Inside</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="No clipping of points outside height profile or clip volumes."><label><input type="radio" id="optClipMode_NoClipping" name="optClipMode" onClick="viewer.setClipMode(Potree.ClipMode.DISABLED);" /> No Clipping</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Only render points inside height profile or clip volume."><label><input type="radio" id="optClipMode_ClipOutside" name="optClipMode" onClick="viewer.setClipMode(Potree.ClipMode.CLIP_OUTSIDE);" /> Clip Outside</label></li>
|
||||
<li data-toggle="tooltip" data-placement="right" title="Highlight points inside height profile or clip volume and render remaining points normally."><label><input type="radio" id="optClipMode_HighlightInside" name="optClipMode" onClick="viewer.setClipMode(Potree.ClipMode.HIGHLIGHT_INSIDE);" /> Highlight Inside</label></li>
|
||||
|
||||
<li role="separator" class="divider"></li>
|
||||
<li class="dropdown-header">Debug</li>
|
||||
@ -292,72 +303,163 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<!-- Modal -->
|
||||
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">About Potree</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Version: 1.3<br>
|
||||
<br>
|
||||
Author: Markus Schütz<br>
|
||||
mschuetz@potree.org<br>
|
||||
<br>
|
||||
Developed at the <a href="https://www.cg.tuwien.ac.at/" target="_blank">Vienna University of Technology,
|
||||
Institute of Computer Graphics and Algorithms</a>
|
||||
<br>
|
||||
<br>
|
||||
Homepage: <a href="http://potree.org" target="_blank">http://potree.org</a><br>
|
||||
Github: <a href="https://github.com/potree/potree" target="_blank">https://github.com/potree/potree</a><br>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<div id="renderArea" style="position: absolute; width: 100%; height: 100%; overflow: hidden;">
|
||||
<div id="renderArea" style="position: absolute; top: 34px; right: 0; left: 0; bottom: 0; overflow: hidden;">
|
||||
|
||||
<div id="overlays" style="position: absolute; left: 10px; top: 45px;">
|
||||
</div>
|
||||
|
||||
<!-- HEADING -->
|
||||
<div class="info" style="position: absolute; left: 300px; right: 300px; top: 10px; text-align: center;">
|
||||
<div id="description" class="info" style="position: absolute; top: 10px; left: 50%; transform: translateX(-50%); text-align: center"></div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<!-- About Dialog -->
|
||||
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
<h4 class="modal-title" id="myModalLabel">About Potree</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
Version: 1.3<br>
|
||||
<br>
|
||||
Author: Markus Schütz<br>
|
||||
mschuetz@potree.org<br>
|
||||
<br>
|
||||
Developed at the <a href="https://www.cg.tuwien.ac.at/" target="_blank">Vienna University of Technology,
|
||||
Institute of Computer Graphics and Algorithms</a>
|
||||
<br>
|
||||
<br>
|
||||
Homepage: <a href="http://potree.org" target="_blank">http://potree.org</a><br>
|
||||
Github: <a href="https://github.com/potree/potree" target="_blank">https://github.com/potree/potree</a><br>
|
||||
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
<!--
|
||||
<style>
|
||||
|
||||
.pw_root{
|
||||
width: 400px;
|
||||
height: 200px;
|
||||
border: 2px solid black;
|
||||
}
|
||||
|
||||
.pw_titlebar{
|
||||
position: absolute;
|
||||
height: 30px;
|
||||
background-color: blue;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
}
|
||||
|
||||
.pw_content{
|
||||
position: absolute;
|
||||
top: 30px;
|
||||
left: 0px;
|
||||
right: 0px;
|
||||
bottom: 0px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
<div id="profile_panel" class="pw_root" style="position: absolute; width: 400px">
|
||||
<div id="profile_panel_titlebar" class="pw_titlebar">
|
||||
<div id="profile_panel_minimizeButton" class="ui-icon ui-icon-circle-minus"></div>
|
||||
<div id="profile_panel_info"></div>
|
||||
</div>
|
||||
<div style="display: flex; flex-direction: row" class="pw_content">
|
||||
<span style="width: 200px; height: 100%; background-color: red">
|
||||
asd
|
||||
</span>
|
||||
|
||||
<span style="height: 100%; background-color: green; flex-grow: 1">
|
||||
asd
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
-->
|
||||
|
||||
|
||||
<div id="profile" style="position: absolute; top: 100; left: 10; width: 600px; height: 300px; background-color: #222; border: 1px solid black">
|
||||
|
||||
<div id="profile_titlebar" style="display: flex; background-color: #111; color: #9d9d9d; position: absolute; height: 30px; width: 100%;">
|
||||
<span style="flex-grow: 1; flex-direction: row">Height Profiles</span>
|
||||
<span>close</span>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; flex-direction: row; position: absolute; top: 30px; width: 100%; height: calc(100% - 30px);" class="pw_content">
|
||||
<span id="profile_selection" style="position: relative; height: calc(100% - 10px); width: 200px; margin: 5px; background-color: rgb(0,0,0)">
|
||||
</span>
|
||||
|
||||
<span style="height: 100%; flex-grow: 1; background-color: #222; padding: 5px; display:flex; flex-direction: column">
|
||||
<div style=" width: 100%; background-color: #222; color: #9d9d9d">
|
||||
<table style="color: #9d9d9d">
|
||||
<tr>
|
||||
<td style="padding: 1 5;">Points in profile</td>
|
||||
<td><span id="profile_num_points">123</span></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="vertical-align: top; padding: 1 5;">Markers</td>
|
||||
<td><span id="profile_markers"> </span></td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
</div>
|
||||
|
||||
<div id="profile_draw_container" style="
|
||||
width: 100%;
|
||||
background-color: #222;
|
||||
flex-grow: 1;
|
||||
position: relative; height: 100%">
|
||||
<div style="
|
||||
position: absolute;
|
||||
left: 41;
|
||||
top: 0;
|
||||
bottom: 20;
|
||||
width: calc(100% - 41px);
|
||||
height: calc(100% - 20px);
|
||||
background-color: #000000;
|
||||
"></div>
|
||||
<svg id="profileSVG" style="
|
||||
fill: #9d9d9d;
|
||||
position: absolute;
|
||||
left: 0; right: 0;
|
||||
top: 0; bottom: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
/*background-color: #222;*/
|
||||
"></svg>
|
||||
<canvas id="profileCanvas" style="
|
||||
position: absolute;
|
||||
left: 41;
|
||||
top: 0;
|
||||
bottom: 20;
|
||||
width: calc(100% - 41px);
|
||||
height: calc(100% - 20px);
|
||||
/*background-color: #000000;*/
|
||||
"></canvas>
|
||||
|
||||
</div>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
@ -400,6 +502,7 @@
|
||||
viewer.setPointBudget(1*1000*1000);
|
||||
viewer.setShowNavbar(true);
|
||||
viewer.setShowToolbar(true);
|
||||
viewer.setDescription("New User Interface Prototype<br>Feedback to mschuetz@potree.org");
|
||||
|
||||
viewer.addPointCloud("http://localhost/temp/layers/1/cloud.js", function(pointcloud){
|
||||
console.log("point cloud 1 loaded");
|
||||
@ -412,8 +515,6 @@
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
|
||||
<script>
|
||||
@ -426,7 +527,7 @@
|
||||
$(this).parent().toggleClass('open');
|
||||
});
|
||||
|
||||
$('body').on('click', function (e) {
|
||||
$('body').on('mousedown', function (e) {
|
||||
if (!$('li.dropdown').is(e.target)
|
||||
&& $('li.dropdown').has(e.target).length === 0
|
||||
&& $('.open').has(e.target).length === 0
|
||||
@ -434,9 +535,40 @@
|
||||
$('li.dropdown').removeClass('open');
|
||||
}
|
||||
});
|
||||
|
||||
$('li.dropdown > a').on('mouseover', function (event) {
|
||||
$('.open').removeClass("open");
|
||||
$(this).parent().addClass('open');
|
||||
});
|
||||
|
||||
|
||||
|
||||
//$('li.dropdown > ul').on('mouseleave', function (event) {
|
||||
// $(this).parent().removeClass('open');
|
||||
//});
|
||||
|
||||
// #navbar > div > nav > div > ul.nav.navbar-nav.navbar-left > li:nth-child(5)
|
||||
}
|
||||
|
||||
$(document).ready(function(){
|
||||
$('[data-toggle="tooltip"]').tooltip({
|
||||
viewport: {selector: 'body', padding: 2},
|
||||
container: 'body'
|
||||
});
|
||||
});
|
||||
|
||||
$("#profile").draggable({
|
||||
handle: "#profile_titlebar",
|
||||
containment: 'window',
|
||||
scroll: false
|
||||
}).draggable({ scroll: false });
|
||||
|
||||
$("#profile").resizable({
|
||||
minHeight: 15,
|
||||
stop: function(event, ui) {
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
@ -10,8 +10,11 @@
|
||||
}*/
|
||||
|
||||
#renderArea{
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
bottom: 0px;
|
||||
left: 0px;
|
||||
right: 0px:
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
@ -37,4 +40,25 @@ canvas {
|
||||
body{
|
||||
margin: 0;
|
||||
padding: 0
|
||||
}
|
||||
}
|
||||
|
||||
.axis {
|
||||
font: 10px sans-serif;
|
||||
color: white;
|
||||
}
|
||||
|
||||
.axis path{
|
||||
fill: none;
|
||||
stroke: white;
|
||||
shape-rendering: crispEdges;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.axis line {
|
||||
fill: none;
|
||||
stroke: white;
|
||||
shape-rendering: crispEdges;
|
||||
opacity: 0.1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
18
examples/guitest.html
Normal file
@ -0,0 +1,18 @@
|
||||
<html>
|
||||
<head>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@ -62,6 +62,29 @@ Potree.Viewer = function(domElement, args){
|
||||
this.showSkybox = false;
|
||||
this.referenceFrame;
|
||||
|
||||
this.toLocal = (function(viewer){
|
||||
return function(position){
|
||||
var scenePos = position.clone().applyMatrix4(viewer.referenceFrame.matrixWorld);
|
||||
|
||||
return scenePos;
|
||||
}
|
||||
})(this);
|
||||
|
||||
|
||||
this.toGeo = (function(viewer){
|
||||
return function(position){
|
||||
var inverse = new THREE.Matrix4().getInverse(viewer.referenceFrame.matrixWorld);
|
||||
var geoPos = position.clone().applyMatrix4(inverse);
|
||||
|
||||
return geoPos;
|
||||
}
|
||||
})(this);
|
||||
|
||||
|
||||
this.setDescription = function(value){
|
||||
document.getElementById("description").innerHTML = value;
|
||||
};
|
||||
|
||||
this.setNavigationMode = function(value){
|
||||
if(value === "Orbit"){
|
||||
this.useOrbitControls();
|
||||
@ -394,6 +417,12 @@ Potree.Viewer = function(domElement, args){
|
||||
function(){scope.measuringTool.startInsertion({showDistances: false, showAngles: true, showArea: false, closed: true, maxMarkers: 3})}
|
||||
));
|
||||
|
||||
elToolbar.appendChild(createToolIcon(
|
||||
"../resources/icons/point.png",
|
||||
"angle measurements",
|
||||
function(){scope.measuringTool.startInsertion({showDistances: false, showAngles: false, showCoordinates: true, showArea: false, closed: true, maxMarkers: 1})}
|
||||
));
|
||||
|
||||
elToolbar.appendChild(createToolIcon(
|
||||
"../resources/icons/distance.png",
|
||||
"distance measurements",
|
||||
@ -484,6 +513,12 @@ Potree.Viewer = function(domElement, args){
|
||||
function(){scope.measuringTool.startInsertion({showDistances: false, showAngles: true, showArea: false, closed: true, maxMarkers: 3})}
|
||||
));
|
||||
|
||||
elToolbar.appendChild(createToolIcon(
|
||||
"../resources/icons/angle.png",
|
||||
"coordinate measurements",
|
||||
function(){scope.measuringTool.startInsertion({showDistances: false, showAngles: true, showArea: false, closed: true, maxMarkers: 1})}
|
||||
));
|
||||
|
||||
elToolbar.appendChild(createToolIcon(
|
||||
"../resources/icons/distance.png",
|
||||
"distance measurements",
|
||||
@ -1014,6 +1049,36 @@ Potree.Viewer = function(domElement, args){
|
||||
scope.transformationTool = new Potree.TransformationTool(scope.scenePointCloud, scope.camera, scope.renderer);
|
||||
scope.volumeTool = new Potree.VolumeTool(scope.scenePointCloud, scope.camera, scope.renderer, scope.transformationTool);
|
||||
|
||||
scope.profileTool.addEventListener("profile_added", function(profileEvent){
|
||||
var profileButton = document.createElement("input");
|
||||
profileButton.type = "button";
|
||||
profileButton.style.width = "100%";
|
||||
profileButton.value = "profile " + scope.profileTool.profiles.length;
|
||||
|
||||
profileButton.onclick = function(clickEvent){
|
||||
scope.profileTool.draw(
|
||||
profileEvent.profile,
|
||||
$("#profile_draw_container")[0],
|
||||
scope.toGeo);
|
||||
profileEvent.profile.addEventListener("marker_moved", function(){
|
||||
scope.profileTool.draw(
|
||||
profileEvent.profile,
|
||||
$("#profile_draw_container")[0],
|
||||
scope.toGeo);
|
||||
});
|
||||
profileEvent.profile.addEventListener("width_changed", function(){
|
||||
scope.profileTool.draw(
|
||||
profileEvent.profile,
|
||||
$("#profile_draw_container")[0],
|
||||
scope.toGeo);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
|
||||
$("#profile_selection")[0].appendChild(profileButton);
|
||||
});
|
||||
|
||||
|
||||
// background
|
||||
// var texture = THREE.ImageUtils.loadTexture( '../resources/textures/background.gif' );
|
||||
@ -1843,8 +1908,6 @@ Potree.Viewer.prototype = Object.create( THREE.EventDispatcher.prototype );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
142
examples/perf.html
Normal file
@ -0,0 +1,142 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8"/>
|
||||
<title>Potree Viewer</title>
|
||||
<!--<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, minimum-scale=1, user-scalable=no">-->
|
||||
<link rel="stylesheet" type="text/css" href="css/potree.css">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<script src="../libs/three.js/build/three.js"></script>
|
||||
<script src="../libs/other/stats.min.js"></script>
|
||||
<script src="../libs/other/dat.gui.min.js"></script>
|
||||
<script src="../libs/other/BinaryHeap.js"></script>
|
||||
<script src="../libs/tween/tween.min.js"></script>
|
||||
|
||||
<script src="../build/js/potree.js"></script>
|
||||
<script src="../src/OrbitControls.js"></script>
|
||||
|
||||
<div id="renderArea" style="position: absolute; top: 0px; right: 0; left: 0; bottom: 0; overflow: hidden;">
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
<script>
|
||||
var renderArea = document.getElementById("renderArea");
|
||||
var renderer = renderer = new THREE.WebGLRenderer();
|
||||
renderArea.appendChild(renderer.domElement);
|
||||
|
||||
var near = 0.01;
|
||||
var far = 1000;
|
||||
var scene = new THREE.Scene();
|
||||
var camera = new THREE.PerspectiveCamera(60, 1, near, far);
|
||||
|
||||
camera.position.set(0,0,10);
|
||||
camera.lookAt(new THREE.Vector3(0,0,0));
|
||||
|
||||
//var sg = new THREE.SphereGeometry(1);
|
||||
//var sm = new THREE.Mesh(sg);
|
||||
//scene.add(sm);
|
||||
|
||||
controls = new Potree.OrbitControls( camera, renderer.domElement );
|
||||
|
||||
stats = new Stats();
|
||||
document.body.appendChild(stats.domElement);
|
||||
|
||||
function generatePointCloudGeometry( color, width, length ){
|
||||
|
||||
var geometry = new THREE.BufferGeometry();
|
||||
var numPoints = width*length;
|
||||
|
||||
var positions = new Float32Array( numPoints*3 );
|
||||
var colors = new Float32Array( numPoints*3 );
|
||||
|
||||
var k = 0;
|
||||
|
||||
for( var i = 0; i < width; i++ ) {
|
||||
|
||||
for( var j = 0; j < length; j++ ) {
|
||||
|
||||
var u = i / width;
|
||||
var v = j / length;
|
||||
var x = u - 0.5;
|
||||
var y = ( Math.cos( u * Math.PI * 8 ) + Math.sin( v * Math.PI * 8 ) ) / 20;
|
||||
var z = v - 0.5;
|
||||
|
||||
positions[ 3 * k ] = x;
|
||||
positions[ 3 * k + 1 ] = y;
|
||||
positions[ 3 * k + 2 ] = z;
|
||||
|
||||
var intensity = ( y + 0.1 ) * 5;
|
||||
colors[ 3 * k ] = color.r * intensity;
|
||||
colors[ 3 * k + 1 ] = color.g * intensity;
|
||||
colors[ 3 * k + 2 ] = color.b * intensity;
|
||||
|
||||
k++;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
geometry.addAttribute( 'position', new THREE.BufferAttribute( positions, 3 ) );
|
||||
geometry.addAttribute( 'color', new THREE.BufferAttribute( colors, 3 ) );
|
||||
geometry.computeBoundingBox();
|
||||
|
||||
return geometry;
|
||||
|
||||
}
|
||||
|
||||
function generatePointcloud( color, width, length ) {
|
||||
|
||||
var geometry = generatePointCloudGeometry( color, width, length );
|
||||
|
||||
var material = new THREE.PointCloudMaterial( {
|
||||
size: 0.000001,
|
||||
vertexColors: THREE.VertexColors,
|
||||
depthTest: false,
|
||||
depthWrite: false
|
||||
} );
|
||||
var pointcloud = new THREE.PointCloud( geometry, material );
|
||||
|
||||
return pointcloud;
|
||||
|
||||
}
|
||||
|
||||
var pc = generatePointcloud(new THREE.Color( 1,0,0 ), 1000, 500);
|
||||
scene.add(pc);
|
||||
|
||||
function loop(){
|
||||
requestAnimationFrame(loop);
|
||||
|
||||
var width = renderArea.clientWidth;
|
||||
var height = renderArea.clientHeight;
|
||||
var aspect = width / height;
|
||||
|
||||
camera.aspect = aspect;
|
||||
renderer.setSize(width, height);
|
||||
|
||||
renderer.render(scene, camera);
|
||||
|
||||
controls.update(0.1);
|
||||
stats.update();
|
||||
};
|
||||
|
||||
requestAnimationFrame(loop);
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
51
examples/svg.html
Normal file
@ -0,0 +1,51 @@
|
||||
<html>
|
||||
<body>
|
||||
|
||||
|
||||
<svg id="mySVG" viewBox="0 0 1 1" style="width: 100%; height: 100%; border: 1px solid red">
|
||||
|
||||
</svg>
|
||||
|
||||
|
||||
<script>
|
||||
|
||||
var numPoints = 20*1000;
|
||||
var svg = document.getElementById("mySVG");
|
||||
|
||||
for (i=0; i < numPoints; i++){
|
||||
|
||||
var u = i / numPoints;
|
||||
|
||||
x = Math.random();
|
||||
y = Math.random();
|
||||
|
||||
var svgns = "http://www.w3.org/2000/svg";
|
||||
|
||||
var shape = document.createElementNS(svgns, "circle");
|
||||
shape.setAttributeNS(null, "cx", x);
|
||||
shape.setAttributeNS(null, "cy", y);
|
||||
shape.setAttributeNS(null, "r", 0.001);
|
||||
shape.setAttributeNS(null, "fill", "green");
|
||||
|
||||
svg.appendChild(shape);
|
||||
}
|
||||
|
||||
|
||||
function loop(){
|
||||
requestAnimationFrame(loop);
|
||||
|
||||
var width = svg.clientWidth;
|
||||
var height = svg.clientHeight;
|
||||
|
||||
svg.viewBox.baseVal.width = 1;
|
||||
svg.viewBox.baseVal.height = height / width;
|
||||
|
||||
//svg.setAttribute("viewbox","0 0 " + width + " " + height);
|
||||
}
|
||||
|
||||
requestAnimationFrame(loop);
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
26
libs/d3/LICENSE
Normal file
@ -0,0 +1,26 @@
|
||||
Copyright (c) 2010-2015, Michael Bostock
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
* Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
* Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
* The name Michael Bostock may not be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL MICHAEL BOSTOCK BE LIABLE FOR ANY DIRECT,
|
||||
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
|
||||
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
|
||||
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
9504
libs/d3/d3.js
vendored
Normal file
5
libs/d3/d3.min.js
vendored
Normal file
|
Before Width: | Height: | Size: 776 B After Width: | Height: | Size: 614 B |
@ -14,7 +14,10 @@
|
||||
id="svg3797"
|
||||
version="1.1"
|
||||
inkscape:version="0.48.5 r10040"
|
||||
sodipodi:docname="area.svg">
|
||||
sodipodi:docname="area.svg"
|
||||
inkscape:export-filename="D:\dev\workspaces\potree\develop\resources\icons\area.png"
|
||||
inkscape:export-xdpi="90"
|
||||
inkscape:export-ydpi="90">
|
||||
<defs
|
||||
id="defs3799" />
|
||||
<sodipodi:namedview
|
||||
@ -26,16 +29,16 @@
|
||||
inkscape:pageshadow="2"
|
||||
inkscape:zoom="22.395604"
|
||||
inkscape:cx="9.4591229"
|
||||
inkscape:cy="15.712251"
|
||||
inkscape:cy="15.332712"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="1920"
|
||||
inkscape:window-height="1138"
|
||||
inkscape:window-x="-8"
|
||||
inkscape:window-y="-8"
|
||||
inkscape:window-maximized="1">
|
||||
inkscape:window-width="944"
|
||||
inkscape:window-height="1002"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="0"
|
||||
inkscape:window-maximized="0">
|
||||
<inkscape:grid
|
||||
type="xygrid"
|
||||
id="grid3805" />
|
||||
@ -48,7 +51,7 @@
|
||||
<dc:format>image/svg+xml</dc:format>
|
||||
<dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
|
||||
<dc:title />
|
||||
<dc:title></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
|
||||
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 4.2 KiB |
BIN
resources/icons/point.png
Normal file
|
After Width: | Height: | Size: 487 B |
73
resources/icons/point.svg
Normal file
@ -0,0 +1,73 @@
|
||||
<?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.48.5 r10040"
|
||||
sodipodi:docname="point.svg"
|
||||
inkscape:export-filename="D:\dev\workspaces\potree\develop\resources\icons\point.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="15.836083"
|
||||
inkscape:cx="14.572582"
|
||||
inkscape:cy="14.881909"
|
||||
inkscape:current-layer="layer1"
|
||||
showgrid="true"
|
||||
inkscape:grid-bbox="true"
|
||||
inkscape:document-units="px"
|
||||
inkscape:window-width="463"
|
||||
inkscape:window-height="454"
|
||||
inkscape:window-x="150"
|
||||
inkscape:window-y="150"
|
||||
inkscape:window-maximized="0">
|
||||
<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></dc:title>
|
||||
</cc:Work>
|
||||
</rdf:RDF>
|
||||
</metadata>
|
||||
<g
|
||||
id="layer1"
|
||||
inkscape:label="Layer 1"
|
||||
inkscape:groupmode="layer">
|
||||
<path
|
||||
sodipodi:type="arc"
|
||||
style="fill:#ff0000;fill-opacity:1;stroke:#000000;stroke-width:2.52600002;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none"
|
||||
id="path3807-4"
|
||||
sodipodi:cx="11"
|
||||
sodipodi:cy="22"
|
||||
sodipodi:rx="6"
|
||||
sodipodi:ry="6"
|
||||
d="M 17,22 A 6,6 0 1 1 5,22 6,6 0 1 1 17,22 z"
|
||||
transform="matrix(0.91666667,0,0,0.91666667,5.8535197,-4.2877854)" />
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 933 B After Width: | Height: | Size: 885 B |
@ -15,6 +15,7 @@ Potree.Measure = function(){
|
||||
this.sphereLabels = [];
|
||||
this.edgeLabels = [];
|
||||
this.angleLabels = [];
|
||||
this.coordinateLabels = [];
|
||||
|
||||
this.areaLabel = new Potree.TextSprite("");
|
||||
this.areaLabel.setBorderColor({r:0, g:0, b:0, a:0.8});
|
||||
@ -115,6 +116,17 @@ Potree.Measure = function(){
|
||||
this.angleLabels.push(angleLabel);
|
||||
this.add(angleLabel);
|
||||
}
|
||||
|
||||
{ // coordinate labels
|
||||
var coordinateLabel = new Potree.TextSprite();
|
||||
coordinateLabel.setBorderColor({r:0, g:0, b:0, a:0.8});
|
||||
coordinateLabel.setBackgroundColor({r:0, g:0, b:0, a:0.3});
|
||||
coordinateLabel.material.depthTest = false;
|
||||
coordinateLabel.material.opacity = 1;
|
||||
coordinateLabel.visible = false;
|
||||
this.coordinateLabels.push(coordinateLabel);
|
||||
this.add(coordinateLabel);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -138,6 +150,7 @@ Potree.Measure = function(){
|
||||
|
||||
this.remove(this.edgeLabels[edgeIndex]);
|
||||
this.edgeLabels.splice(edgeIndex, 1);
|
||||
this.coordinateLabels.splice(index, 1);
|
||||
|
||||
this.spheres.splice(index, 1);
|
||||
|
||||
@ -187,6 +200,18 @@ Potree.Measure = function(){
|
||||
var point = this.points[0];
|
||||
this.spheres[0].position.copy(point);
|
||||
|
||||
{// coordinate labels
|
||||
var coordinateLabel = this.coordinateLabels[0];
|
||||
|
||||
var labelPos = point.clone().add(new THREE.Vector3(0,1,0));
|
||||
coordinateLabel.position.copy(labelPos);
|
||||
|
||||
var msg = point.x.toFixed(2) + " / " + point.y.toFixed(2) + " / " + point.z.toFixed(2);
|
||||
coordinateLabel.setText(msg);
|
||||
|
||||
coordinateLabel.visible = this.showCoordinates && (index < lastIndex || this.closed);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@ -259,6 +284,18 @@ Potree.Measure = function(){
|
||||
|
||||
angleLabel.visible = this.showAngles && (index < lastIndex || this.closed) && this.points.length >= 3 && angle > 0;
|
||||
}
|
||||
|
||||
{// coordinate labels
|
||||
var coordinateLabel = this.coordinateLabels[0];
|
||||
|
||||
var labelPos = point.clone().add(new THREE.Vector3(0,1,0));
|
||||
coordinateLabel.position.copy(labelPos);
|
||||
|
||||
var msg = point.x.toFixed(2) + " / " + point.y.toFixed(2) + " / " + point.z.toFixed(2);
|
||||
coordinateLabel.setText(msg);
|
||||
|
||||
coordinateLabel.visible = this.showCoordinates && (index < lastIndex || this.closed);
|
||||
}
|
||||
}
|
||||
|
||||
// update area label
|
||||
@ -357,6 +394,7 @@ Potree.MeasuringTool = function(scene, camera, renderer){
|
||||
if(I){
|
||||
var pos = I.clone();
|
||||
|
||||
|
||||
scope.activeMeasurement.addMarker(pos);
|
||||
|
||||
var event = {
|
||||
@ -557,6 +595,7 @@ Potree.MeasuringTool = function(scene, camera, renderer){
|
||||
var showArea = (typeof args.showArea != "undefined") ? args.showArea : false;
|
||||
var showAngles = (typeof args.showAngles != "undefined") ? args.showAngles : false;
|
||||
var closed = (typeof args.closed != "undefined") ? args.closed : false;
|
||||
var showCoordinates = (typeof args.showCoordinates != "undefined") ? args.showCoordinates : false;
|
||||
var maxMarkers = args.maxMarkers || Number.MAX_SAFE_INTEGER;
|
||||
|
||||
var measurement = new Potree.Measure();
|
||||
@ -564,6 +603,7 @@ Potree.MeasuringTool = function(scene, camera, renderer){
|
||||
measurement.showArea = showArea;
|
||||
measurement.showAngles = showAngles;
|
||||
measurement.closed = closed;
|
||||
measurement.showCoordinates = showCoordinates;
|
||||
measurement.maxMarkers = maxMarkers;
|
||||
|
||||
this.addMeasurement(measurement);
|
||||
@ -660,6 +700,37 @@ Potree.MeasuringTool = function(scene, camera, renderer){
|
||||
label.scale.set(scale, scale, scale);
|
||||
}
|
||||
|
||||
// coordinate labels
|
||||
for(var j = 0; j < measurement.coordinateLabels.length; j++){
|
||||
var label = measurement.coordinateLabels[j];
|
||||
var sphere = measurement.spheres[j];
|
||||
|
||||
var distance = scope.camera.position.distanceTo(sphere.getWorldPosition());
|
||||
|
||||
var screenPos = sphere.getWorldPosition().clone().project( camera );
|
||||
screenPos.x = Math.round( ( screenPos.x + 1 ) * scope.renderer.domElement.clientWidth / 2 ),
|
||||
screenPos.y = Math.round( ( - screenPos.y + 1 ) * scope.renderer.domElement.clientHeight / 2 );
|
||||
screenPos.z = 0;
|
||||
screenPos.y -= 30;
|
||||
|
||||
var labelPos = new THREE.Vector3(
|
||||
(screenPos.x / scope.renderer.domElement.clientWidth) * 2 - 1,
|
||||
-(screenPos.y / scope.renderer.domElement.clientHeight) * 2 + 1,
|
||||
0.5 );
|
||||
labelPos.unproject(scope.camera);
|
||||
|
||||
var direction = labelPos.sub(scope.camera.position).normalize();
|
||||
labelPos = new THREE.Vector3().addVectors(
|
||||
scope.camera.position, direction.multiplyScalar(distance));
|
||||
|
||||
label.position.copy(labelPos);
|
||||
viewer.infos.set("labelPos", label.position.x);
|
||||
|
||||
var pr = projectedRadius(1, scope.camera.fov * Math.PI / 180, distance, renderer.domElement.clientHeight);
|
||||
var scale = (70 / pr);
|
||||
label.scale.set(scale, scale, scale);
|
||||
}
|
||||
|
||||
// areaLabel
|
||||
var distance = scope.camera.position.distanceTo(measurement.areaLabel.getWorldPosition());
|
||||
var pr = projectedRadius(1, scope.camera.fov * Math.PI / 180, distance, renderer.domElement.clientHeight);
|
||||
|
||||
@ -651,6 +651,287 @@ Potree.ProfileTool = function(scene, camera, renderer){
|
||||
renderer.render(this.sceneProfile, this.camera);
|
||||
};
|
||||
|
||||
this.preparePoints = function(profileProgress, toGeo, args){
|
||||
|
||||
var segments = profileProgress.segments;
|
||||
if (segments.length === 0){
|
||||
return false;
|
||||
}
|
||||
|
||||
var data = [];
|
||||
var distance = 0;
|
||||
var totalDistance = 0;
|
||||
var minX = Math.max();
|
||||
var minY = Math.max();
|
||||
var minZ = Math.max();
|
||||
var maxX = 0;
|
||||
var maxY = 0;
|
||||
var maxZ = 0;
|
||||
|
||||
//// Get the same color map as Three
|
||||
//var minRange = toGeo(new THREE.Vector3(0, args.heightMin, 0));
|
||||
//var maxRange = toGeo(new THREE.Vector3(0, args.heightMax, 0));
|
||||
//var heightRange = maxRange.z - minRange.z;
|
||||
//var colorRange = [];
|
||||
//var colorDomain = [];
|
||||
//
|
||||
//// Read the altitude gradient used in 3D scene
|
||||
//for (var c = 0; c < pv.scene3D.pointcloud.material.gradient.length; c++){
|
||||
// colorDomain.push(minRange.z + heightRange * pv.scene3D.pointcloud.material.gradient[c][0]);
|
||||
// colorRange.push('#' + pv.scene3D.pointcloud.material.gradient[c][1].getHexString());
|
||||
//}
|
||||
//
|
||||
//// Altitude color map scale
|
||||
//var colorRamp = d3.scale.linear()
|
||||
// .domain(colorDomain)
|
||||
// .range(colorRange);
|
||||
|
||||
// Iterate the profile's segments
|
||||
for(var i = 0; i < segments.length; i++){
|
||||
var segment = segments[i];
|
||||
var segStartGeo = toGeo(segment.start);
|
||||
var segEndGeo = toGeo(segment.end);
|
||||
var xOA = segEndGeo.x - segStartGeo.x;
|
||||
var yOA = segEndGeo.y - segStartGeo.y;
|
||||
var segmentLength = Math.sqrt(xOA * xOA + yOA * yOA);
|
||||
var points = segment.points;
|
||||
|
||||
// Iterate the segments' points
|
||||
for(var j = 0; j < points.numPoints; j++){
|
||||
var p = toGeo(points.position[j]);
|
||||
// get min/max values
|
||||
if (p.x < minX) { minX = p.x;}
|
||||
|
||||
if (p.y < minY) { minY = p.y;}
|
||||
|
||||
if (p.z < minZ) { minZ = p.z;}
|
||||
|
||||
if (p.x > maxX) { maxX = p.x;}
|
||||
|
||||
if (p.y < maxY) { maxY = p.y;}
|
||||
|
||||
if (p.z < maxZ) { maxZ = p.z;}
|
||||
|
||||
var xOB = p.x - segStartGeo.x;
|
||||
var yOB = p.y - segStartGeo.y;
|
||||
var hypo = Math.sqrt(xOB * xOB + yOB * yOB);
|
||||
var cosAlpha = (xOA * xOB + yOA * yOB)/(Math.sqrt(xOA * xOA + yOA * yOA) * hypo);
|
||||
var alpha = Math.acos(cosAlpha);
|
||||
var dist = hypo * cosAlpha + totalDistance;
|
||||
if (!isNaN(dist)) {
|
||||
data.push({
|
||||
'distance': dist,
|
||||
'x': p.x,
|
||||
'y': p.y,
|
||||
'altitude': p.z,
|
||||
'color': 'rgb(' + points.color[j][0] * 100 + '%,' + points.color[j][1] * 100 + '%,' + points.color[j][2] * 100 + '%)',
|
||||
'intensity': 'rgb(' + points.intensity[j] + '%,' + points.intensity[j] + '%,' + points.intensity[j] + '%)',
|
||||
'intensityCode': points.intensity[j],
|
||||
//'heightColor': colorRamp(p.z),
|
||||
'classificationCode': points.classification[j]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// Increment distance from the profile start point
|
||||
totalDistance += segmentLength;
|
||||
}
|
||||
|
||||
var output = {
|
||||
'data': data,
|
||||
'minX': minX,
|
||||
'minY': minY,
|
||||
'minZ': minZ,
|
||||
'maxX': maxX,
|
||||
'maxY': maxY,
|
||||
'maxZ': maxZ
|
||||
};
|
||||
|
||||
return output;
|
||||
};
|
||||
|
||||
this.draw = function(profile, target, toGeo, args){
|
||||
// TODO handle all pointclouds
|
||||
// TODO are the used closures safe for garbage collection?
|
||||
|
||||
if(!scope.__drawData){
|
||||
scope.__drawData = {};
|
||||
}
|
||||
var dd = scope.__drawData;
|
||||
|
||||
if(dd.request){
|
||||
dd.request.cancel();
|
||||
}
|
||||
dd.points = [];
|
||||
|
||||
var pointClouds = [];
|
||||
scope.scene.traverse(function(object){
|
||||
if(object instanceof Potree.PointCloudOctree || object instanceof Potree.PointCloudArena4D){
|
||||
pointClouds.push(object);
|
||||
}
|
||||
});
|
||||
|
||||
var pointcloud = pointClouds[0];
|
||||
|
||||
var drawPoints = function(canvas, points, scaleX, scaleY) {
|
||||
var pointSize = 2;
|
||||
var i = -1, n = points.length, d, cx, cy;
|
||||
while (++i < n) {
|
||||
d = points[i];
|
||||
cx = scaleX(d.distance);
|
||||
cy = scaleY(d.altitude);
|
||||
canvas.moveTo(cx, cy);
|
||||
canvas.fillRect(cx, cy, pointSize, pointSize);
|
||||
//canvas.fillStyle = pv.profile.strokeColor(d);
|
||||
canvas.fillStyle = d.color;
|
||||
}
|
||||
};
|
||||
|
||||
{
|
||||
var elMarkers = document.getElementById("profile_markers");
|
||||
var message = "";
|
||||
|
||||
for(var i = 0; i < profile.points.length; i++){
|
||||
var marker = profile.points[i];
|
||||
var markerPos = toGeo(marker);
|
||||
|
||||
message += markerPos.x.toFixed(2) + ", ";
|
||||
message += markerPos.y.toFixed(2) + ", ";
|
||||
message += markerPos.z.toFixed(2) + "<br>";
|
||||
}
|
||||
elMarkers.innerHTML = message;
|
||||
}
|
||||
|
||||
|
||||
|
||||
var projectedBoundingBox = null;
|
||||
dd.request = pointcloud.getPointsInProfile(profile, null, {
|
||||
"onProgress": function(event){
|
||||
console.log("progress " + dd.request.pointsServed);
|
||||
|
||||
var segments = event.points.segments;
|
||||
|
||||
if(!projectedBoundingBox){
|
||||
projectedBoundingBox = event.points.projectedBoundingBox;
|
||||
}
|
||||
|
||||
var result = scope.preparePoints(event.points, toGeo, args);
|
||||
dd.points = dd.points.concat(result.data);
|
||||
|
||||
var markers = profile.points;
|
||||
|
||||
|
||||
|
||||
|
||||
var containerWidth = target.clientWidth;
|
||||
var containerHeight = target.clientHeight;
|
||||
var margin = {top: 0, right: 0, bottom: 20, left: 40};
|
||||
var width = containerWidth - (margin.left + margin.right);
|
||||
var height = containerHeight - (margin.top + margin.bottom);
|
||||
|
||||
var scaleX = d3.scale.linear().range([0, width]);
|
||||
scaleX.domain([d3.min(dd.points, function(d) { return d.distance; }), d3.max(dd.points, function(d) { return d.distance; })]);
|
||||
|
||||
// Y scale
|
||||
var scaleY = d3.scale.linear().range([height,0]);
|
||||
scaleY.domain([d3.min(dd.points, function(d) { return d.altitude; }), d3.max(dd.points, function(d) { return d.altitude; })]);
|
||||
|
||||
var zoom = d3.behavior.zoom()
|
||||
.x(scaleX)
|
||||
.y(scaleY)
|
||||
.scaleExtent([0,8])
|
||||
.size([width, height])
|
||||
.on("zoom", function(){
|
||||
var t = zoom.translate();
|
||||
//var tx = t[0];
|
||||
//var ty = t[1];
|
||||
//
|
||||
//tx = Math.min(tx, 0);
|
||||
//tx = Math.max(tx, width - projectedBoundingBox.max.x);
|
||||
//zoom.translate([tx, ty]);
|
||||
|
||||
svg.select(".x.axis").call(xAxis);
|
||||
svg.select(".y.axis").call(yAxis);
|
||||
|
||||
canvas.clearRect(0, 0, width, height);
|
||||
drawPoints(canvas, dd.points, scaleX, scaleY);
|
||||
});
|
||||
|
||||
var canvas = d3.select("#profileCanvas")
|
||||
.attr("width", width)
|
||||
.attr("height", height)
|
||||
.call(zoom)
|
||||
.node().getContext("2d");
|
||||
|
||||
//d3.select("svg#profile_draw_container").remove();
|
||||
d3.select("svg#profileSVG").selectAll("*").remove();
|
||||
|
||||
svg = d3.select("svg#profileSVG")
|
||||
.call(zoom)
|
||||
.attr("width", (width + margin.left + margin.right).toString())
|
||||
.attr("height", (height + margin.top + margin.bottom).toString())
|
||||
.attr("transform", "translate(" + margin.left + "," + margin.top + ")")
|
||||
.on("mousemove", function(){
|
||||
// TODO implement pointHighlight
|
||||
});
|
||||
|
||||
|
||||
// Create x axis
|
||||
var xAxis = d3.svg.axis()
|
||||
.scale(scaleX)
|
||||
.innerTickSize(-height)
|
||||
.outerTickSize(5)
|
||||
.orient("bottom")
|
||||
.ticks(10, "m");
|
||||
|
||||
// Create y axis
|
||||
var yAxis = d3.svg.axis()
|
||||
.scale(scaleY)
|
||||
.innerTickSize(-width)
|
||||
.outerTickSize(5)
|
||||
.orient("left")
|
||||
.ticks(10, "m");
|
||||
|
||||
// Append axis to the chart
|
||||
svg.append("g")
|
||||
.attr("class", "x axis")
|
||||
.call(xAxis);
|
||||
|
||||
var gy = svg.append("g")
|
||||
.attr("class", "y axis")
|
||||
.call(yAxis);
|
||||
|
||||
//gy.selectAll("g").filter(function(d) { return d; })
|
||||
// .classed("minor", true);
|
||||
|
||||
if(navigator.userAgent.indexOf("Firefox") == -1 ) {
|
||||
svg.select(".y.axis").attr("transform", "translate("+ (margin.left).toString() + "," + margin.top.toString() + ")");
|
||||
svg.select(".x.axis").attr("transform", "translate(" + margin.left.toString() + "," + (height + margin.top).toString() + ")");
|
||||
} else {
|
||||
svg.select(".x.axis").attr("transform", "translate( 0 ," + height.toString() + ")");
|
||||
}
|
||||
|
||||
drawPoints(canvas, dd.points, scaleX, scaleY);
|
||||
|
||||
document.getElementById("profile_num_points").innerHTML = Potree.utils.addCommas(dd.request.pointsServed);
|
||||
|
||||
if(dd.request.pointsServed > 20*1000){
|
||||
dd.request.cancel();
|
||||
}
|
||||
},
|
||||
"onFinish": function(event){
|
||||
},
|
||||
"onCancel": function(){
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
this.domElement.addEventListener( 'click', onClick, false);
|
||||
this.domElement.addEventListener( 'dblclick', onDoubleClick, false);
|
||||
this.domElement.addEventListener( 'mousemove', onMouseMove, false );
|
||||
|
||||