Voronoi tree map - #20
Merged
Merged
Conversation
There was a problem hiding this comment.
Pull request overview
Adds a third visualization mode (“Voronoi Treemap”) to DiskSpace, backed by a new weighted Voronoi/power-diagram layout engine and accompanied by UI integration, performance/LOD controls, and expanded JFR instrumentation to diagnose navigation/render latency.
Changes:
- Introduce
VoronoiLayout(weighted Voronoi treemap layout) plus regression tests for convergence/area properties. - Add
VoronoiVisualizationwith LOD aggregation (“Smaller” cell), 2-level rendering, and drill animations; wire it intoDiskViewrender-mode cycling. - Expand JFR instrumentation:
siteCountreporting per visualization and a newNavigationduration event correlated toRenderevents vianavId.
Reviewed changes
Copilot reviewed 15 out of 15 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/test/java/se/hirt/diskspace/ui/VoronoiLayoutTest.java | Adds regression tests validating Voronoi layout convergence/area expectations on real-world-like data. |
| src/main/java/se/hirt/diskspace/ui/VoronoiLayout.java | New weighted Voronoi (power diagram) layout implementation with iterative balancing and polygon utilities. |
| src/main/java/se/hirt/diskspace/ui/render/VoronoiVisualization.java | New Voronoi visualization renderer with LOD caps, sub-cells, hit-test cache, and drill animations. |
| src/main/java/se/hirt/diskspace/ui/render/Visualization.java | Adds lastRenderSiteCount() API for reporting rendered/layout site count. |
| src/main/java/se/hirt/diskspace/ui/render/SunburstVisualization.java | Implements lastRenderSiteCount() for sunburst sectors. |
| src/main/java/se/hirt/diskspace/ui/render/HeatmapVisualization.java | Implements lastRenderSiteCount() for heatmap rectangles; formatting cleanups. |
| src/main/java/se/hirt/diskspace/ui/PickerView.java | Comment wrapping/format cleanup. |
| src/main/java/se/hirt/diskspace/ui/DiskView.java | Adds Voronoi render mode, wires visualization selection, and adds JFR Navigation + siteCount/navId fields. |
| src/main/java/se/hirt/diskspace/scan/MacBulkScanner.java | Comment wrapping/format cleanup. |
| src/main/java/se/hirt/diskspace/scan/Darwin.java | Comment wrapping/format cleanup. |
| src/main/java/se/hirt/diskspace/model/Volume.java | Comment wrapping/format cleanup. |
| README.md | Updates to reflect three visualization modes and V cycling behavior. |
| pom.xml | Adds a debug-logging Maven profile with JFR options for javafx:run. |
| docs/DOCUMENTATION.md | Documents Voronoi visualization and its LOD/system properties. |
| docs/DEVGUIDE.md | Documents the new Navigation JFR event and siteCount/navId correlation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+157
to
+170
| @Override | ||
| public void viewRootChanged(DirectoryNode previous, DirectoryNode current) { | ||
| if (previous == null || current == null || previous == current || cellHits.isEmpty()) { | ||
| lastViewRoot = null; | ||
| return; | ||
| } | ||
| animOldCells = List.copyOf(cellHits); | ||
| animNewCells = null; | ||
| animDrillNode = current; | ||
| animStartNanos = System.nanoTime(); | ||
| animating = true; | ||
| animTimer.start(); | ||
| lastViewRoot = null; | ||
| } |
Comment on lines
+606
to
+610
| List<TreemapItem> subItems = new ArrayList<>(children.size()); | ||
| for (DirectoryNode child : children) | ||
| subItems.add(new TreemapItem(child, Math.max(1L, child.totalBytes()), false, false)); | ||
| subItems = aggregateSmaller(subItems, SUB_CELL_MAX_SITES); | ||
|
|
Comment on lines
+336
to
+347
| private static List<Pt> cellAroundSite(List<WTriangle> tris, Site site) { | ||
| List<Pt> centers = new ArrayList<>(); | ||
| for (WTriangle t : tris) | ||
| if (t.has(site)) | ||
| centers.add(t.powerCenter); | ||
| if (centers.size() < 3) | ||
| return List.of(); | ||
| final double sx = site.x, sy = site.y; | ||
| centers.sort( | ||
| (p1, p2) -> Double.compare(Math.atan2(p1.y() - sy, p1.x() - sx), Math.atan2(p2.y() - sy, p2.x() - sx))); | ||
| return centers; | ||
| } |
Comment on lines
+2368
to
+2370
| // Snapshot the post-paint site count once and reuse across both events so they agree even if a | ||
| // later visualization mutation changes it. Voronoi reports its aggregate-capped count; sunburst | ||
| // and heatmap default to 0 (no LOD in play — fall back to nodeCount on the analysis side). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adding another visualization mode (a Voronoi tree map visualization).