11#ifndef SWMMMODELLAYER_H
12#define SWMMMODELLAYER_H
34#include <openswmm/engine/openswmm_callbacks.h>
35#include <openswmm/engine/openswmm_infrastructure.h>
50class IFeatureRenderer;
51class GraduatedRenderer;
225 [[nodiscard]] QVector<QPair<QString, QString>>
extendedMetadata() const override;
238 [[nodiscard]]
bool crsAssigned() const noexcept {
return m_crsAssigned; }
244 bool loadModel(QList<QString> &warnings, QList<QString> &errors);
258 QString *errorDetail,
259 qint64 *openMs =
nullptr);
276 qint64 *soaMsOut =
nullptr, qint64 *geomMsOut =
nullptr);
286 QList<QString> &warnings, QList<QString> &errors,
287 qint64 openMs = -1, qint64 soaMs = 0, qint64 geomMs = 0);
313 QString *errorDetail);
322 QList<QString> &warnings, QList<QString> &errors);
379 Q_DECLARE_FLAGS(QsgKinds,
QsgKind)
389 {
return m_qsgKinds.testFlag(
k); }
396 {
return m_qsgKinds !=
QsgNone; }
437 [[nodiscard]] QSet<QString>
hiddenObjects()
const {
return m_hiddenObjects; }
582 const QVariantMap &options,
583 QString *outError =
nullptr);
752 [[nodiscard]] std::vector<std::unique_ptr<openswmmvis::ui::ILayerStyleSubject>>
795 void setRenderer(std::unique_ptr<OpenSWMM::Render::IFeatureRenderer> r)
override;
818 std::unique_ptr<OpenSWMM::Render::IFeatureRenderer> r);
838 [[nodiscard]] QList<OpenSWMM::Render::LegendSymbolItem>
legendSymbolItems()
const;
840 [[nodiscard]] QColor
colorForClass(
const QString &classKey)
const;
842 [[nodiscard]] qreal
sizeForClass(
const QString &classKey)
const;
869 [[nodiscard]] QVector<OpenSWMM::Render::AttributeField>
904 [[nodiscard]]
double linkFlow(
int linkIdx)
const;
1012 {
return m_selectedElements; }
1040 [[nodiscard]] QVariantMap
identifyAt(
double mapX,
double mapY,
1042 double tolerance = 1
e-6)
const;
1047 [[nodiscard]] QVariantMap
identifyAt(
double mapX,
double mapY,
1048 double tolerance = 1
e-6)
const;
1091 [[nodiscard]] QStringList
nodesInRect(
double canvasMinX,
double canvasMinY,
1092 double canvasMaxX,
double canvasMaxY)
const;
1114 [[nodiscard]]
bool snapNearestPoint(
double mapX,
double mapY,
double mapRadius,
1116 std::optional<QPointF> excludePos = std::nullopt)
const;
1122 [[nodiscard]] QStringList
gagesInRect(
double canvasMinX,
double canvasMinY,
1123 double canvasMaxX,
double canvasMaxY)
const;
1136 [[nodiscard]] QStringList
linksInRect(
double canvasMinX,
double canvasMinY,
1137 double canvasMaxX,
double canvasMaxY)
const;
1145 double canvasMaxX,
double canvasMaxY)
const;
1155 [[nodiscard]] QStringList
nodesInPolygon(
const QPolygonF &canvasPoly)
const;
1156 [[nodiscard]] QStringList
gagesInPolygon(
const QPolygonF &canvasPoly)
const;
1157 [[nodiscard]] QStringList
linksInPolygon(
const QPolygonF &canvasPoly)
const;
1195 double &lx,
double &ly)
const;
1220 double &
cx,
double &
cy)
const;
1287 {
return int(m_linkVertexCount.size()); }
1299 return idx >= 0 && size_t(idx) < m_linkHiddenFlag.size()
1300 && m_linkHiddenFlag[size_t(idx)] != 0;
1339 [[nodiscard]]
bool cachedGageCoord(
int idx,
double *x,
double *y)
const;
1361 const QString &fallback = {})
const;
1371 bool setOption(
const QByteArray &
key,
const QString &value);
1378 int setOptions(
const QMap<QByteArray, QString> &values);
1401 const QVector<QPointF> &vertices)
const;
1408 [[nodiscard]]
bool isConduit(
int linkIdx)
const;
1440 double tolerance)
const;
1468 [[nodiscard]]
int linkEndForNode(
int linkIdx,
int nodeIdx)
const;
1519 double g1,
double g2,
double g3,
double g4);
1547 QStringList *outCleared =
nullptr,
1548 QStringList *outWarnings =
nullptr,
1549 QString *outError =
nullptr);
1558 QStringList *outCleared =
nullptr,
1559 QStringList *outWarnings =
nullptr,
1560 QString *outError =
nullptr);
1592 return soaIdx >= 0 && soaIdx < m_nodes.size() &&
1593 m_nodes[soaIdx].isVirtual != 0;
1603 QString *outError =
nullptr);
1615 const QString &newNodeName,
1616 const QString &newLinkName,
1617 int *outNodeIdx =
nullptr,
1618 int *outLinkIdx =
nullptr,
1619 QString *outError =
nullptr);
1628 QString *outError =
nullptr);
1638 const QString &newNodeName,
1639 const QString &newLinkName,
1640 int *outNodeIdx =
nullptr,
1641 int *outLinkIdx =
nullptr,
1642 QString *outError =
nullptr);
1657 QString *outError =
nullptr);
1673 return soaIdx >= 0 && soaIdx < m_nodes.size() &&
1674 m_nodes[soaIdx].isInlet != 0;
1687 SWMM_InletUsage *out)
const;
1693 QString *outError =
nullptr);
1698 QString *outError =
nullptr);
1704 QString *outError =
nullptr);
1711 const QString &newNodeName,
1712 const QString &newLinkName,
1713 const QString &inletId,
1714 const QString &captureNode,
1715 int *outNodeIdx =
nullptr,
1716 int *outLinkIdx =
nullptr,
1717 QString *outError =
nullptr);
1722 QString *outError =
nullptr);
1800 int *outIdx =
nullptr);
1821 const QString &fromNodeName,
const QString &toNodeName,
1822 const QVector<QPointF> &interiorVertices,
1823 int *outIdx =
nullptr);
1843 int *outIdx =
nullptr);
1850 const QVector<QPointF> &polygon,
1851 int *outIdx =
nullptr);
1878 bool applyRename(
const QString &oldName,
const QString &newName,
1903 if (m_layer) m_layer->beginBulkEdit();
1907 if (m_layer) m_layer->endBulkEdit();
1913 QPointer<SWMMModelLayer> m_layer;
1937 QStringList *cascadeLinkNames =
nullptr);
1963 const QStringList &linkNames,
1964 const QStringList &subcatchNames,
1965 const QStringList &gageNames,
1966 QStringList *cascadeLinkNames =
nullptr);
1984 const QString &gageName,
1985 int initialResponse);
2002 double r,
double t,
double k);
2007 double dmax,
double drecov,
double dinit);
2021 double k_dep,
double k_0,
double k_T,
2022 double T_ref,
double theta_rec,
double T_freeze,
2023 bool snowOn =
false,
double snow_T = 1.0,
2024 double snow_ddf = 0.0);
2084 QString *outError =
nullptr);
2090 QString *outError =
nullptr);
2097 QString *outError =
nullptr);
2102 QString *outError =
nullptr);
2125 QString *outError =
nullptr);
2132 double nLeft,
double nRight,
double nChannel);
2135 double xLeft,
double xRight);
2137 double stationMul,
double elevOffset,
double meander);
2140 const QVector<QPair<double,double>> &stations);
2301 bool decodeLegendClassKey(
const QString &
key,
Category *catOut,
2302 QString *innerOut)
const;
2304 struct NodeGeom {
double x, y;
int objectType;
int nodeType;
2312 QVector<QPointF> vertices;
2314 int fromNodeIdx = -1;
2318 struct CatchGeom { QVector<QPointF> vertices; QString
name; };
2321 struct OutletLine { QLineF line;
int catchIdx; };
2323 void buildGeometryCache();
2325 void rebuildKdTrees()
const;
2326 void ensureKdTrees()
const;
2342 void rebuildSceneCoords();
2343 void refreshSceneCoordsForNode(
int nodeIdx);
2344 void refreshSceneCoordsForLink(
int linkIdx);
2345 void refreshSceneCoordsForSubcatch(
int catchIdx);
2346 void refreshCatchOutletLinesForNode(
int nodeIdx);
2352 void appendNodeSceneEntry();
2353 void appendLinkSceneEntry();
2354 void appendCatchSceneEntry();
2355 void appendGageSceneEntry();
2356 void compactNodeSceneEntry(
int nodeIdx);
2357 void compactLinkSceneEntry(
int linkIdx);
2358 void compactCatchSceneEntry(
int catchIdx);
2359 void compactGageSceneEntry(
int gageIdx);
2380 void syncLinkEndpointIndicesFromEngine();
2394 void renameInIndices(
const QString &oldName,
const QString &newName,
2395 quint8 renamedKind);
2399 void recomputeExtentFromCaches();
2404 quint64 m_geomRevision = 0;
2410 int m_bulkDepth = 0;
2411 bool m_bulkDirty =
false;
2415 bool m_crsAssigned =
false;
2439 struct LinkSpatialGrid
2446 QVector<QVector<int>>
cells;
2448 void clear() { extent = {}; cellW = cellH = 0.0; cols = rows = 0;
cells.clear(); }
2449 [[nodiscard]]
bool isEmpty()
const {
return cells.isEmpty(); }
2454 void rebuild(
const QVector<QRectF> &linkBBoxes);
2459 [[nodiscard]] QVector<int> query(
const QRectF &rect)
const;
2461 LinkSpatialGrid m_linkGrid;
2471 void rebuildCategoryIndex();
2475 QString m_modelFilePath;
2476 bool m_showNodes =
true;
2477 bool m_showLinks =
true;
2478 bool m_showSubcatchments =
true;
2479 bool m_showRainGages =
true;
2480 bool m_showLabels =
false;
2487 QsgKinds m_qsgKinds =
QsgNone;
2496 QSet<QString> m_hiddenObjects;
2501 QHash<QString, quint8> m_hiddenKindMask;
2506 QHash<QString, quint8> m_selectedKindMask;
2508 QVector<NodeGeom> m_nodes;
2509 QVector<LinkGeom> m_links;
2510 QVector<CatchGeom> m_catchments;
2511 QVector<NodeGeom> m_gages;
2521 QVector<MapExtent> m_linkBboxes;
2522 QVector<MapExtent> m_catchBboxes;
2530 QVector<QPointF> m_nodeScenePts;
2531 QVector<QRectF> m_linkSceneBBoxes;
2532 QVector<QVector<QPointF>> m_catchScenePts;
2533 QVector<QRectF> m_catchSceneBBoxes;
2534 QVector<QPointF> m_gageScenePts;
2535 QVector<OutletLine> m_catchOutletLines;
2559 std::vector<double> m_linkSceneFlat;
2560 std::vector<uint32_t> m_linkVertexOffset;
2561 std::vector<uint32_t> m_linkVertexCount;
2571 std::vector<uint8_t> m_nodeSelectedFlag;
2572 std::vector<uint8_t> m_linkSelectedFlag;
2573 std::vector<uint8_t> m_catchSelectedFlag;
2574 std::vector<uint8_t> m_gageSelectedFlag;
2575 std::vector<uint8_t> m_nodeHiddenFlag;
2576 std::vector<uint8_t> m_linkHiddenFlag;
2577 std::vector<uint8_t> m_catchHiddenFlag;
2578 std::vector<uint8_t> m_gageHiddenFlag;
2584 QVector<int> m_nodesByType[4];
2585 QVector<int> m_linksByType[5];
2601 QVector<Category> m_categoryOrder;
2610 QHash<Category, QVector<int>> m_objectOrderOverrides;
2616 QHash<QString, QPair<Category, int>> m_objectLocation;
2625 enum class SoaKind : int8_t { Node = 0, Link = 1, Catch = 2, Gage = 3 };
2626 struct SoaLocation { SoaKind
kind;
int soaIdx; };
2627 QHash<QString, SoaLocation> m_nameToSoa;
2644 QHash<QString, int> m_nodeByName;
2645 QHash<QString, int> m_linkByName;
2646 QHash<QString, int> m_catchByName;
2647 QHash<QString, int> m_gageByName;
2654 void rebuildFlagArrays();
2668 void forgetStaleObjectState(
const QString &
name, quint8 kindBit);
2683 mutable QVector<InletConnector> m_inletConnectors;
2684 mutable bool m_inletConnectorsDirty =
true;
2686 mutable int m_inletJunctionSupport = -1;
2689 QPointer<MapCanvas> m_editCanvas;
2691 void rebuildInletConnectors()
const;
2697 void syncSplitCaches(
int li,
int newNode,
int newLink,
2698 const QString &newNodeName,
2699 const QString &newLinkName,
2700 const QString &origLinkName,
2701 int isVirtual,
int isInlet);
2706 void syncFuseCaches(
int ni,
int dn,
int surviving);
2722 QHash<QString, SwmmElementSymbolAdapter *> m_symbolAdapters;
2725 void resyncSymbolAdapter(
const QString &routingId,
2733 quint64 m_editRevision = 0;
2737 bool m_derivedStyleCachesPending =
false;
2742 void invalidateDerivedStyleCaches();
2749 std::unique_ptr<OpenSWMM::Render::IFeatureRenderer> m_renderer;
2757 std::vector<std::unique_ptr<OpenSWMM::Render::IFeatureRenderer>> m_kindRenderers;
2762 mutable std::unique_ptr<OpenSWMM::Render::RuleList> m_ruleList;
2763 void buildRuleListLazy()
const;
2769 mutable bool m_ruleListDirty =
false;
2791 QStringList m_selectedNames;
2795 QVector<SelectedElement> m_selectedElements;
2804 mutable QVector<int> m_curveTableIdx;
2805 mutable QVector<int> m_tsTableIdx;
2806 mutable bool m_tablePartitionDirty =
true;
2807 void ensureTablePartition()
const;
2819 class OGRCoordinateTransformation *m_transform =
nullptr;
2824 mutable class OGRCoordinateTransformation *m_inverseTransform =
nullptr;
2834 QString m_transformLayerWkt;
2835 QString m_transformCanvasWkt;
2836 bool m_transformValid =
false;
2839 bool m_needsRebuild =
true;
2844 mutable bool m_kdDirty =
true;
2845 mutable std::unique_ptr<SWMMKdTrees> m_kdTrees;
2866 QObject *m_tsRegistry =
nullptr;
2867 void *m_tsRegistryEngineHandle =
nullptr;
2868 QObject *m_patternRegistry =
nullptr;
2869 void *m_patternRegistryEngineHandle =
nullptr;
2870 QObject *m_curveRegistry =
nullptr;
2871 void *m_curveRegistryEngineHandle =
nullptr;
2874 QObject *m_controlRuleRegistry =
nullptr;
2875 void *m_controlRuleRegistryEngineHandle =
nullptr;
2878 QObject *m_transectRegistry =
nullptr;
2879 void *m_transectRegistryEngineHandle =
nullptr;
2882 QObject *m_streetRegistry =
nullptr;
2883 void *m_streetRegistryEngineHandle =
nullptr;
2886 QObject *m_pollutantRegistry =
nullptr;
2887 void *m_pollutantRegistryEngineHandle =
nullptr;
2890 QObject *m_landUseRegistry =
nullptr;
2891 void *m_landUseRegistryEngineHandle =
nullptr;
2894 QObject *m_aquiferRegistry =
nullptr;
2895 void *m_aquiferRegistryEngineHandle =
nullptr;
2898 QObject *m_snowpackRegistry =
nullptr;
2899 void *m_snowpackRegistryEngineHandle =
nullptr;
2902 QObject *m_inletRegistry =
nullptr;
2903 void *m_inletRegistryEngineHandle =
nullptr;
2906 QObject *m_lidControlRegistry =
nullptr;
2907 void *m_lidControlRegistryEngineHandle =
nullptr;
2911 void *m_userFlagsModelEngineHandle =
nullptr;
2916Q_DECLARE_OPERATORS_FOR_FLAGS(SWMMModelLayer::QsgKinds)
Definition hydrographmodels.h:161
Definition hydrographmodels.h:46
Definition hydrographmodels.h:118
Definition hydrographmodels.h:80
The central map display widget — QGIS-style hybrid rendering.
Definition mapcanvas.h:63
An axis-aligned bounding box in the coordinate space of a given CRS.
Definition mapextent.h:26
Classifies a numeric attribute into bins and assigns a colour per bin.
Definition graduatedrenderer.h:63
Interface every themeable layer implements so renderer panels can populate attribute combos without h...
Definition iattributeprovider.h:73
Abstract interface — every vector layer's paint path goes here.
Definition ifeaturerenderer.h:85
Ordered owning container for Rules on one layer.
Definition rulelist.h:48
Abstract base class for all layers displayed in the MapCanvas.
Definition openswmmvislayer.h:116
double opacity() const
Returns the layer opacity in the range [0.0, 1.0]. 0.0 = fully transparent; 1.0 = fully opaque.
Definition openswmmvislayer.cpp:103
QString name() const
Returns the user-visible name of this layer.
Definition openswmmvislayer.cpp:62
Top-level project container managing sessions, the SWMM model layer, and persistence paths for one SW...
Definition openswmmvisworkspace.h:42
Definition swmmlayeritem.h:41
Definition swmmlayerqsgrenderer.h:42
Definition swmmmodellayer.h:1899
BulkEdit(SWMMModelLayer *layer)
Definition swmmmodellayer.h:1901
BulkEdit & operator=(const BulkEdit &)=delete
~BulkEdit()
Definition swmmmodellayer.h:1905
BulkEdit(const BulkEdit &)=delete
Renders the SWMM network elements (nodes, links, subcatchments, rain gages) for one OpenSWMMEngine mo...
Definition swmmmodellayer.h:133
QObject * ensureInletRegistry()
Lazy accessor for the project-scoped InletRegistry.
Definition swmmmodellayer.cpp:7183
QStringList gagesInPolygon(const QPolygonF &canvasPoly) const
Definition swmmmodellayer.cpp:8968
bool kindHasAnyOffset(Category c) const
Definition swmmmodellayer.cpp:3296
void controlRulesChanged(const QString &ruleName)
void setCategoryVisible(Category c, bool visible)
Bulk-toggle every member of a category. Used by the group-header checkbox in the Object Browser; emit...
Definition swmmmodellayer.cpp:2313
int featureShape(Category c, int idx) const
Definition swmmmodellayer.cpp:3280
bool rollbackTailSubcatchAdd(const QString &name)
Definition swmmmodellayer.cpp:5976
void setInletJunctionSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2566
void modelFilePathChanged(const QString &path)
PickResult pickAt(double sceneX, double sceneY, double tolerance) const
Definition swmmmodellayer.cpp:4334
QSet< QString > hiddenObjects() const
Names currently hidden via per-object toggles. Used by the Object Browser to seed leaf-row check stat...
Definition swmmmodellayer.h:437
QObject * ensureTimeseriesRegistry()
Definition swmmmodellayer.cpp:6576
void qsgRenderKindsChanged(QsgKinds kinds)
qreal sizeForClass(const QString &classKey) const
Definition swmmmodellayer.cpp:3002
void showLinksChanged(bool show)
bool isConduit(int linkIdx) const
Returns true when the link at linkIdx is a conduit (the only link type whose length is stored as an i...
Definition swmmmodellayer.cpp:4578
bool applyTransectAdd(const QString &name, QString *outError=nullptr)
Create a new transect. Refuses on duplicate or empty name.
Definition swmmmodellayer.cpp:7260
void setInletConnectorSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2568
void setOutletSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2573
bool applyInsertInletJunction(const QString &linkName, double t, const QString &newNodeName, const QString &newLinkName, const QString &inletId, const QString &captureNode, int *outNodeIdx=nullptr, int *outLinkIdx=nullptr, QString *outError=nullptr)
Split STREET conduit linkName at t, inserting an inlet junction wired to inletId / captureNode,...
Definition swmmmodellayer.cpp:5456
bool applySubcatchDelete(const QString &name)
Definition swmmmodellayer.cpp:6352
int nodeIndex(const QString &name) const
Returns the cache index of the node with the given name, or -1 if none matches.
Definition swmmmodellayer.cpp:4215
QObject * ensureTransectRegistry()
Lazy accessor for the project-scoped TransectRegistry.
Definition swmmmodellayer.cpp:7014
static SWMM_Engine openEngineForPath(const QString &path, QString *errorDetail, qint64 *openMs=nullptr)
Create + open an engine for path (worker-thread safe).
Definition swmmmodellayer.cpp:798
OpenSWMM::Render::IFeatureRenderer * kindRenderer(Category c) const
Definition swmmmodellayer.cpp:2909
bool setOption(const QByteArray &key, const QString &value)
Write a single SWMM OPTIONS key. On success emits optionsChanged({key}). Returns true on success,...
Definition swmmmodellayer.cpp:4553
bool applyLinkBarrels(int linkIdx, int barrels)
Slice SC.1 — Write the parallel-barrels count. Emits attributeChanged on success.
Definition swmmmodellayer.cpp:4798
HydrographRtkTableModel * hydrographRtkModel()
Definition swmmmodellayer.cpp:6558
bool applyControlRuleReplace(const QString &name, const QString &newBody, QString *outError=nullptr)
Replace the body of an existing rule (typically the user- edited text from the code editor)....
Definition swmmmodellayer.cpp:6863
bool cachedNodeCoord(int idx, double *x, double *y) const
Cached layer-CRS coordinate of a node by index.
Definition swmmmodellayer.cpp:4230
QString getOption(const QByteArray &key, const QString &fallback={}) const
Read a single SWMM OPTIONS key from the engine. Returns the fallback when the engine has no value for...
Definition swmmmodellayer.cpp:4542
void setShowLabels(bool show)
Definition swmmmodellayer.cpp:1402
static constexpr Category CatOrifices
Definition swmmmodellayer.h:162
SWMMElementSymbol inletJunctionSymbol() const
Definition swmmmodellayer.cpp:2525
bool linkArrowOnlyWhenFlowPos(Category c) const
Definition swmmmodellayer.cpp:2849
QString objectNameAt(Category c, int row) const
Object name at (category, row). O(1) — reads through the per-category index buckets populated in buil...
Definition swmmmodellayer.cpp:1586
OpenSWMMVis::SwmmCategory Category
The SWMM-element Category enum.
Definition swmmmodellayer.h:155
void setShowRainGages(bool show)
Definition swmmmodellayer.cpp:1398
void resetKindRendererToDefaults(Category c)
Definition swmmmodellayer.cpp:3522
bool showNodes
Definition swmmmodellayer.h:201
bool applyLinkInteriorVertices(int linkIdx, const QVector< QPointF > &interior)
Apply interior vertices to a link: engine + cache, rebuilding the cached polyline from the node endpo...
Definition swmmmodellayer.cpp:7437
void modelLoadError(const QString &errorMessage)
void setGlRenderingEnabled(bool on)
Definition swmmmodellayer.h:397
double polylineLengthInModelUnits(const QVector< QPointF > &vertices) const
Compute polyline length in the SWMM model's expected linear unit (feet for US-customary FLOW_UNITS — ...
Definition swmmmodellayer.cpp:4495
void setOrificeSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2571
bool crsAssigned() const noexcept
Whether the layer's CRS was ASSIGNED — read from the .inp's [OPTIONS] CRS, or set after load by the u...
Definition swmmmodellayer.h:238
bool applyTransectRemove(const QString &name, QString *outError=nullptr)
Remove a transect by name.
Definition swmmmodellayer.cpp:7312
QStringList linksInRect(double canvasMinX, double canvasMinY, double canvasMaxX, double canvasMaxY) const
Names of all links whose polyline bbox overlaps the canvas-CRS rectangle. Backed by a per-link bbox c...
Definition swmmmodellayer.cpp:8879
void setColorForClass(const QString &classKey, const QColor &color)
Definition swmmmodellayer.cpp:2986
bool applyFuseInletJunction(const QString &nodeName, QString *outError=nullptr)
Inverse of applyInsertInletJunction — drops the usage row and re-fuses the conduit pair (swmm_inlet_j...
Definition swmmmodellayer.cpp:5501
bool adoptNewEngine(const NewProjectSpec &spec, QList< QString > &warnings, QList< QString > &errors)
In-memory sibling of the loadModel path: createBlankEngine → buildFromEngine → adoptOpenEngine,...
Definition swmmmodellayer.cpp:1020
int categoryCount(Category c) const
Number of objects in the given category. O(1).
Definition swmmmodellayer.cpp:1570
bool previewGageMove(int idx, double newX, double newY)
Definition swmmmodellayer.cpp:4463
void setKindRenderer(Category c, std::unique_ptr< OpenSWMM::Render::IFeatureRenderer > r)
Definition swmmmodellayer.cpp:3021
static QString virtualJunctionRuleText(int engineErrorCode)
Actionable text for a virtual-junction / inlet-junction rule code (609..621 VJ, 623....
Definition swmmmodellayer.cpp:4984
bool applyLinkLength(int linkIdx, double length)
Write the conduit length for a link. No-op if the link is not a conduit.
Definition swmmmodellayer.cpp:4764
bool applySubcatchArea(int idx, double areaInModelUnits)
Definition swmmmodellayer.cpp:8197
void populateScene(QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) override
Creates / updates QGraphicsItems representing this layer in the scene.
Definition swmmmodellayer.cpp:4089
static SWMM_Engine createBlankEngine(const NewProjectSpec &spec, QString *errorDetail)
Create a blank BUILDING-state engine (swmm_engine_new) and stamp the spec's defaults on it via the op...
Definition swmmmodellayer.cpp:872
QObject * ensureCurveRegistry()
Definition swmmmodellayer.cpp:6695
void setObjectsVisible(const QList< QString > &names, bool visible)
Batch form — apply the same visibility to every name in names with a single repaintRequested emission...
Definition swmmmodellayer.cpp:1502
static quint8 kindBitForCategory(Category c) noexcept
Definition swmmmodellayer.cpp:1444
int linkFromNodeIdx(int linkIdx) const
Definition swmmmodellayer.cpp:4614
QVector< QPointF > cachedLinkInteriorVertices(int idx) const
Cached interior-only polyline of a link (endpoints stripped).
Definition swmmmodellayer.cpp:4295
bool pushInletUsageRemoval(int hostKind, int hostIdx)
Undoable counterpart of applyRemoveInletUsage().
Definition swmmmodellayer.cpp:5555
bool applyControlRuleRename(const QString &oldName, const QString &newName, QString *outError=nullptr)
Rename oldName to newName. Rewrites the RULE <name> header on the target slot's body so the engine ro...
Definition swmmmodellayer.cpp:6896
int linkToNodeIdx(int linkIdx) const
Definition swmmmodellayer.cpp:4623
QPolygonF polygonCanvasToLayer(const QPolygonF &poly) const
Transform every vertex of a canvas-CRS polygon into layer CRS.
Definition swmmmodellayer.cpp:8937
void setObjectVisible(const QString &name, bool visible)
Definition swmmmodellayer.cpp:1462
bool applyInsertVirtualJunction(const QString &linkName, double t, const QString &newNodeName, const QString &newLinkName, int *outNodeIdx=nullptr, int *outLinkIdx=nullptr, QString *outError=nullptr)
Split conduit linkName at normalized polyline position t, inserting a virtual junction,...
Definition swmmmodellayer.cpp:5129
bool engineSupportsInletJunctions() const
Tri-state capability probe, cached for the layer's lifetime: true when the bound engine exposes the i...
Definition swmmmodellayer.cpp:5329
void reloadGeometry()
Re-read every node / link / subcatchment coordinate from the engine and rebuild the geometry cache + ...
Definition swmmmodellayer.cpp:4189
openswmmvis::ui::UserFlagsModel * ensureUserFlagsModel()
Lazy accessor for the project-scoped UserFlagsModel. Returns nullptr if the engine isn't open.
Definition swmmmodellayer.cpp:7239
SWMM_Engine engine() const
Definition swmmmodellayer.cpp:716
bool applySetVirtual(const QString &name, bool makeVirtual, QString *outError=nullptr)
Set or clear a node's virtual-junction flag via swmm_node_set_virtual (full engine validation)....
Definition swmmmodellayer.cpp:5017
QObject * ensurePatternRegistry()
Definition swmmmodellayer.cpp:6651
void setSelectedElements(const QVector< SelectedElement > &sel)
Replaces the selection with typed entries (kind-exact).
Definition swmmmodellayer.cpp:3562
QVariantMap identifyByName(const QString &name, quint8 kindMask=kKindAll) const
Identify an object by name (instead of by map coordinates).
Definition swmmmodellayer.cpp:3626
QStringList nodesInPolygon(const QPolygonF &canvasPoly) const
Definition swmmmodellayer.cpp:8949
QObject * ensureControlRuleRegistry()
Lazy accessor for the project-scoped ControlRuleRegistry. Lifetime is bound to the layer; the registr...
Definition swmmmodellayer.cpp:6993
void setObjectOrder(Category cat, const QVector< int > &soaIndices)
Install a user-defined display order for the given category. soaIndices is a permutation of the under...
Definition swmmmodellayer.cpp:2231
class MapExtent objectExtent(const QString &name) const
Layer-CRS bounding box of a cached object by name.
Definition swmmmodellayer.cpp:3814
SWMMElementSymbol dividerSymbol() const
Definition swmmmodellayer.cpp:2523
static constexpr Category CatWeirs
Definition swmmmodellayer.h:163
bool qsgOwnsKind(QsgKind k) const noexcept
Definition swmmmodellayer.h:388
bool showLinks
Definition swmmmodellayer.h:203
SWMMElementSymbol virtualJunctionSymbol() const
Definition swmmmodellayer.cpp:2524
void rendererChanged()
Slice BI Phase 8.13.6.5 — emitted when setRenderer() swaps the renderer pointer.
int linkEndForNode(int linkIdx, int nodeIdx) const
Which end of a link is attached to nodeIdx: 0 = from, 1 = to, or -1 if the node is not an endpoint of...
Definition swmmmodellayer.cpp:4602
void rebuildKindFeatureColors(Category c)
Definition swmmmodellayer.cpp:3344
bool showRainGages
Definition swmmmodellayer.h:207
QVector< Category > categoryOrder() const
User-configurable display order of categories in the Object Browser. Defaults to the enum sequence at...
Definition swmmmodellayer.cpp:2393
double engineLinkLength(int linkIdx) const
Returns the conduit length recorded in the engine, or -1 if the link is not a conduit / is out of ran...
Definition swmmmodellayer.cpp:4485
bool adoptOpenEngine(SWMM_Engine engine, QList< QString > &warnings, QList< QString > &errors, qint64 openMs=-1, qint64 soaMs=0, qint64 geomMs=0)
Adopt an engine whose geometry was already built by buildFromEngine(). GUI-thread only: assigns the e...
Definition swmmmodellayer.cpp:1234
void closeEngine()
Definition swmmmodellayer.cpp:718
void setObjectVisibleAt(Category c, int row, bool visible)
Toggle visibility for a single leaf referenced by (category, row). Updates m_hiddenObjects plus the c...
Definition swmmmodellayer.cpp:2268
static constexpr quint8 kKindCatch
Definition swmmmodellayer.h:976
SWMMElementSymbol pumpSymbol() const
Definition swmmmodellayer.cpp:2528
QList< OpenSWMM::Render::LegendSymbolItem > legendSymbolItems() const
Definition swmmmodellayer.cpp:2946
static constexpr Category CatJunctions
Definition swmmmodellayer.h:156
void setLinkArrowSize(Category c, double pixels)
Definition swmmmodellayer.cpp:2773
SWMMElementSymbol outfallSymbol() const
Definition swmmmodellayer.cpp:2521
void endBulkEdit()
Definition swmmmodellayer.cpp:6102
void setLabelConfig(const OpenSWMM::Render::LabelConfig &cfg) override
Slice X.18 — full label configuration.
Definition swmmmodellayer.cpp:1426
void clearSelection()
Definition swmmmodellayer.cpp:3611
bool applyNodeAdd(const QString &name, int nodeType, double x, double y, int *outIdx=nullptr)
Add a new node: engine + cache. Engine must be OPENED.
Definition swmmmodellayer.cpp:5641
bool rollbackTailLinkAdd(const QString &name)
Definition swmmmodellayer.cpp:5811
static constexpr Category CatOutfalls
Definition swmmmodellayer.h:157
bool applyHydrographClearMonths(const QString &name)
Definition swmmmodellayer.cpp:6515
void optionsChanged(const QStringList &keys)
Emitted after any OPTIONS key has been written to the engine (via setOption() — the single entry poin...
void classifyGraduatedIfNeeded(Category c, OpenSWMM::Render::GraduatedRenderer *g)
Definition swmmmodellayer.cpp:3302
bool transformCanvasToLayer(double cx, double cy, double &lx, double &ly) const
Reverse-transform a canvas-CRS coordinate into the layer's native CRS.
Definition swmmmodellayer.cpp:9089
int linkIndex(const QString &name) const
Returns the cache index of the link with the given name, or -1 if none matches.
Definition swmmmodellayer.cpp:4221
bool applyLinkFlip(int linkIdx)
Reverse link linkIdx: the upstream node becomes the downstream node and vice versa,...
Definition swmmmodellayer.cpp:4929
SwmmElementSymbolAdapter * elementSymbolAdapter(const QString &routingId)
The layer's persistent per-kind symbol adapter for a subject routing id ("model.junctions" … "model....
Definition swmmmodellayer.cpp:2585
bool applyGageMove(int idx, double newX, double newY)
Move a rain gage: engine [SYMBOLS] coordinate + cached scene point, in lockstep (a bare swmm_spatial_...
Definition swmmmodellayer.cpp:5833
void convertLinkOffsets(bool toElevation, bool convertValues)
Apply the user's answer to legacy UpdateOffsets' "convert all link offsets?...
Definition swmmmodellayer.cpp:4709
static constexpr Category CatDividers
Definition swmmmodellayer.h:159
double linkFlow(int linkIdx) const
Definition swmmmodellayer.cpp:2878
void refreshScene(QGraphicsScene *scene, const MapExtent &canvasExtent, const SpatialReferenceSystem *canvasSRS) override
Smart scene refresh — updates existing items instead of destroying and recreating.
Definition swmmmodellayer.cpp:4168
void setVirtualJunctionSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2564
bool applyTransectRename(const QString &oldName, const QString &newName, QString *outError=nullptr)
Rename. Refuses on duplicate (case-insensitive) or empty.
Definition swmmmodellayer.cpp:7281
bool applyGageDelete(const QString &name)
Definition swmmmodellayer.cpp:6230
QsgKind
Definition swmmmodellayer.h:372
@ QsgGages
Rain gages.
Definition swmmmodellayer.h:377
@ QsgCatch
Subcatchments (polygons + outlet lines).
Definition swmmmodellayer.h:376
@ QsgLinks
Conduits / pumps / orifices / weirs / outlets.
Definition swmmmodellayer.h:375
@ QsgNodes
Junctions / outfalls / storage / dividers.
Definition swmmmodellayer.h:374
@ QsgNone
Definition swmmmodellayer.h:373
bool supportsClassEdit(OpenSWMM::Render::ClassEditKind kind) const
Definition swmmmodellayer.cpp:2968
void setLinkArrowColor(Category c, const QColor &col)
Definition swmmmodellayer.cpp:2831
bool applySetInlet(const QString &name, bool makeInlet, QString *outError=nullptr)
Set or clear a node's inlet-junction flag via swmm_node_set_inlet. Clearing leaves the node a virtual...
Definition swmmmodellayer.cpp:5424
SWMMElementSymbol conduitSymbol() const
Definition swmmmodellayer.cpp:2527
bool applyHydrographRemoveEntry(const QString &name, int month, int response)
Definition swmmmodellayer.cpp:6503
bool glRenderingEnabled() const noexcept
Definition swmmmodellayer.h:395
bool applyTransectSetComments(const QString &name, const QString &comments)
Definition swmmmodellayer.cpp:7335
double maxMarkerHalfBoundPx() const
Largest rendered marker half-bound across every SWMM element type, in PIXELS. Callers use this as a f...
Definition swmmmodellayer.cpp:1547
bool applyTransectSetStations(const QString &name, const QVector< QPair< double, double > > &stations)
Snapshot-and-rewrite the full station list.
Definition swmmmodellayer.cpp:7411
bool applyTransectSetEncroachmentStations(const QString &name, double xLeft, double xRight)
Definition swmmmodellayer.cpp:7379
QStringList subcatchmentsInPolygon(const QPolygonF &canvasPoly) const
Definition swmmmodellayer.cpp:9009
void setPumpSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2570
bool applyNodeDelete(const QString &name, QStringList *cascadeLinkNames=nullptr)
Delete a node, cascade-deleting all attached links.
Definition swmmmodellayer.cpp:6150
bool applyDeleteMany(const QStringList &nodeNames, const QStringList &linkNames, const QStringList &subcatchNames, const QStringList &gageNames, QStringList *cascadeLinkNames=nullptr)
Batch deletion (perf-plan Phase A2): one swmm_*_delete_many engine call per kind, one order-preservin...
Definition swmmmodellayer.cpp:6250
void setLinkArrowsEnabled(Category c, bool enabled)
Definition swmmmodellayer.cpp:2742
bool applyNodeMove(int idx, double newX, double newY)
Apply a new coordinate to a node: engine + cache + attached link endpoint updates....
Definition swmmmodellayer.cpp:4632
bool applyRdiiDecaySet(const QString &name, int response, double k_dep, double k_0, double k_T, double T_ref, double theta_rec, double T_freeze, bool snowOn=false, double snow_T=1.0, double snow_ddf=0.0)
Definition swmmmodellayer.cpp:6525
bool applyLinkDelete(const QString &name)
Definition swmmmodellayer.cpp:6210
bool loadModel(QList< QString > &warnings, QList< QString > &errors)
Loads (or reloads) the SWMM input file and rebuilds geometry caches.
Definition swmmmodellayer.cpp:779
void setModelFilePath(const QString &path)
Definition swmmmodellayer.cpp:707
static constexpr Category CatStorage
Definition swmmmodellayer.h:158
bool applyLinkCulvertCode(int linkIdx, int code)
Slice SC.1 — Write the FHWA culvert chart code (0 = none). Emits attributeChanged on success.
Definition swmmmodellayer.cpp:4808
void categoryOrderChanged()
QString modelFilePath
Definition swmmmodellayer.h:199
DataCategory
Slice BM.0 — non-spatial data-object categories surfaced below the spatial section in the Object Brow...
Definition swmmmodellayer.h:182
@ NumDataCategories
Definition swmmmodellayer.h:196
@ DataTimeSeries
Definition swmmmodellayer.h:184
@ DataStreets
Definition swmmmodellayer.h:194
@ DataPollutants
Definition swmmmodellayer.h:187
@ DataLIDControls
Definition swmmmodellayer.h:186
@ DataTransects
Definition swmmmodellayer.h:192
@ DataSnowpacks
Definition swmmmodellayer.h:190
@ DataHydrographs
Definition swmmmodellayer.h:193
@ DataLandUses
Definition swmmmodellayer.h:188
@ DataCurves
Definition swmmmodellayer.h:183
@ DataInlets
Definition swmmmodellayer.h:195
@ DataAquifers
Definition swmmmodellayer.h:189
@ DataPatterns
Definition swmmmodellayer.h:185
@ DataControls
Definition swmmmodellayer.h:191
void setOutfallSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2558
void onCanvasCRSChanged(const SpatialReferenceSystem *newCanvasSRS) override
Called when the user changes the canvas CRS so layers can pre-compute any CRS-dependent transform cac...
Definition swmmmodellayer.cpp:4162
SWMMElementSymbol inletConnectorSymbol() const
Definition swmmmodellayer.cpp:2526
bool applyHydrographSetGage(const QString &name, const QString &gageName)
Definition swmmmodellayer.cpp:6464
void showLabelsChanged(bool show)
void clearObjectOrder(Category cat)
Definition swmmmodellayer.cpp:2219
bool applyLinkConvert(const QString &name, int newLinkType, QStringList *outCleared=nullptr, QStringList *outWarnings=nullptr, QString *outError=nullptr)
Convert link name to newLinkType (SWMM_LinkType value) via swmm_link_convert. Endpoints,...
Definition swmmmodellayer.cpp:4883
void setSubcatchmentSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2574
qreal categoryOpacity(Category c) const
Per-kind (sub-layer) opacity in [0,1], applied on top of the layer opacity. Lets the user fade,...
Definition swmmmodellayer.cpp:2360
QColor featureColor(Category c, int idx) const
Definition swmmmodellayer.cpp:3264
void showRainGagesChanged(bool show)
void buildFromEngine(SWMM_Engine engine, qint64 *soaMsOut=nullptr, qint64 *geomMsOut=nullptr)
Populate the SoA arrays + geometry caches from engine.
Definition swmmmodellayer.cpp:1039
QObject * ensureStreetRegistry()
Lazy accessor for the project-scoped StreetRegistry.
Definition swmmmodellayer.cpp:7043
bool applyTransectSetModifiers(const QString &name, double stationMul, double elevOffset, double meander)
Definition swmmmodellayer.cpp:7394
void setCategoryOrder(const QVector< Category > &order)
Definition swmmmodellayer.cpp:2398
bool inletUsageFor(int hostKind, int hostIdx, SWMM_InletUsage *out) const
Read the inlet-usage row hosted by (hostKind, hostIdx).
Definition swmmmodellayer.cpp:5349
double featureSize(Category c, int idx) const
Definition swmmmodellayer.cpp:3272
bool applyTransectSetBankStations(const QString &name, double xLeft, double xRight)
Definition swmmmodellayer.cpp:7364
bool applySubcatchAdd(const QString &name, const QVector< QPointF > &polygon, int *outIdx=nullptr)
Definition swmmmodellayer.cpp:5927
int soaIndexAt(Category c, int row) const
SoA index at (category, row) — the index objectNameAt resolves the name from, and therefore also the ...
Definition swmmmodellayer.cpp:1635
static constexpr quint8 kKindNode
Definition swmmmodellayer.h:974
QObject * ensurePollutantRegistry()
Lazy accessor for the project-scoped PollutantRegistry.
Definition swmmmodellayer.cpp:7071
int dataObjectCount(DataCategory c) const
Slice BM.0 — number of non-spatial data objects in c. Returns 0 when the engine handle is null or whe...
Definition swmmmodellayer.cpp:1738
bool applyTransectSetRoughness(const QString &name, double nLeft, double nRight, double nChannel)
Definition swmmmodellayer.cpp:7349
bool elementPosition(const QString &name, double *x, double *y) const
Layer-CRS position of any named element (node, gage, or link midpoint) by object name.
Definition swmmmodellayer.cpp:4239
bool snapNearestPoint(double mapX, double mapY, double mapRadius, QPointF &outPt, std::optional< QPointF > excludePos=std::nullopt) const
Nearest-neighbor snap query for vertex editing.
Definition swmmmodellayer.cpp:8795
bool showSubcatchments
Definition swmmmodellayer.h:205
QStringList selectedElementNames() const
Returns the names of currently selected network elements.
Definition swmmmodellayer.cpp:3560
quint64 editRevision() const
Definition swmmmodellayer.h:768
void markEdited()
Records that the engine now holds edits not yet on disk.
Definition swmmmodellayer.h:2186
int renderLinkCount() const
Number of links the render-facing scene-coordinate arrays currently describe.
Definition swmmmodellayer.h:1286
static constexpr quint8 kKindGage
Definition swmmmodellayer.h:977
static constexpr Category CatOutlets
Definition swmmmodellayer.h:164
bool showLabels
Definition swmmmodellayer.h:209
SWMMElementSymbol orificeSymbol() const
Definition swmmmodellayer.cpp:2529
static constexpr Category NumCategories
Definition swmmmodellayer.h:167
bool transformLayerToCanvas(double lx, double ly, double &cx, double &cy) const
Forward-transform a layer-CRS coordinate into the canvas CRS.
Definition swmmmodellayer.cpp:9113
double linkArrowWidth(Category c) const
Definition swmmmodellayer.cpp:2790
bool isObjectVisible(const QString &name) const
Per-object visibility flag. Names present in m_hiddenObjects are skipped by populateScene....
Definition swmmmodellayer.cpp:1439
void depopulateScene(QGraphicsScene *scene) override
Removes all QGraphicsItems belonging to this layer from the scene.
Definition swmmmodellayer.cpp:4122
int cachedSubcatchCount() const
Number of subcatchments cached. Equivalent to categoryCount(CatSubcatchments) but provided alongside ...
Definition swmmmodellayer.cpp:4310
QVector< QPointF > cachedSubcatchVertices(int idx) const
Cached layer-CRS polygon of a subcatchment by index. Vertex order matches the .inp [Polygons] section...
Definition swmmmodellayer.cpp:4303
QStringList tableIdsOfType(int tableType) const
List the engine's table ids whose type matches tableType (Slice DA.4.3).
Definition swmmmodellayer.cpp:1954
SWMMElementSymbol storageSymbol() const
Definition swmmmodellayer.cpp:2522
QObject * ensureAquiferRegistry()
Lazy accessor for the project-scoped AquiferRegistry.
Definition swmmmodellayer.cpp:7127
static constexpr quint8 kKindLink
Definition swmmmodellayer.h:975
bool applyControlRuleRemove(const QString &name, QString *outError=nullptr)
Drop the rule with name from the engine + registry. Returns false if not found.
Definition swmmmodellayer.cpp:6962
static constexpr Category CatPumps
Definition swmmmodellayer.h:161
int cachedGageCount() const
Definition swmmmodellayer.cpp:4317
static constexpr quint8 kKindAll
Definition swmmmodellayer.h:978
bool applyControlRuleAdd(const QString &name, const QString &body, QString *outError=nullptr)
Append a new control rule. body should already include the RULE <name> header (matching the engine's ...
Definition swmmmodellayer.cpp:6833
void setConduitSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2569
bool linkArrowsEnabled(Category c) const
Definition swmmmodellayer.cpp:2730
bool kindUsesOverrides(Category c) const
Definition swmmmodellayer.cpp:3258
QVector< int > linksAttachedToNode(int nodeIdx) const
Indices of links whose from/to endpoint is the given node.
Definition swmmmodellayer.cpp:4586
void setStorageSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2559
bool rollbackTailGageAdd(const QString &name)
Definition swmmmodellayer.cpp:5906
QsgKinds qsgRenderKinds() const noexcept
Definition swmmmodellayer.h:381
HydrographDecayTableModel * hydrographDecayModel()
Definition swmmmodellayer.cpp:6570
QColor colorForClass(const QString &classKey) const
Definition swmmmodellayer.cpp:2978
void beginBulkEdit()
Definition swmmmodellayer.cpp:6091
MapCanvas * editCanvas() const
Definition swmmmodellayer.cpp:5542
QColor linkArrowColor(Category c) const
Definition swmmmodellayer.cpp:2819
bool applyHydrographSetIa(const QString &name, int month, int response, double dmax, double drecov, double dinit)
Definition swmmmodellayer.cpp:6490
QVector< OpenSWMM::Render::AttributeField > availableAttributes(OpenSWMMVis::SwmmCategory cat) const override
Definition swmmmodellayer.cpp:3102
bool applyRemoveInletUsage(int hostKind, int hostIdx, QString *outError=nullptr)
Remove the usage row hosted by (hostKind, hostIdx). A missing row is a successful no-op.
Definition swmmmodellayer.cpp:5391
std::vector< std::unique_ptr< openswmmvis::ui::ILayerStyleSubject > > styleSubjects() override
Definition swmmmodellayer.cpp:2653
HydrographGroupListModel * hydrographGroupListModel()
Definition swmmmodellayer.cpp:6552
void selectionChanged(const QStringList &selectedNames)
void setQsgRenderKinds(QsgKinds kinds)
Definition swmmmodellayer.cpp:1415
void setLinkArrowWidth(Category c, double pixels)
Definition swmmmodellayer.cpp:2802
void setSizeForClass(const QString &classKey, qreal size)
Definition swmmmodellayer.cpp:3010
bool previewNodeMove(int idx, double newX, double newY)
Definition swmmmodellayer.cpp:4437
bool nodeIsVirtual(int soaIdx) const
True when cached node soaIdx is a virtual junction.
Definition swmmmodellayer.h:1591
void dataObjectsChanged()
bool applyFuseJunctionSplit(const QString &nodeName, QString *outError=nullptr)
Inverse of applyInsertJunctionSplit — re-fuses the conduit pair and deletes the junction.
Definition swmmmodellayer.cpp:5252
bool applyFuseVirtualJunction(const QString &nodeName, QString *outError=nullptr)
Re-fuse the two conduits of virtual junction nodeName into one via swmm_virtual_junction_fuse (upstre...
Definition swmmmodellayer.cpp:5175
QStringList nodesInRect(double canvasMinX, double canvasMinY, double canvasMaxX, double canvasMaxY) const
Names of all nodes (any type) whose layer-CRS coordinates fall inside the rectangle given in canvas C...
Definition swmmmodellayer.cpp:8723
QString sourceDescription() const override
Human-readable source of this layer: a file path, a service URL, or a description for in-memory / der...
Definition swmmmodellayer.cpp:661
void attributeChanged(const QString &objectName)
void setShowSubcatchments(bool show)
Definition swmmmodellayer.cpp:1394
const QVector< SelectedElement > & selectedElements() const
Typed selection — canonical form. Each entry names WHICH kind is selected, so same-named objects of o...
Definition swmmmodellayer.h:1011
SWMMElementSymbol junctionSymbol() const
Definition swmmmodellayer.cpp:2520
void setWeirSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2572
QVector< int > objectOrder(Category cat) const
Definition swmmmodellayer.cpp:2192
SWMMElementSymbol weirSymbol() const
Definition swmmmodellayer.cpp:2530
bool bulkEditActive() const
Definition swmmmodellayer.h:1927
bool applyNodeConvert(const QString &name, int newNodeType, QStringList *outCleared=nullptr, QStringList *outWarnings=nullptr, QString *outError=nullptr)
Convert node name to newNodeType (SWMM_NodeType value) via swmm_node_convert. The engine preserves co...
Definition swmmmodellayer.cpp:4843
QStringList gagesInRect(double canvasMinX, double canvasMinY, double canvasMaxX, double canvasMaxY) const
Names of all rain gages whose coordinates fall inside the canvas-CRS rectangle. Same semantics as nod...
Definition swmmmodellayer.cpp:8760
bool applyLinkAdd(const QString &name, int linkType, const QString &fromNodeName, const QString &toNodeName, const QVector< QPointF > &interiorVertices, int *outIdx=nullptr)
Add a new link: engine + cache.
Definition swmmmodellayer.cpp:5742
bool nodeIsInlet(int soaIdx) const
True when cached node soaIdx is an inlet junction. An inlet junction is also a virtual junction,...
Definition swmmmodellayer.h:1672
static constexpr Category CatSubcatchments
Definition swmmmodellayer.h:165
bool applyHydrographSetRtk(const QString &name, int month, int response, double r, double t, double k)
Definition swmmmodellayer.cpp:6477
void setRainGageSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2575
OpenSWMM::Render::IFeatureRenderer * renderer() const override
The IFeatureRenderer for this layer.
Definition swmmmodellayer.cpp:2694
void setLinkArrowOnlyWhenFlowPos(Category c, bool onlyPos)
Definition swmmmodellayer.cpp:2861
bool findObjectLocation(const QString &name, Category *cat, int *row) const
Locate an object by name, returning true and writing cat + row on success. O(1) hash lookup against t...
Definition swmmmodellayer.cpp:2378
bool pushInletUsageEdit(const SWMM_InletUsage &usage)
Apply one inlet-usage row as a single undoable step. Pushes a SetInletUsageCommand on the edit canvas...
Definition swmmmodellayer.cpp:5544
int cachedNodeCount() const
Cached top-level object counts (all node/link kinds summed). Convenience for load-summary logging.
Definition swmmmodellayer.cpp:4315
int objectTypeFor(const QString &name) const
Classify a name into its SWMM object class via O(1) lookup against m_objectLocation.
Definition swmmmodellayer.cpp:4195
bool cachedGageCoord(int idx, double *x, double *y) const
A rain gage's coordinate AS THE ENGINE STORES IT.
Definition swmmmodellayer.cpp:4319
bool applyHydrographAddGroup(const QString &name, const QString &gageName, int initialResponse)
Definition swmmmodellayer.cpp:6382
int setOptions(const QMap< QByteArray, QString > &values)
Batch write — applies a set of key/value pairs, then emits optionsChanged(changedKeys) once....
Definition swmmmodellayer.cpp:4563
QVector< int > defaultObjectOrder(Category cat) const
Definition swmmmodellayer.cpp:2197
static constexpr Category CatRainGages
Definition swmmmodellayer.h:166
double linkArrowSize(Category c) const
Definition swmmmodellayer.cpp:2761
static QString kindKey(Category c)
Definition swmmmodellayer.cpp:2890
quint64 geomRevision() const
Definition swmmmodellayer.h:1345
QString dataObjectNameAt(DataCategory c, int row) const
Slice BM.0 — name of a non-spatial data object at (category, row), or an empty string when out of ran...
Definition swmmmodellayer.cpp:1811
bool applyInsertJunctionSplit(const QString &linkName, double t, const QString &newNodeName, const QString &newLinkName, int *outNodeIdx=nullptr, int *outLinkIdx=nullptr, QString *outError=nullptr)
Split conduit linkName at t inserting a PLAIN junction, via swmm_conduit_split with make_virtual = 0....
Definition swmmmodellayer.cpp:5211
void setSelectedElementNames(const QStringList &names)
Selects network elements by name (replaces prior selection). Legacy name-only form: each name selects...
Definition swmmmodellayer.cpp:3600
void setEditCanvas(MapCanvas *canvas)
Bind the canvas whose undo stack mediated edits push onto.
Definition swmmmodellayer.cpp:5541
QStringList subcatchmentsInRect(double canvasMinX, double canvasMinY, double canvasMaxX, double canvasMaxY) const
Names of all subcatchments whose polygon bbox overlaps the canvas-CRS rectangle. Same caching pattern...
Definition swmmmodellayer.cpp:8903
bool applyLinkXsect(int linkIdx, int shape, double g1, double g2, double g3, double g4)
Slice SC.1 — Write a cross-section to a link via swmm_link_set_xsect. Emits attributeChanged(linkName...
Definition swmmmodellayer.cpp:4787
bool applyRename(const QString &oldName, const QString &newName, quint8 kindHint=kKindAll)
Rename any network element (node, link, subcatchment, or gage).
Definition swmmmodellayer.cpp:5997
void invalidateDataObjectCache()
Definition swmmmodellayer.h:2814
bool applyHydrographRenameGroup(const QString &oldName, const QString &newName)
Definition swmmmodellayer.cpp:6421
void setRenderer(std::unique_ptr< OpenSWMM::Render::IFeatureRenderer > r) override
Replaces the current renderer.
Definition swmmmodellayer.cpp:2699
int cachedLinkCount() const
Definition swmmmodellayer.cpp:4316
bool applyGageAdd(const QString &name, double x, double y, int *outIdx=nullptr)
Definition swmmmodellayer.cpp:5869
OpenSWMM::Render::RuleList * ruleList() override
Definition swmmmodellayer.cpp:3074
bool applySetInletUsage(const SWMM_InletUsage &usage, QString *outError=nullptr)
Create or replace the usage row for usage's host via swmm_inlet_usage_set. Emits attributeChanged for...
Definition swmmmodellayer.cpp:5360
static constexpr Category CatConduits
Definition swmmmodellayer.h:160
QVariantMap identifyAt(double mapX, double mapY, const SpatialReferenceSystem *canvasSRS, double tolerance=1e-6) const
Returns attributes of the network element closest to the map point.
Definition swmmmodellayer.cpp:3868
QStringList linksInPolygon(const QPolygonF &canvasPoly) const
Definition swmmmodellayer.cpp:8987
bool applyHydrographRemoveGroup(const QString &name)
Definition swmmmodellayer.cpp:6408
void showNodesChanged(bool show)
SWMMElementSymbol subcatchmentSymbol() const
Definition swmmmodellayer.cpp:2532
QString suggestUniqueDataObjectName(DataCategory c) const
Slice DA.3 — suggest a unique default name for the next new data object of c. Scans existing names an...
Definition swmmmodellayer.cpp:1911
HydrographIaTableModel * hydrographIaModel()
Definition swmmmodellayer.cpp:6564
bool applySubcatchSetGage(int idx, const QString &gageName)
Assign a rain gage to a subcatchment: engine + change notification.
Definition swmmmodellayer.cpp:6446
QObject * ensureLandUseRegistry()
Lazy accessor for the project-scoped LandUseRegistry.
Definition swmmmodellayer.cpp:7099
void setCategoryOpacity(Category c, qreal opacity)
Definition swmmmodellayer.cpp:2367
void showSubcatchmentsChanged(bool show)
QObject * ensureLidControlRegistry()
Lazy accessor for the project-scoped LidControlRegistry.
Definition swmmmodellayer.cpp:7211
void setJunctionSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2557
void setShowNodes(bool show)
Definition swmmmodellayer.cpp:1386
void setShowLinks(bool show)
Definition swmmmodellayer.cpp:1390
bool applySubcatchVertices(int idx, const QVector< QPointF > &vertices)
Replace a subcatchment's polygon vertices: engine + cache. Recomputes the centroid as the vertex aver...
Definition swmmmodellayer.cpp:7490
bool renderLinkHidden(int idx) const
The hidden flag the renderers read for link idx — what actually decides whether the base link pass em...
Definition swmmmodellayer.h:1297
QVector< QPointF > cachedLinkPolyline(int idx) const
Cached layer-CRS polyline of a link by index, including the endpoint coordinates of its from/to nodes...
Definition swmmmodellayer.cpp:4279
void hydrographChanged(const QString &uhName)
bool createDataObject(DataCategory c, const QString &name, const QVariantMap &options, QString *outError=nullptr)
Create a new data object on the engine (DB.4b).
Definition swmmmodellayer.cpp:2011
SWMMElementSymbol rainGageSymbol() const
Definition swmmmodellayer.cpp:2533
void setDividerSymbol(const SWMMElementSymbol &s)
Definition swmmmodellayer.cpp:2560
double featureOffset(Category c, int idx) const
Definition swmmmodellayer.cpp:3288
const QVector< InletConnector > & inletConnectors() const
The connector overlay geometry, rebuilt on demand when the usage rows or the geometry changed....
Definition swmmmodellayer.cpp:5569
QVector< QPair< QString, QString > > extendedMetadata() const override
Ordered key→value pairs of TYPE-SPECIFIC metadata, rendered by the Metadata tab below the common bloc...
Definition swmmmodellayer.cpp:667
Qt::CheckState categoryCheckState(Category c) const
Aggregate check state for a category: Checked when every member is visible, Unchecked when every memb...
Definition swmmmodellayer.cpp:2258
QObject * ensureSnowpackRegistry()
Lazy accessor for the project-scoped SnowpackRegistry.
Definition swmmmodellayer.cpp:7155
bool applyRdiiDecayRemove(const QString &name, int response)
Definition swmmmodellayer.cpp:6540
SWMMElementSymbol outletSymbol() const
Definition swmmmodellayer.cpp:2531
bool rollbackTailNodeAdd(const QString &name)
Undo an add by removing the tail entry of the node cache.
Definition swmmmodellayer.cpp:5712
void transectChanged(const QString &transectName)
Represents a coordinate reference system backed by a GDAL OGRSpatialReference.
Definition spatialreferencesystem.h:28
Definition swmmelementsymboladapter.h:30
Definition userflagsmodel.h:32
DiagramType t
Definition diagramspec.cpp:20
int code
Definition heatconfigdialog.cpp:40
Layer-side seam for "what attributes can I theme by?" — Slice DM.1.
QString nodeName
Definition importplanning.cpp:95
double s
Scene px per model length unit.
Definition inletdrawingview.cpp:82
QGraphicsScene * scene
Definition inletdrawingview.cpp:78
int e
Definition inpmeshreader.cpp:41
Shared label-configuration value-type used by every layer that paints text labels.
One row in a layer's legend — label + swatch symbol + optional range.
MarkerShape shape
Definition markershape.cpp:27
Canonical 19-shape enum used by Marker Symbol Layers (Slice Z.4; extended set appended later).
std::vector< double > cx
Definition mesh2dresultsexport.cpp:103
std::vector< double > cy
area centroid per cell
Definition mesh2dresultsexport.cpp:103
std::vector< mesh::MeshTriangle > cells
Definition mesh2dresultsexport.cpp:102
int k
Definition mesh2dresultsexport.cpp:549
const char * key
Definition meshcellparams.cpp:24
double length
Definition meshpatch.cpp:64
Definition gisrasterlayer.h:40
ClassEditKind
Categories of per-class mutation that a renderer may support.
Definition ifeaturerenderer.h:64
MarkerShape
13 canonical marker shapes the Rule Model's Marker Symbol Layer supports (per RENDERING_RULE_MODEL_PL...
Definition markershape.h:53
Definition gwsourcesummary.h:21
SwmmCategory
Stable ordinal categorising every SWMM-element kind that has per-kind styling, per-kind tree rows,...
Definition swmm_category.h:28
Definition openswmmvislayer.h:43
void * SWMM_Engine
Definition objectdefaultsapplier.h:19
Abstract base class for all map layers displayed in the MapCanvas.
int path
Definition pslgminsize.cpp:234
QVector< int > parent
union-find
Definition pslgminsize.cpp:176
TokenKind kind
Definition queryparser.cpp:34
QString name
Definition sectionmodelbuilders.cpp:474
Per-layer label rendering parameters.
Definition labelconfig.h:47
Definition preferencesmanager.h:424
Definition preferencesmanager.h:504
Rendering style for a class of SWMM network elements.
Definition swmmmodellayer.h:77
QColor outlineColor
Definition swmmmodellayer.h:79
QColor fillColor
Definition swmmmodellayer.h:78
double size
Definition swmmmodellayer.h:81
double arrowSize
Definition swmmmodellayer.h:101
bool showArrows
Definition swmmmodellayer.h:100
QFont labelFont
Definition swmmmodellayer.h:88
QColor labelColor
Definition swmmmodellayer.h:89
bool arrowOnlyWhenFlowPos
Definition swmmmodellayer.h:115
bool showLabel
Definition swmmmodellayer.h:87
OpenSWMM::Render::MarkerShape markerShape
Definition swmmmodellayer.h:83
QColor arrowColor
Definition swmmmodellayer.h:109
double arrowWidth
Definition swmmmodellayer.h:108
double outlineWidth
Definition swmmmodellayer.h:80
Definition swmmmodellayer.cpp:236
Definition swmmmodellayer.h:1728
QPointF capture
capture (underdrain) node position
Definition swmmmodellayer.h:1730
QPointF host
conduit midpoint (link host) or node position
Definition swmmmodellayer.h:1729
Everything a blank untitled project needs — the in-memory replacement for the synthetic temp ....
Definition swmmmodellayer.h:296
QString name
"[TITLE]" + display name ("Untitled").
Definition swmmmodellayer.h:297
PreferencesManager::TwoDDefaults twoD
Used iff forNewEngine && sim.module2DEnabled.
Definition swmmmodellayer.h:302
QDateTime endDateTime
Definition swmmmodellayer.h:299
QDateTime startDateTime
Definition swmmmodellayer.h:298
bool forNewEngine
Gate NODE_CONTINUITY / ANDERSON_ACCEL / 2D.
Definition swmmmodellayer.h:300
PreferencesManager::SimulationDefaults sim
THREADS already maxed by caller.
Definition swmmmodellayer.h:301
Tool-facing click-pick result. valid is false when no feature was hit within tolerance of the canvas-...
Definition swmmmodellayer.h:1421
Category cat
Definition swmmmodellayer.h:1423
QString name
Definition swmmmodellayer.h:1425
int soaIndex
Definition swmmmodellayer.h:1424
bool valid
Definition swmmmodellayer.h:1422
One selected element: its name plus a bitmask of the kinds (kKind*) the selection applies to....
Definition swmmmodellayer.h:994
bool operator==(const SelectedElement &o) const
Definition swmmmodellayer.h:997
quint8 kinds
Definition swmmmodellayer.h:996
QString name
Definition swmmmodellayer.h:995
Standalone definition of the SWMM-element Category enum used by per-Category APIs across layers,...