fix measurements and profiles

This commit is contained in:
mschuetz 2016-12-14 11:12:34 +01:00
parent 16673c5947
commit f712456dbe
6 changed files with 24 additions and 28 deletions

View File

@ -43,17 +43,12 @@
<div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; "> <div class="potree_container" style="position: absolute; width: 100%; height: 100%; left: 0px; top: 0px; ">
<div id="potree_render_area"> <div id="potree_render_area">
<!--
<img class="potree_menu_toggle" src="../resources/icons/menu_button.svg" onclick="viewer.toggleSidebar()" />
<img id="potree_map_toggle" src="../resources/icons/map_icon.png" onclick="viewer.toggleMap()" style="display: none"/>
-->
<div id="potree_map" class="mapBox" style="position: absolute; left: 50px; top: 50px; width: 400px; height: 400px; display: none"> <div id="potree_map" class="mapBox" style="position: absolute; left: 50px; top: 50px; width: 400px; height: 400px; display: none">
<div id="potree_map_header" style="position: absolute; width: 100%; height: 25px; top: 0px; background-color: rgba(0,0,0,0.5); z-index: 1000; border-top-left-radius: 3px; border-top-right-radius: 3px;"> <div id="potree_map_header" style="position: absolute; width: 100%; height: 25px; top: 0px; background-color: rgba(0,0,0,0.5); z-index: 1000; border-top-left-radius: 3px; border-top-right-radius: 3px;">
</div> </div>
<div id="potree_map_content" class="map" style="position: absolute; z-index: 100; top: 25px; width: 100%; height: calc(100% - 25px); border: 2px solid rgba(0,0,0,0.5); box-sizing: border-box;"></div> <div id="potree_map_content" class="map" style="position: absolute; z-index: 100; top: 25px; width: 100%; height: calc(100% - 25px); border: 2px solid rgba(0,0,0,0.5); box-sizing: border-box;"></div>
</div> </div>
<!-- HEADING -->
<div id="potree_description" class="potree_info_text"></div> <div id="potree_description" class="potree_info_text"></div>
</div> </div>
@ -99,12 +94,6 @@
{ {
let measurement = new Potree.Measure(); let measurement = new Potree.Measure();
measurement.showDistances = true;
measurement.showArea = false;
measurement.showAngles = false;
measurement.closed = false;
measurement.showCoordinates = false;
measurement.maxMarkers = Number.MAX_SAFE_INTEGER;
measurement.addMarker(new THREE.Vector3(589938.8594970703, 231457.48974609375, 727.9749997901916)); measurement.addMarker(new THREE.Vector3(589938.8594970703, 231457.48974609375, 727.9749997901916));
measurement.addMarker(new THREE.Vector3(589877.9293823242, 231472.29974365234, 735.1949995803833)); measurement.addMarker(new THREE.Vector3(589877.9293823242, 231472.29974365234, 735.1949995803833));

View File

@ -7,7 +7,7 @@ Potree.Measure = class{
this.points = []; this.points = [];
this._showDistances = true; this._showDistances = true;
this._showCoordinates = false; this._showCoordinates = false;
this._showArea = true; this._showArea = false;
this._closed = true; this._closed = true;
this._showAngles = false; this._showAngles = false;
this.maxMarkers = Number.MAX_SAFE_INTEGER; this.maxMarkers = Number.MAX_SAFE_INTEGER;
@ -241,7 +241,9 @@ Potree.Measure = class{
let labelPos = position.clone().add(new THREE.Vector3(0,1,0)); let labelPos = position.clone().add(new THREE.Vector3(0,1,0));
coordinateLabel.position.copy(labelPos); coordinateLabel.position.copy(labelPos);
let msg = Potree.utils.addCommas(position.x.toFixed(2)) + " / " + Potree.utils.addCommas(position.y.toFixed(2)) + " / " + Potree.utils.addCommas(position.z.toFixed(2)); let msg = Potree.utils.addCommas(position.x.toFixed(2))
+ " / " + Potree.utils.addCommas(position.y.toFixed(2))
+ " / " + Potree.utils.addCommas(position.z.toFixed(2));
coordinateLabel.setText(msg); coordinateLabel.setText(msg);
//coordinateLabel.visible = this.showCoordinates && (index < lastIndex || this.closed); //coordinateLabel.visible = this.showCoordinates && (index < lastIndex || this.closed);
@ -329,7 +331,6 @@ Potree.Measure = class{
let msg = Potree.utils.addCommas(point.position.x.toFixed(2)) let msg = Potree.utils.addCommas(point.position.x.toFixed(2))
+ " / " + Potree.utils.addCommas(point.position.y.toFixed(2)) + " / " + Potree.utils.addCommas(point.position.y.toFixed(2))
+ " / " + Potree.utils.addCommas(point.position.z.toFixed(2)); + " / " + Potree.utils.addCommas(point.position.z.toFixed(2));
//let msg = "abc";
coordinateLabel.setText(msg); coordinateLabel.setText(msg);
coordinateLabel.visible = this.showCoordinates && (index < lastIndex || this.closed); coordinateLabel.visible = this.showCoordinates && (index < lastIndex || this.closed);

View File

@ -383,11 +383,11 @@ Potree.MeasuringTool = class{
let scale = (70 / pr); let scale = (70 / pr);
label.scale.set(scale, scale, scale); label.scale.set(scale, scale, scale);
let geoCoord = point.position; //let geoCoord = point.position;
let txt = Potree.utils.addCommas(geoCoord.x.toFixed(2)) + " / "; //let txt = Potree.utils.addCommas(geoCoord.x.toFixed(2)) + " / ";
txt += Potree.utils.addCommas((-geoCoord.z).toFixed(2)) + " / "; //txt += Potree.utils.addCommas((geoCoord.y).toFixed(2)) + " / ";
txt += Potree.utils.addCommas(geoCoord.y.toFixed(2)); //txt += Potree.utils.addCommas(geoCoord.z.toFixed(2));
label.setText(txt); //label.setText(txt);
} }
// areaLabel // areaLabel

View File

@ -45,8 +45,6 @@
</select> </select>
</li> </li>
<li><label class="menu-item"><input type="checkbox" onClick="viewer.setShowSkybox(this.checked)"/><span data-i18n="appearance.skybox"></span</label></li>
<div> <div>
<div class="divider"> <div class="divider">
<span>Eye-Dome-Lighting</span> <span>Eye-Dome-Lighting</span>

View File

@ -60,9 +60,7 @@ function initToolbar(){
Potree.resourcePath + "/icons/reset_tools.svg", Potree.resourcePath + "/icons/reset_tools.svg",
"[title]tt.remove_all_measurement", "[title]tt.remove_all_measurement",
function(){ function(){
viewer.measuringTool.reset(); viewer.scene.removeAllMeasurements();
viewer.profileTool.reset();
viewer.volumeTool.reset();
} }
)); ));
} }
@ -677,7 +675,7 @@ function initMeasurementDetails(){
elPanelIcon.src = Potree.resourcePath + "/icons/profile.svg"; elPanelIcon.src = Potree.resourcePath + "/icons/profile.svg";
elPanelStretch.innerHTML = "Profile"; elPanelStretch.innerHTML = "Profile";
elPanelRemove.onclick = function(){scene.removeProfile(profile);}; elPanelRemove.onclick = function(){scene.removeProfile(measurement);};
} else if(measurement instanceof Potree.Volume){ } else if(measurement instanceof Potree.Volume){
elPanelIcon.src = Potree.resourcePath + "/icons/volume.svg"; elPanelIcon.src = Potree.resourcePath + "/icons/volume.svg";
elPanelStretch.innerHTML = "Volume"; elPanelStretch.innerHTML = "Volume";
@ -942,7 +940,7 @@ function initMeasurementDetails(){
}; };
} else if(measurement instanceof Potree.Profile){ } else if(measurement instanceof Potree.Profile){
let onremove = function(event){ let onremove = function(event){
if(event.measurement === measurement){ if(event.profile === measurement){
scene.dispatcher.removeEventListener("marker_added", updateDisplay); scene.dispatcher.removeEventListener("marker_added", updateDisplay);
scene.dispatcher.removeEventListener("marker_removed", updateDisplay); scene.dispatcher.removeEventListener("marker_removed", updateDisplay);
scene.dispatcher.removeEventListener("marker_moved", updateDisplay); scene.dispatcher.removeEventListener("marker_moved", updateDisplay);

View File

@ -79,9 +79,9 @@ Potree.Scene = class{
} }
removeProfile(profile){ removeProfile(profile){
let index = this.profile.indexOf(profile); let index = this.profiles.indexOf(profile);
if (index > -1) { if (index > -1) {
this.profile.splice(index, 1); this.profiles.splice(index, 1);
this.dispatcher.dispatchEvent({ this.dispatcher.dispatchEvent({
"type": "profile_removed", "type": "profile_removed",
"scene": this, "scene": this,
@ -90,6 +90,16 @@ Potree.Scene = class{
} }
} }
removeAllMeasurements(){
while(this.measurements.length > 0){
this.removeMeasurement(this.measurements[0]);
}
while(this.profiles.length > 0){
this.removeProfile(this.profiles[0]);
}
}
initialize(){ initialize(){
this.referenceFrame = new THREE.Object3D(); this.referenceFrame = new THREE.Object3D();