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
xsectsampler.h
Go to the documentation of this file.
1
24#ifndef OPENSWMMVIS_SECTIONVIEW_XSECTSAMPLER_H
25#define OPENSWMMVIS_SECTIONVIEW_XSECTSAMPLER_H
26
27#include <QPolygonF>
28#include <QVector>
29
30#include <openswmm/engine/openswmm_engine.h>
31#include <openswmm/engine/openswmm_links.h>
32
34
37{
38 double yFull = 0.0;
39 double aFull = 0.0;
40 double rFull = 0.0;
41 double wMax = 0.0;
42 double sFull = 0.0;
43 double aMax = 0.0;
44 bool open = false;
45};
46
57{
58public:
59 XsectSampler() = default;
61
62 XsectSampler(XsectSampler &&other) noexcept;
63 XsectSampler &operator=(XsectSampler &&other) noexcept;
64 XsectSampler(const XsectSampler &) = delete;
66
67 // ---- Construction ------------------------------------------------------
68
72 [[nodiscard]] static XsectSampler fromShape(int shape, double geom1,
73 double geom2, double geom3,
74 double geom4, bool si);
75
85 [[nodiscard]] static XsectSampler fromLink(SWMM_Engine engine, int linkIdx);
86
90 [[nodiscard]] static XsectSampler fromTransect(
91 const QVector<double> &stations, const QVector<double> &elevations,
92 double xLeftBank, double xRightBank,
93 double nLeft, double nChannel, double nRight,
94 double lengthFactor, bool si);
95
97 [[nodiscard]] static XsectSampler fromStreet(
98 double width, double curbHeight, double slope, double roughness,
99 double gutterDepression, double gutterWidth, int sides,
100 double backWidth, double backSlope, double backRoughness, bool si);
101
104 [[nodiscard]] static XsectSampler fromCurve(
105 double yFull, const QVector<double> &normDepths,
106 const QVector<double> &normWidths, bool si);
107
108 // ---- Queries -----------------------------------------------------------
109
110 [[nodiscard]] bool isValid() const noexcept { return m_handle != nullptr; }
111
113 [[nodiscard]] int shape() const;
114
116 [[nodiscard]] XsectFullProps fullProps() const;
117
119 [[nodiscard]] QVector<double> widthsAtDepths(const QVector<double> &depths) const;
120
140 [[nodiscard]] QPolygonF outline(int samples = 240) const;
141
142private:
143 explicit XsectSampler(void *handle) noexcept : m_handle(handle) {}
144 void reset() noexcept;
145
146 void *m_handle = nullptr;
147};
148
149// ---- Link geometry resolution (shared by the Section View and the profile
150// plot, so both surfaces read one implementation) ----------------------
151
161 int streetIdx, bool si);
162
174[[nodiscard]] XsectSampler samplerForLink(SWMM_Engine engine, int linkIdx,
175 int shape, double g1, double g2,
176 double g3, double g4, bool si);
177
195[[nodiscard]] double linkFullDepth(SWMM_Engine engine, int linkIdx, int shape,
196 double g1, double g2, double g3, double g4,
197 bool si, bool *outOpenTop = nullptr);
198
199} // namespace openswmmvis::sectionview
200
201#endif // OPENSWMMVIS_SECTIONVIEW_XSECTSAMPLER_H
Owning handle on one standalone SWMM cross-section.
Definition xsectsampler.h:57
XsectSampler & operator=(XsectSampler &&other) noexcept
Definition xsectsampler.cpp:41
QPolygonF outline(int samples=240) const
Closed outline polygon of the section, in section coordinates.
Definition xsectsampler.cpp:176
int shape() const
Definition xsectsampler.cpp:138
QVector< double > widthsAtDepths(const QVector< double > &depths) const
Definition xsectsampler.cpp:161
XsectSampler(const XsectSampler &)=delete
XsectFullProps fullProps() const
Definition xsectsampler.cpp:146
static XsectSampler fromLink(SWMM_Engine engine, int linkIdx)
Definition xsectsampler.cpp:72
XsectSampler & operator=(const XsectSampler &)=delete
static XsectSampler fromStreet(double width, double curbHeight, double slope, double roughness, double gutterDepression, double gutterWidth, int sides, double backWidth, double backSlope, double backRoughness, bool si)
Definition xsectsampler.cpp:103
static XsectSampler fromCurve(double yFull, const QVector< double > &normDepths, const QVector< double > &normWidths, bool si)
Definition xsectsampler.cpp:119
static XsectSampler fromShape(int shape, double geom1, double geom2, double geom3, double geom4, bool si)
Definition xsectsampler.cpp:62
static XsectSampler fromTransect(const QVector< double > &stations, const QVector< double > &elevations, double xLeftBank, double xRightBank, double nLeft, double nChannel, double nRight, double lengthFactor, bool si)
Definition xsectsampler.cpp:84
bool isValid() const noexcept
Definition xsectsampler.h:110
~XsectSampler()
Definition xsectsampler.cpp:31
Definition aquifereditordialog.h:41
XsectSampler samplerFromStreetIndex(SWMM_Engine engine, int streetIdx, bool si)
Sampler for the street at streetIdx, built from [STREETS].
Definition xsectsampler.cpp:228
XsectSampler samplerForLink(SWMM_Engine engine, int linkIdx, int shape, double g1, double g2, double g3, double g4, bool si)
Sampler for a link's cross-section, given the values swmm_link_get_xsect reported for it.
Definition xsectsampler.cpp:248
double linkFullDepth(SWMM_Engine engine, int linkIdx, int shape, double g1, double g2, double g3, double g4, bool si, bool *outOpenTop=nullptr)
A link's true full depth (crown height above the invert).
Definition xsectsampler.cpp:267
void * SWMM_Engine
Definition objectdefaultsapplier.h:19
Definition xsectsampler.h:37
double sFull
Section factor when full.
Definition xsectsampler.h:42
double aMax
Area of maximum flow.
Definition xsectsampler.h:43
double aFull
Area when full.
Definition xsectsampler.h:39
double yFull
Full depth.
Definition xsectsampler.h:38
double rFull
Hydraulic radius when full.
Definition xsectsampler.h:40
bool open
True for an open channel.
Definition xsectsampler.h:44
double wMax
Width at the widest point.
Definition xsectsampler.h:41