-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[FEATURE] New line symbol type: Hash line #9644
Conversation
This line symbol type is designed to replicate the ArcGIS Hash Line symbol layer type. It allows for a repeating line segment to be drawn over the length of a feature, with a line-sub symbol used to render each individual segment. To reduce code duplication, this is heavily based off the current line marker symbol layer, since the functionality is almost identical (draw some sub symbol at some interval along a line). Accordingly, I've split off QgsMarkerLineSymbolLayer to move as much of the common functionality as possible to a new abstract base class, so that only the actual marker/line segment rendering occurs in the marker line/hash line subclasses. This also gives the hash line all the existing placement options permissible for marker lines -- e.g. first/last vertex, mid points, regular intervals, etc. The hash line length and angle can have data defined overrides, which are evaluated per-line segment, allowing for the hash line to change size and angle over the length of a single rendered feature.
This is just a direct copy of another test from this file - the actual ring filter test is in Python
Nice one. |
Interesting. Just so that I understand the hashlines correctly: are those always perpendicular to the line segment or bisector angle in case when they are at a vertex? |
For now, it's the same as line marker, so bisector. Coming after this is an option to use an average angle calculated over a set distance, to avoid ugly orientation for jagged lines. |
Here's some more screenshots. Vertex placement mode: Hash angle set to 30 degrees, without rotating hashes to match line direction: Hash angle at 30 degrees, plus rotating to match line direction: Caligraphic/texta pen effect, using a fixed 45 degree angle, with a thick, semi transparent hash line, and a small interval: (or chunky highlighters:) ArcGIS symbols converted using SLYR: |
Thanks for sharing these! Many of the examples you provide would have been possible with the already existing marker line styles - right? But probably with more work and less elegant. How ist the last example, the one with the perpendicular lines, alternating to the left and right, done? Can you influence that every second one changes direction? I like the calligraphic lines, but they would have been possible already with traditional marker lines - right? I used calligraphic lines in Adobe Illustrator, Inkscape and Corel Draw and like them for certain - more artistic - styles. How about performance, when rendering very dense repeats of markers or hashes? |
Right -- if the cross hatches use just a simple line type, then it's mostly possible using a marker line with the | symbol (excluding some advanced settings like line cap styles). But for complex hashed line types it's not possible to replicate. I think even for the common use types like creating rail-line style symbols, is worth having this new layer type to make creation of those symbols easier for users (especially those coming from an ESRI background). Ultimately, with the refactoring done in this PR, the vast bulk of the code is shared between both marker and hash line symbol types, so it doesn't add any significant maintenance burden either.
It's two levels of hashed line, with the same interval but different initial offsets, and with line offsets opposite to each other. I can share a QML if you'd like?
Correct.
It's fine up to a certain threshold. For me (on a slow debug build) it's acceptable down to an interval of about .01 mm, and then below that starts to chug along. I'm not too concerned about that though -- with multi-threaded rendering we still get a responsive QGIS, and someone who really has a need for denser symbols is free to do this and just have slow redraws. Thanks for your feedback here! |
This line symbol type is designed to replicate the ArcGIS Hash Line
symbol layer type. It allows for a repeating line segment to be
drawn over the length of a feature, with a line-sub symbol used
to render each individual segment.
To reduce code duplication, this is heavily based off the current
line marker symbol layer, since the functionality is almost
identical (draw some sub symbol at some interval along a line).
Accordingly, I've split off QgsMarkerLineSymbolLayer to move
as much of the common functionality as possible to a new abstract
base class, so that only the actual marker/line segment rendering
occurs in the marker line/hash line subclasses.
This also gives the hash line all the existing placement options
permissible for marker lines -- e.g. first/last vertex, mid points,
regular intervals, etc.
The hash line length and angle can have data defined overrides,
which are evaluated per-line segment, allowing for the hash line
to change size and angle over the length of a single rendered
feature.
Some screenshots:
With data defined hash length:
Complex symbol, using multi-level hash sub symbol:
"meta" symbol, using hashed lines with hashed line sub symbols! (For reference: ArcGIS chokes on this)