Skip to content

Commit

Permalink
fix(#40): make accepted filtering work with multiple clouds
Browse files Browse the repository at this point in the history
  • Loading branch information
AdrianSolberg committed Oct 25, 2025
1 parent e6a5081 commit a986ba5
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/potreeViewer.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,14 @@ export async function createPotreeViewer(
$('#menu_filters').next().show()
viewer.toggleSidebar()

// Helper function to update all point clouds for Accepted filtering
function updateAllCloudsAccepted(gradientName) {
pointclouds.forEach(pc => {
pc.material.activeAttributeName = 'Accepted'
pc.material.gradient = Potree.Gradients[gradientName]
})
}

initThreePanels(viewer, {
onActivateElevation: () => {
if (!pc) return
Expand All @@ -51,9 +59,7 @@ export async function createPotreeViewer(
suppressSidebarAutoScroll(clickCloudIconOnce)
},
onActivateAccepted: () => {
if (!pc) return
pc.material.activeAttributeName = 'accepted'
pc.material.gradient = Potree.Gradients['GRAYSCALE']
updateAllCloudsAccepted('GRAYSCALE')
toggleAcceptedLegend(true)
suppressSidebarAutoScroll(clickCloudIconOnce)
}
Expand All @@ -70,6 +76,7 @@ export async function createPotreeViewer(
initAnnotationsPanel(viewer)
})

const pointclouds = []
for (const url of pointcloudUrls) {
const e = await Potree.loadPointCloud(url)
const pc = e.pointcloud
Expand All @@ -85,6 +92,8 @@ export async function createPotreeViewer(
pc.material.gradient = Potree.Gradients['VIRIDIS']

e.pointcloud.projection = ecef

pointclouds.push(pc)
}

// Change name of default background from 'None' to 'Globe"'
Expand Down

0 comments on commit a986ba5

Please sign in to comment.