SWMMVis  6.0.0-alpha.4
Qt6/C++ GIS-based graphical user interface for the SWMMVis engine (6.0.0-alpha.4)
Loading...
Searching...
No Matches
qsg2dlodpolicy.h
Go to the documentation of this file.
1
32#ifndef OPENSWMM_RENDER_QSG2DLODPOLICY_H
33#define OPENSWMM_RENDER_QSG2DLODPOLICY_H
34
35#include <QtGlobal>
36
37#include <limits>
38
39namespace OpenSWMM::Render
40{
41
43{
44 // ── View ────────────────────────────────────────────────────────────
45 double viewportWidthPx = 0.0;
46 double viewportHeightPx = 0.0;
47 double extentWidth = 0.0;
48 double extentHeight = 0.0;
49
50 // ── Mesh density ────────────────────────────────────────────────────
51 qint64 cellCount = 0;
52 double meshBBoxArea = 0.0;
56 double visibleFraction = 1.0;
57
58 // ── Sublayer intents (user-facing visibility toggles) ───────────────
59 bool wantFill = true;
60 bool wantEdges = false;
61 bool wantVertexMarkers = false;
62 bool wantContours = false;
63 bool wantContourLabels = false;
64 bool wantVelocity = false;
65 bool haveSelection = false;
66
67 // ── Hysteresis anchors (previous decision; defaults = none) ─────────
69 int previousZoomStep = std::numeric_limits<int>::min();
70
76 double farMaxCellAreaPx = 8.0; // = Qsg2DLodPolicy::kFarMaxCellAreaPx
77
84 double edgeMinCellAreaPx = 32.0; // = Qsg2DLodPolicy::kEdgeMinCellAreaPx
85 double markerMinCellAreaPx = 200.0; // = Qsg2DLodPolicy::kMarkerMinCellAreaPx
86};
87
89{
90 enum Bucket { Far = 0, Mid = 1, Near = 2 };
91
93 int zoomStep = 0;
94 double avgCellAreaPx = 0.0;
95
96 // Per-pass verdicts — already combined with the user intents, i.e.
97 // false either because the user turned the pass off or because the
98 // bucket suppresses it.
99 bool drawFill = true;
100 bool drawEdges = false;
101 bool drawVertexMarkers = false;
102 bool drawContours = false;
103 bool drawContourLabels = false;
105 bool drawSelectedOverlays = false;
106
109 bool useAggregateFill = false;
110
114 bool exactContourBands = false;
115
121
124 [[nodiscard]] quint64 contentKey() const
125 {
126 return (quint64(quint32(zoomStep)) << 2) | quint64(bucket);
127 }
128};
129
131{
132public:
133 // Bucket thresholds on the mean projected cell area (px²). A cell
134 // whose area is below kFarMaxCellAreaPx spans < ~3 px — subpixel-ish,
135 // wireframe/markers are pure noise. Above kNearMinCellAreaPx a cell
136 // spans ≥ ~13 px and exact detail reads clearly.
137 static constexpr double kFarMaxCellAreaPx = 8.0;
138 static constexpr double kNearMinCellAreaPx = 160.0;
141 static constexpr double kEdgeMinCellAreaPx = 32.0;
143 static constexpr double kMarkerMinCellAreaPx = 200.0;
145 static constexpr double kBucketHysteresis = 0.25;
147 static constexpr double kZoomStepHysteresis = 0.08;
150 static constexpr qint64 kDenseVelocityCellCap = 20000;
151 static constexpr int kMidMaxContourLabels = 40;
152 static constexpr int kNearMaxContourLabels = 400;
153
154 [[nodiscard]] static Qsg2DLodDecision decide(const Qsg2DLodInputs &in);
155};
156
157} // namespace OpenSWMM::Render
158
159#endif // OPENSWMM_RENDER_QSG2DLODPOLICY_H
Definition qsg2dlodpolicy.h:131
static constexpr double kNearMinCellAreaPx
Definition qsg2dlodpolicy.h:138
static constexpr double kMarkerMinCellAreaPx
Definition qsg2dlodpolicy.h:143
static constexpr double kBucketHysteresis
Definition qsg2dlodpolicy.h:145
static constexpr int kMidMaxContourLabels
Definition qsg2dlodpolicy.h:151
static constexpr double kZoomStepHysteresis
Definition qsg2dlodpolicy.h:147
static constexpr qint64 kDenseVelocityCellCap
Definition qsg2dlodpolicy.h:150
static constexpr int kNearMaxContourLabels
Definition qsg2dlodpolicy.h:152
static constexpr double kEdgeMinCellAreaPx
Definition qsg2dlodpolicy.h:141
static Qsg2DLodDecision decide(const Qsg2DLodInputs &in)
Definition qsg2dlodpolicy.cpp:74
static constexpr double kFarMaxCellAreaPx
Definition qsg2dlodpolicy.h:137
Definition gisrasterlayer.h:40
Definition qsg2dlodpolicy.h:89
bool useAggregateFill
Definition qsg2dlodpolicy.h:109
bool drawVelocityVectors
Definition qsg2dlodpolicy.h:104
qint64 maxVelocityGlyphs
Definition qsg2dlodpolicy.h:119
quint64 contentKey() const
Definition qsg2dlodpolicy.h:124
bool drawFill
Definition qsg2dlodpolicy.h:99
bool drawVertexMarkers
Definition qsg2dlodpolicy.h:101
bool drawEdges
Definition qsg2dlodpolicy.h:100
bool drawContourLabels
Definition qsg2dlodpolicy.h:103
double avgCellAreaPx
diagnostic: mean projected cell area
Definition qsg2dlodpolicy.h:94
Bucket bucket
Definition qsg2dlodpolicy.h:92
bool denseVelocityAllowed
Definition qsg2dlodpolicy.h:118
bool exactContourBands
Definition qsg2dlodpolicy.h:114
int zoomStep
quantised log2(px per map unit)
Definition qsg2dlodpolicy.h:93
Bucket
Definition qsg2dlodpolicy.h:90
@ Mid
Definition qsg2dlodpolicy.h:90
@ Far
Definition qsg2dlodpolicy.h:90
@ Near
Definition qsg2dlodpolicy.h:90
bool drawContours
isolines
Definition qsg2dlodpolicy.h:102
bool drawSelectedOverlays
true whenever a selection exists
Definition qsg2dlodpolicy.h:105
int maxContourLabels
Definition qsg2dlodpolicy.h:120
Definition qsg2dlodpolicy.h:43
double farMaxCellAreaPx
Definition qsg2dlodpolicy.h:76
double meshBBoxArea
scene-space area of the mesh bbox
Definition qsg2dlodpolicy.h:52
double extentWidth
map units
Definition qsg2dlodpolicy.h:47
bool wantVertexMarkers
Definition qsg2dlodpolicy.h:61
double extentHeight
Definition qsg2dlodpolicy.h:48
double markerMinCellAreaPx
Definition qsg2dlodpolicy.h:85
double visibleFraction
Definition qsg2dlodpolicy.h:56
bool haveSelection
Definition qsg2dlodpolicy.h:65
qint64 cellCount
total mesh cells
Definition qsg2dlodpolicy.h:51
bool wantContours
Definition qsg2dlodpolicy.h:62
bool wantVelocity
Definition qsg2dlodpolicy.h:64
double edgeMinCellAreaPx
Definition qsg2dlodpolicy.h:84
bool wantContourLabels
Definition qsg2dlodpolicy.h:63
double viewportWidthPx
logical px
Definition qsg2dlodpolicy.h:45
bool wantFill
Definition qsg2dlodpolicy.h:59
int previousZoomStep
Definition qsg2dlodpolicy.h:69
double viewportHeightPx
Definition qsg2dlodpolicy.h:46
int previousBucket
Definition qsg2dlodpolicy.h:68
bool wantEdges
Definition qsg2dlodpolicy.h:60