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
linesymbollayer.h
Go to the documentation of this file.
1
52#ifndef OPENSWMM_RENDER_LINESYMBOLLAYER_H
53#define OPENSWMM_RENDER_LINESYMBOLLAYER_H
54
55#include "render/symbollayer.h"
56
57#include <QColor>
58#include <QFont>
59#include <QPen>
60#include <QPolygonF>
61#include <QVector>
62
63class QPainter;
64
65namespace OpenSWMM::Render
66{
67
72enum class ArrowPlacement : int {
73 End = 0,
74 Both = 1,
75 Centered = 2,
76 RepeatEveryNPx = 3,
77 AtVertices = 4
78};
79
80[[nodiscard]] QString arrowPlacementToString(ArrowPlacement p);
81[[nodiscard]] ArrowPlacement arrowPlacementFromString(const QString &s);
82
93{
94 QColor color = QColor(40, 40, 40);
95 qreal lengthPx = 8.0;
96 qreal widthPx = 6.0;
98 qreal spacingPx = 40.0;
99 bool reverse = false;
100};
101
107{
108 QColor color = QColor(60, 120, 200);
109 qreal width = 1.0;
110 Qt::PenStyle penStyle = Qt::SolidLine;
111 Qt::PenCapStyle capStyle = Qt::FlatCap;
112 Qt::PenJoinStyle joinStyle = Qt::BevelJoin;
117 QVector<qreal> customDash;
120 qreal offsetPx = 0.0;
121
122 bool drawArrows = false;
124
125 // Slice SS.3 — SWMM-specific arrow gate. When true, the painter
126 // (SWMMLayerItem / FeatureSublayer) suppresses the arrow head
127 // unless the link's current flow value is positive. Mirrors the
128 // legacy SWMMElementSymbol::arrowOnlyWhenFlowPos field.
130
131 // Slice SS.3 — label fields parallel to SWMMElementSymbol so the
132 // Single Symbol panel's label group round-trips through the
133 // SymbolLayer prop bag for line categories. The painter still
134 // reads labels from the legacy fields; back-propagation (SS.4 /
135 // SS.5) copies these onto those legacy fields on rule edit.
136 bool showLabel = false;
137 QFont labelFont = QFont();
138 QColor labelColor = QColor(0, 0, 0);
139
144 [[nodiscard]] QPen toQPen() const;
145
148 [[nodiscard]] SymbolLayer toSymbolLayer() const;
149
153 [[nodiscard]] static LineSymbolLayerSpec fromSymbolLayer(const SymbolLayer &layer);
154
158 void writeToSymbolLayer(SymbolLayer &layer) const;
159};
160
173void drawArrowsAlongPolyline(QPainter *painter,
174 const QPolygonF &polyline,
175 const LineArrowSpec &spec);
176
177} // namespace OpenSWMM::Render
178
179#endif // OPENSWMM_RENDER_LINESYMBOLLAYER_H
double s
Scene px per model length unit.
Definition inletdrawingview.cpp:82
ArrowPlacement p
Definition linesymbollayer.cpp:27
Definition gisrasterlayer.h:40
ArrowPlacement arrowPlacementFromString(const QString &s)
Definition linesymbollayer.cpp:111
void drawArrowsAlongPolyline(QPainter *painter, const QPolygonF &polyline, const LineArrowSpec &spec)
Paint directional arrows along polyline per spec.
Definition linesymbollayer.cpp:226
ArrowPlacement
Where directional arrows are painted along a polyline.
Definition linesymbollayer.h:72
QString arrowPlacementToString(ArrowPlacement p)
Definition linesymbollayer.cpp:104
Directional-arrow parameters attached to a Line Symbol Layer.
Definition linesymbollayer.h:93
qreal widthPx
Definition linesymbollayer.h:96
qreal spacingPx
Definition linesymbollayer.h:98
qreal lengthPx
Definition linesymbollayer.h:95
QColor color
Definition linesymbollayer.h:94
bool reverse
Definition linesymbollayer.h:99
ArrowPlacement placement
Definition linesymbollayer.h:97
Typed snapshot of a SimpleLine / MarkerLine SymbolLayer's props.
Definition linesymbollayer.h:107
QFont labelFont
Definition linesymbollayer.h:137
Qt::PenStyle penStyle
Definition linesymbollayer.h:110
QVector< qreal > customDash
Definition linesymbollayer.h:117
QPen toQPen() const
Compose the line QPen from the typed fields. When penStyle == Qt::CustomDashLine and customDash is no...
Definition linesymbollayer.cpp:118
LineArrowSpec arrows
Definition linesymbollayer.h:123
bool showLabel
Definition linesymbollayer.h:136
SymbolLayer toSymbolLayer() const
Build a SymbolLayer (kind = SimpleLine, or MarkerLine when drawArrows is true) from this spec.
Definition linesymbollayer.cpp:134
QColor labelColor
Definition linesymbollayer.h:138
bool arrowOnlyWhenFlowPos
Definition linesymbollayer.h:129
Qt::PenJoinStyle joinStyle
Definition linesymbollayer.h:112
bool drawArrows
Definition linesymbollayer.h:122
qreal width
Definition linesymbollayer.h:109
qreal offsetPx
Definition linesymbollayer.h:120
Qt::PenCapStyle capStyle
Definition linesymbollayer.h:111
QColor color
Definition linesymbollayer.h:108
static LineSymbolLayerSpec fromSymbolLayer(const SymbolLayer &layer)
Read a spec from layer's props. Missing keys fall back to defaults. Tolerant of partial input — field...
Definition linesymbollayer.cpp:141
void writeToSymbolLayer(SymbolLayer &layer) const
Write this spec back into layer's props. layer.kind is set to SimpleLine when drawArrows is false,...
Definition linesymbollayer.cpp:197
One paint pass in the SymbolStyle stack.
Definition symbollayer.h:90
One paint pass in a compositional SymbolStyle stack.