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
storageshapegeom.h
Go to the documentation of this file.
1
21#ifndef STORAGESHAPEGEOM_H
22#define STORAGESHAPEGEOM_H
23
24#include <QCoreApplication>
25#include <QString>
26
27namespace openswmmvis {
28
33 const char *name;
35 const char *param1Label;
36 const char *param2Label;
37 const char *param3Label;
38};
39
41inline constexpr int kStorageTabularId = 0;
42inline constexpr int kStorageFunctionalId = 1;
43inline constexpr int kStorageCylindricalId = 2;
44inline constexpr int kStorageConicalId = 3;
45inline constexpr int kStorageParaboloidId = 4;
46inline constexpr int kStoragePyramidalId = 5;
47
53inline constexpr StorageShapeRow kStorageShapes[] = {
54 { "TABULAR", kStorageTabularId, "", "", "" },
55 { "FUNCTIONAL", kStorageFunctionalId, "", "", "" },
56 { "CYLINDRICAL", kStorageCylindricalId, "Major Axis Length", "Minor Axis Width", "" },
57 { "CONICAL", kStorageConicalId, "Major Axis Length", "Minor Axis Width", "Side Slope (run/rise)" },
58 { "PARABOLIC", kStorageParaboloidId, "Top Major Axis", "Top Minor Axis", "Height at Top Axes" },
59 { "PYRAMIDAL", kStoragePyramidalId, "Base Length", "Base Width", "Side Slope (run/rise)" },
60};
61
64inline const StorageShapeRow *findStorageShapeRow(int engineId)
65{
66 for (const auto &r : kStorageShapes) {
67 if (r.engineId == engineId) return &r;
68 }
70}
71
74inline bool storageShapeIsGeometric(int shapeId)
75{
76 return shapeId == kStorageCylindricalId || shapeId == kStorageConicalId
77 || shapeId == kStorageParaboloidId || shapeId == kStoragePyramidalId;
78}
79
82inline QString storageGeomLabel(int shapeId, int ordinal)
83{
84 const StorageShapeRow *r = findStorageShapeRow(shapeId);
85 const char *lbl = nullptr;
86 switch (ordinal) {
87 case 1: lbl = r->param1Label; break;
88 case 2: lbl = r->param2Label; break;
89 case 3: lbl = r->param3Label; break;
90 default: return {};
91 }
92 return (lbl && *lbl)
93 ? QCoreApplication::translate("StorageShape", lbl)
94 : QString();
95}
96
99inline bool storageGeomApplies(int shapeId, int ordinal)
100{
101 return !storageGeomLabel(shapeId, ordinal).isEmpty();
102}
103
104} // namespace openswmmvis
105
106#endif // STORAGESHAPEGEOM_H
Definition aquiferprovider.h:21
constexpr int kStorageFunctionalId
Definition storageshapegeom.h:42
constexpr int kStoragePyramidalId
Definition storageshapegeom.h:46
constexpr int kStorageParaboloidId
Definition storageshapegeom.h:45
const StorageShapeRow * findStorageShapeRow(int engineId)
Definition storageshapegeom.h:64
bool storageShapeIsGeometric(int shapeId)
Definition storageshapegeom.h:74
constexpr int kStorageCylindricalId
Definition storageshapegeom.h:43
bool storageGeomApplies(int shapeId, int ordinal)
Definition storageshapegeom.h:99
constexpr int kStorageTabularId
Engine ids, spelled out so call sites don't hard-code magic numbers.
Definition storageshapegeom.h:41
constexpr StorageShapeRow kStorageShapes[]
Definition storageshapegeom.h:53
QString storageGeomLabel(int shapeId, int ordinal)
Definition storageshapegeom.h:82
constexpr int kStorageConicalId
Definition storageshapegeom.h:44
Definition storageshapegeom.h:32
const char * name
"PYRAMIDAL", … (engine keyword; PARABOLOID is "PARABOLIC").
Definition storageshapegeom.h:33
const char * param2Label
Definition storageshapegeom.h:36
int engineId
SWMM_StorageShape numeric.
Definition storageshapegeom.h:34
const char * param3Label
Definition storageshapegeom.h:37
const char * param1Label
"" when unused.
Definition storageshapegeom.h:35