LuciadCPillar C# 2023.1.04
|
Factory to create all patterns that are used to create complex strokes. More...
Factory to create all patterns that are used to create complex strokes.
2023.1
|
inlinestatic |
Creates a pattern that allows for overlap of patterns on the left and right side of the given pattern.
Note that the given pattern must be a pattern with a fixed (non-relative) length for the overlap to work. In the following examples, two half circles are painted next to each other. This is done twice. The first time, no overlap is allowed. The second time, overlap is allowed: Sample code:
Results in: allowOverlap example
pattern
the pattern to allow overlaps.
overlapLeft
The allowed overlap on the left, in pixels.
overlapRight
The allowed overlap on the right, in pixels.
A pattern that allows overlap with other patterns.
luciad::InvalidArgumentException
overlapLeft and overlapRight must be >=0.
|
inlinestatic |
Creates a pattern consisting of multiple sub-patterns appended together, painting them next to each other.
Sample code:
Results in: appendPatterns example
patterns
patterns to append, may not be empty.
a new pattern consisting of the appended patterns.
luciad::InvalidArgumentException
patterns may not be empty.
|
inlinestatic |
Creates a builder used to make patterns with an arc, ellipse or circle shape.
You can define the length and minor radius to create an ellipse (or a circle by setting the minor radius to be half of the length), and use the angle and startAngle to paint only a part of the ellipse. angle and startAngle work counter clockwise and a startAngle of 0 means the arc starts on the baseline on the point the furthest from the start of the baselise. On a horizontal line going from left to right, this would be the right-most point of the arc. A startAngle of 90 in this case means the arc starts above the baseline. Sample code:
Results in: arc pattern example
the pattern builder.
|
inlinestatic |
Creates a builder used to make patterns with an arrow shape.
Sample code:
Results in: arrow pattern example
the pattern builder.
|
inlinestatic |
Creates a pattern that ensures that sub-patterns are always painted together.
By making a composed pattern (compose, append, repeat,...) atomic, you ensure that the composed pattern is never broken apart during painting. The sub-patterns will always be painted together, or not at all. In the example image, the circle patterns are appended. When they are not atomic, the sub-patterns of the appendPattern can be dropped individually. This is what happens in the first pattern. If there is not enough room for a circle to be placed, it is dropped. However, in an atomic pattern, all sub-patterns of the appendPattern are dropped together if one of them does not have enough space. This is useful when you are appending multiple patterns, where it is important that all sub-patterns are always visible at the same time. Sample code:
Results in: atomic pattern example
pattern
The pattern to make atomic.
An atomic version of the pattern.
|
inlinestatic |
Creates a pattern that allows the fallback pattern to be painted on top of the given pattern.
Normally, a fallback pattern is only painted where no other pattern could be painted. This pattern wrapper adds an exception to this. When a pattern is wrapped with a combineWithFallback, this pattern can be painted in addition to a fallback pattern. This is useful when adding a non-filled arrowhead, as in the image example. Sample code:
Results in: combineWithFallback pattern example
pattern
The pattern to combine with the fallback pattern.
a pattern that allows the fallback pattern to be combined with this pattern.
|
inlinestatic |
Creates a pattern that allows the regular pattern to be painted on top of the given pattern.
A regular pattern is a pattern that is repeated along the whole line. Normally, a regular pattern is only painted where no decorations could be painted. This pattern wrapper adds an exception to this. When a pattern is wrapped with a combineWithRegular pattern, the pattern can be painted in addition to the regular pattern. This is useful for adding a non-filled arrowhead,as in the example. In the example there is still a small gap. This is because regular patterns don't get cut off but get dropped instead, while fallback patterns do get cut off. Note that using this pattern wrapper implies that a fallback pattern can be painted as well (if part of the regular pattern cannot be painted). Also note that if no regular pattern is specified, then this pattern is combined with the fallback pattern instead, as if you are using combineWithFallback. Sample code:
Results in: combineWithRegular pattern example
pattern
The pattern to combine with the regular pattern.
a pattern that allows the regular pattern to be combined with this pattern.
|
inlinestatic |
Creates a pattern consisting of multiple sub-patterns that are painted on top of each other.
If one of the strokes has a different length than the other strokes, it is aligned to the center of the largest stroke. In the following example, a horizontal red line and half a red circle are composed. Sample code:
Results in: composePatterns example
patterns
patterns to compose, may not be empty.
A new pattern that composes a number of sub-patterns.
luciad::InvalidArgumentException
patterns may not be empty.
|
inlinestatic |
Creates a gap pattern, which does not paint anything.
A gap pattern occupies space only. It can be used to add space in between other strokes. Sample code:
Results in: fixed length gap pattern example
fixedLength
the length of the gap in pixels.
a gap pattern.
luciad::InvalidArgumentException
fixedLength must be >=0.
|
inlinestatic |
Creates a gap pattern, which does not paint anything.
A gap pattern occupies space only. It can be used to add space in between other strokes. Sample code:
Results in: relative length gap pattern example
relativeLength
the length (relative to the length of the entire line, [0,1]) of the gap.
a gap pattern.
luciad::InvalidArgumentException
relativeLength must be in range [0,1].
|
inlinestatic |
Creates a builder used to make patterns containing an icon.
The icon must be set by calling the icon method before calling build. All other methods are optional. Sample code:
Results in: icon pattern example
the pattern builder.
|
inlinestatic |
Creates a builder used to make patterns with a line segment shape.
A line segment is defined by:
a length, meaning the distance between its start and end points
the offsets of the start and end points with respect to the base line.
styling properties: the width and color
Note that the difference with a parallel line is that a line has rounded corners, whereas a parallel line does not have rounded corners. Sample code:
Results in: lineBuilder example
the pattern builder.
|
inlinestatic |
Creates a builder used to make patterns with a line segment shape that is parallel to the base line.
Note that the difference with a line is that a line has rounded corners, whereas a parallel line does not have rounded corners. Sample code:
Results in: parallelLine pattern example
the pattern builder.
|
inlinestatic |
Creates a builder used to make patterns with a polyline shape.
The polyline's points must be set by calling the points method before calling build. All other methods are optional. Sample code:
Results in: polyline pattern example
the pattern builder.
|
inlinestatic |
Creates a builder used to make patterns with a rectangle shape.
Sample code:
Results in: rectangle pattern example
the pattern builder.
|
inlinestatic |
Creates a pattern that repeats a pattern a fixed number of times.
Note that with this pattern, there is no guarantee that the given number of patterns is actually painted. This also depends on the line on which the complex stroke is painted. For example, if the line is too short, not all of the patterns may fit on it. If one of the repeated patterns crosses a sharp corner, it may be omitted as well. In that case, the regular or fallback patterns may be painted instead. In the following example, a circular arc pattern is repeated 3 times: Sample code:
Results in: repeat pattern example
pattern
the pattern to repeat.
count
the number of times to repeat the pattern. Must be greater than or equal to 1.
pattern that repeats another pattern a fixed number of times.
|
inlinestatic |
Creates a pattern that repeats a pattern over a given length.
This length is a fixed length (in pixels). Sample code:
Results in: repeatOverLengthFixed pattern example
pattern
the pattern to repeat.
fixedLength
the length (in pixels) over which the pattern should be repeated.
A pattern that repeats another pattern over a given length.
luciad::InvalidArgumentException
fixedLength must be >0.
|
inlinestatic |
Creates a pattern that repeats the given pattern over a given length.
This is a length relative to the length of the line. Sample code:
Results in: repeatOverLengthRelative pattern example
pattern
the pattern to repeat.
relativeLength
the length (relative to the length of the entire line, [0,1]) over which the pattern should be repeated.
A pattern that repeats another pattern over a given length.
luciad::InvalidArgumentException
relativeLength must be in range [0,1].
|
inlinestatic |
Creates a builder used to make patterns containing text.
The text must be set by calling a text method before calling build. All other methods are optional. Sample code:
Results in: text pattern example
the pattern builder.
|
inlinestatic |
Creates a builder used to make patterns with a triangle shape.
Sample code:
Results in: triangle pattern example
the pattern builder.
|
inlinestatic |
Creates a builder used to make patterns with a wave shape.
More specifically, the wave shape follows a sine wave. Which part of the sine wave gets painted is determined by angle and startAngle. The amplitude (height) is set with amplitude. The wave is stretched over the given length. In the first image below, we have horizontal lines going from left to right. As you see, a regular wave first goes up (or to the left of the baseline, if looking at it from the baseline's start towards the end), then back to the baseline, repeating the same shape below the baseline (i.e. to the right of the baseline when looking from the baseline's start). The second wave is broken down in four separate colored segments each with an angle of 90, but with different startAngles. wave pattern chopped in four segments Created by the following code:
Note that, unlike most patterns, the wave can be partially drawn even as a regular or decoration pattern when there is not enough space and other patterns would be omitted in full. By making the wave atomic only the full wave pattern will be drawn. Sample code:
Results in: wave pattern example
the pattern builder.