24#ifndef OPENSWMMVIS_CURVE_CURVEPROVIDER_H
25#define OPENSWMMVIS_CURVE_CURVEPROVIDER_H
65 QString
name() const noexcept {
return m_name; }
81 int pointCount() const noexcept {
return m_points.size(); }
83 const QVector<CurvePoint>&
points() const noexcept {
return m_points; }
89 bool setAllPoints(QVector<CurvePoint> newPoints, QString *reasonOut =
nullptr);
93 bool setYAt(
int i,
double newY, QString *reasonOut =
nullptr);
97 bool setPointAt(
int i,
double newX,
double newY, QString *reasonOut =
nullptr);
101 int insertPoint(
double x,
double y, QString *reasonOut =
nullptr);
139 static bool isStrictlyMonotoneX_(
const QVector<CurvePoint> &
pts);
143 QVector<CurvePoint> m_points;
Definition curveprovider.h:56
void nameChanged(QString prev, QString now)
Curve was renamed; dependent-reference cascading is the registry's job.
CurveType type() const noexcept
Definition curveprovider.h:66
void pointsChanged(int firstIndex, int count)
Points in [firstIndex, firstIndex+count) had their (x,y) updated.
void pointsInserted(int at, int count)
count points were inserted starting at at.
~CurveProvider() override
int insertPoint(double x, double y, QString *reasonOut=nullptr)
Insert one point. Returns the new index on success; -1 if X collides or would break monotonicity.
Definition curveprovider.cpp:150
void typeChanged(CurveType prev, CurveType now)
Curve type changed (axis labels rebuild).
static QString typeLabel(CurveType t)
Human-readable type name ("Storage", "Pump 1: Volume → Flow", …).
Definition curveprovider.cpp:49
QString name() const noexcept
Definition curveprovider.h:65
const CurvePoint & pointAt(int i) const
Definition curveprovider.h:82
static QString yLabel(CurveType t)
Short axis label for the Y column for the given curve type.
Definition curveprovider.cpp:31
bool setAllPoints(QVector< CurvePoint > newPoints, QString *reasonOut=nullptr)
Replace the entire point list. Validates strict-monotone X before applying. Atomic.
Definition curveprovider.cpp:86
void mutationRejected(QString reason)
A mutator was refused because it would have violated an invariant.
void removePointsAt(QVector< int > indices)
Remove points by index. Indices are deduplicated + sorted descending internally so the loop is safe.
Definition curveprovider.cpp:168
int pointCount() const noexcept
Definition curveprovider.h:81
void setType(CurveType t)
Switch curve type. Does NOT touch points (X/Y still numeric); axis labels rebuild via signals.
Definition curveprovider.cpp:189
const QVector< CurvePoint > & points() const noexcept
Definition curveprovider.h:83
static QString xLabel(CurveType t)
Short axis label for the X column for the given curve type.
Definition curveprovider.cpp:13
void pointsRemoved(int at, int count)
count points were removed starting at at.
bool setYAt(int i, double newY, QString *reasonOut=nullptr)
Change the Y value at index i; X stays put so monotonicity is preserved by construction.
Definition curveprovider.cpp:106
bool setPointAt(int i, double newX, double newY, QString *reasonOut=nullptr)
Change both X + Y at index i. Validates that the new X still slots strictly between neighbours.
Definition curveprovider.cpp:120
void setName(QString newName)
Rename the curve. Uniqueness is the registry's responsibility; this just stores + notifies.
Definition curveprovider.cpp:181
size_t i
Definition contourjob.cpp:27
DiagramType t
Definition diagramspec.cpp:20
QVector< QPointF > pts
Definition meshpatch.cpp:62
Definition curveprovider.h:31
CurveType
Curve flavour. Numeric values match the engine's TableType (1..11) so static_cast<int>(type) is safe.
Definition curveprovider.h:35
@ Pump5
Depth → Flow (variable speed).
@ Pump2
Depth → Flow (on/off).
@ Pump4
Depth → Flow (continuous).
@ Shape
Depth → Width (custom cross-section).
@ Storage
Depth → Surface Area.
@ Diversion
Inflow → Diverted Flow.
@ Control
Variable → Setting.
@ Pump3
Head → Flow (continuous).
@ Rating
Head → Flow (outlets).
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
One (x, y) sample on a curve.
Definition curveprovider.h:50
double x
Definition curveprovider.h:51
double y
Definition curveprovider.h:52