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
transectprovider.h
Go to the documentation of this file.
1
25#ifndef OPENSWMMVIS_TRANSECT_TRANSECTPROVIDER_H
26#define OPENSWMMVIS_TRANSECT_TRANSECTPROVIDER_H
27
28#include <QObject>
29#include <QPair>
30#include <QString>
31#include <QVector>
32
34
37 double station = 0.0;
38 double elevation = 0.0;
39};
40
41class TransectProvider : public QObject
42{
43 Q_OBJECT
44
45public:
46 explicit TransectProvider(QString name, QObject *parent = nullptr);
48
49 // ── Identity ────────────────────────────────────────────────────────────
50
51 QString name() const noexcept { return m_name; }
52 QString comments() const noexcept { return m_comments; }
53
54 // ── Roughness (Manning's n triple) ──────────────────────────────────────
55
56 double nLeftBank() const noexcept { return m_nLeft; }
57 double nRightBank() const noexcept { return m_nRight; }
58 double nChannel() const noexcept { return m_nChannel; }
59
60 // ── Bank stations (split overbank ↔ channel) ────────────────────────────
61
62 double xLeftBank() const noexcept { return m_xLeftBank; }
63 double xRightBank() const noexcept { return m_xRightBank; }
64
65 // ── Encroachment stations (BQ-TR-02 Reading B) ──────────────────────────
66
67 double xLeftEncroachment() const noexcept { return m_xLeftEncroach; }
68 double xRightEncroachment() const noexcept { return m_xRightEncroach; }
69
70 // ── Modifiers (X1 record cols 8-9 + lengthFactor) ───────────────────────
71
72 double stationMultiplier() const noexcept { return m_xFactor; }
73 double elevationOffset() const noexcept { return m_yFactor; }
74 double meanderFactor() const noexcept { return m_lengthFactor; }
75
76 // ── Station-elevation points ────────────────────────────────────────────
77
78 int pointCount() const noexcept { return m_points.size(); }
79 const TransectPoint& pointAt(int i) const { return m_points.at(i); }
80 const QVector<TransectPoint>& points() const noexcept { return m_points; }
81 QVector<QPair<double,double>> allPoints() const;
82
83 // ── Mutators (return false + emit mutationRejected on invariant violation) ──
84
85 void setName(QString newName);
86 void setComments(QString newComments);
87
88 void setRoughness(double nLeft, double nRight, double nChannel);
89 void setBankStations(double xLeft, double xRight);
90 void setEncroachmentStations(double xLeft, double xRight);
91 void setModifiers(double xFactor, double yFactor, double lengthFactor);
92
95 bool setAllPoints(QVector<TransectPoint> newPoints, QString *reasonOut = nullptr);
96
98 bool setElevationAt(int i, double newElev, QString *reasonOut = nullptr);
99
102 bool setPointAt(int i, double newStation, double newElev,
103 QString *reasonOut = nullptr);
104
108 bool setPointLive(int i, double newStation, double newElev,
109 bool *clamped = nullptr);
110
113 int insertPoint(double station, double elev, QString *reasonOut = nullptr);
114
117 void removePointsAt(QVector<int> indices);
118
119signals:
120 void nameChanged(QString prev, QString now);
126
127 void pointsChanged(int firstIndex, int count);
128 void pointsInserted(int at, int count);
129 void pointsRemoved(int at, int count);
130
131 void mutationRejected(QString reason);
132
133private:
135 static bool isStrictlyMonotone_(const QVector<TransectPoint> &pts);
136
137 QString m_name;
138 QString m_comments;
139
140 double m_nLeft = 0.030;
141 double m_nRight = 0.030;
142 double m_nChannel = 0.030;
143
144 double m_xLeftBank = 0.0;
145 double m_xRightBank = 0.0;
146
147 double m_xLeftEncroach = 0.0;
148 double m_xRightEncroach = 0.0;
149
150 double m_xFactor = 1.0;
151 double m_yFactor = 0.0;
152 double m_lengthFactor = 1.0;
153
154 QVector<TransectPoint> m_points;
155};
156
157} // namespace openswmmvis::transect
158
159Q_DECLARE_METATYPE(openswmmvis::transect::TransectPoint)
160
161#endif // OPENSWMMVIS_TRANSECT_TRANSECTPROVIDER_H
Definition transectprovider.h:42
double nRightBank() const noexcept
Definition transectprovider.h:57
QString comments() const noexcept
Definition transectprovider.h:52
bool setAllPoints(QVector< TransectPoint > newPoints, QString *reasonOut=nullptr)
Replace the entire station list. Validates strict-monotone stations before applying....
Definition transectprovider.cpp:100
void nameChanged(QString prev, QString now)
const TransectPoint & pointAt(int i) const
Definition transectprovider.h:79
void removePointsAt(QVector< int > indices)
Remove points by index. Indices are deduplicated + sorted descending internally so the loop is safe.
Definition transectprovider.cpp:201
int pointCount() const noexcept
Definition transectprovider.h:78
double elevationOffset() const noexcept
Definition transectprovider.h:73
double nLeftBank() const noexcept
Definition transectprovider.h:56
double xRightEncroachment() const noexcept
Definition transectprovider.h:68
bool setPointAt(int i, double newStation, double newElev, QString *reasonOut=nullptr)
Edit both station and elevation at index i. Validates that the new station still slots strictly betwe...
Definition transectprovider.cpp:133
void setBankStations(double xLeft, double xRight)
Definition transectprovider.cpp:72
void setModifiers(double xFactor, double yFactor, double lengthFactor)
Definition transectprovider.cpp:88
double meanderFactor() const noexcept
Definition transectprovider.h:74
bool setPointLive(int i, double newStation, double newElev, bool *clamped=nullptr)
Live drag variant: skips strict monotonicity by clamping the new station to lie in (prev + eps,...
Definition transectprovider.cpp:163
const QVector< TransectPoint > & points() const noexcept
Definition transectprovider.h:80
void setRoughness(double nLeft, double nRight, double nChannel)
Definition transectprovider.cpp:63
void pointsInserted(int at, int count)
void setName(QString newName)
Definition transectprovider.cpp:46
bool setElevationAt(int i, double newElev, QString *reasonOut=nullptr)
Edit elevation at index i; station stays put.
Definition transectprovider.cpp:119
void pointsRemoved(int at, int count)
void setComments(QString newComments)
Definition transectprovider.cpp:54
double stationMultiplier() const noexcept
Definition transectprovider.h:72
QString name() const noexcept
Definition transectprovider.h:51
void pointsChanged(int firstIndex, int count)
int insertPoint(double station, double elev, QString *reasonOut=nullptr)
Insert one point. Returns the new index on success, -1 on collision / out-of-order.
Definition transectprovider.cpp:184
QVector< QPair< double, double > > allPoints() const
Definition transectprovider.cpp:35
double xLeftEncroachment() const noexcept
Definition transectprovider.h:67
void setEncroachmentStations(double xLeft, double xRight)
Definition transectprovider.cpp:80
double xLeftBank() const noexcept
Definition transectprovider.h:62
double nChannel() const noexcept
Definition transectprovider.h:58
double xRightBank() const noexcept
Definition transectprovider.h:63
size_t i
Definition contourjob.cpp:27
QVector< QPointF > pts
Definition meshpatch.cpp:62
Definition transectprovider.h:33
int count
Definition numberformat.cpp:101
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
One (station, elevation) sample on a transect cross-section.
Definition transectprovider.h:36
double station
Definition transectprovider.h:37
double elevation
Definition transectprovider.h:38