// 1: define html of toolbar first
// 2: then populate with content and actions
//
// Following files can be used as references on how to add certain functionality to the toolbar:
// - sidebar.html
// - sidebar.js
// - PropertiesPanel.html and its dependencies (DistancePanel, ProfilePanel, ...)
//
// HTML
const elToolbar = $("#potree_toolbar");
elToolbar.html(`
Measure
Material
`);
// CONTENT & ACTIONS
{ // MEASURE
elToolbar.find("img[name=action_measure_point]").click( () => {
const measurement = viewer.measuringTool.startInsertion({
showDistances: false,
showAngles: false,
showCoordinates: true,
showArea: false,
closed: true,
maxMarkers: 1,
name: 'Point'
});
});
elToolbar.find("img[name=action_measure_distance]").click( () => {
const measurement = viewer.measuringTool.startInsertion({
showDistances: true,
showArea: false,
closed: false,
name: 'Distance'
});
});
elToolbar.find("img[name=action_measure_height]").click( () => {
const measurement = viewer.measuringTool.startInsertion({
showDistances: false,
showHeight: true,
showArea: false,
closed: false,
maxMarkers: 2,
name: 'Height'
});
});
elToolbar.find("img[name=action_reset_tools]").click( () => {
const measurement = this.viewer.scene.removeAllMeasurements();
});
}
{ // MATERIAL
let options = [
"rgba",
"elevation",
"intensity",
"color",
//"indices",
// "intensity",
// "classification",
// "source id",
];
let attributeSelection = elToolbar.find('#optMaterial');
for(let option of options){
let elOption = $(``);
attributeSelection.append(elOption);
}
const updateMaterialSelection = (event, ui) => {
let selectedValue = attributeSelection.selectmenu().val();
for(const pointcloud of viewer.scene.pointclouds){
pointcloud.material.activeAttributeName = selectedValue;
}
};
attributeSelection.selectmenu({change: updateMaterialSelection});
}
// Check if the page is in an iframe
if (window != window.top) {
// If yes, attach an event listener for clicks
document.getElementById('fullscreen').addEventListener('click', (event) => {
// Redirect the parent page (from within an iframe)
window.top.location.href = 'https://pointcloud.ucsd.edu/OH3D/0bab-t430.html';
});
}