PolyLine¶
Overview¶
Class
A curve that consists of one or more chained straight sections.
Supertypes
Attributes (data)
Name |
Multiplicity |
Type |
---|---|---|
2..* |
||
1 |
Geometry¶
The first straight section of a PolyLine starts at its first Point (Points[0]) and ends at its second Point. For each further Point, another section is drawn that starts at the preceding Point.
Example
We consider a PolyLine with 3 Points:
(-30, 40)
,(50, 40)
, and(-10, -60)
.
The PolyLine will look like this:
Mapping to SVG¶
A PolyLine corresponds to an svg:polyline with these attributes:
-
points
contains the Points of the PolyLine.Each Point \(i\) with position \(x_i\) and \(y_i\) is converted to a string as str(\(x_i\)) +
,
+ str(\(y_i\)). Finally, thepoints
attribute is set to a single string that contains all positions, separated by spaces. stroke
,stroke-dasharray
,stroke-dashoffset
andstroke-width
are set according to the SVG mapping rules for the Stroke of the PolyLine (see Stroke).stroke-linecap = "round"
andstroke-linejoin = "round"
reflect the heuristic for line caps and line joins.vector-effect = "non-scaling-stroke"
reflects the heuristic for scaled symbols.fill = "none"
is required to avoid that the svg:polyline is filled.
Implementation in Proteus Schema
A PolyLine is implemented using the Proteus element
<PolyLine>
. A PolyLine with exactly two
Points may alternatively be implemented with
the Proteus element <Line>
.
Example
We assume that the Stroke of the PolyLine above is
2mm #007fff solid
.
<svg
xmlns = "http://www.w3.org/2000/svg"
width = "82mm"
height = "102mm"
viewBox = "-31 -61 82 102">
<polyline
points = "-30,40 50,40 -10,-60"
stroke = "#007fff"
stroke-dasharray = "none"
stroke-dashoffset = "0mm"
stroke-width = "2mm"
stroke-linecap = "round"
stroke-linejoin = "round"
vector-effect = "non-scaling-stroke"
fill = "none"/>
</svg>
Implementation in Proteus Schema
<PolyLine NumPoints = "3">
<Presentation
LineType = "0"
LineWeight = "2"
R = "0"
G = "0.498"
B = "1"/>
<Coordinate X = "-30" Y = "-40"/>
<Coordinate X = "50" Y = "-40"/>
<Coordinate X = "-10" Y = "60"/>
</PolyLine>
Example
We consider the same PolyLine as in the previous example,
except that the Stroke is
2mm #007fff Dash
.
<svg
xmlns = "http://www.w3.org/2000/svg"
width = "82mm"
height = "102mm"
viewBox = "-31 -61 82 102">
<polyline
points = "-30,40 50,40 -10,-60"
stroke = "#007fff"
stroke-dasharray = "10mm 14mm"
stroke-dashoffset = "0mm"
stroke-width = "2mm"
stroke-linecap = "round"
stroke-linejoin = "round"
vector-effect = "non-scaling-stroke"
fill = "none"/>
</svg>
Implementation in Proteus Schema
<PolyLine NumPoints = "3">
<Presentation
LineType = "2"
LineWeight = "2"
R = "0"
G = "0.498"
B = "1"/>
<Coordinate X = "-30" Y = "-40"/>
<Coordinate X = "50" Y = "-40"/>
<Coordinate X = "-10" Y = "60"/>
</PolyLine>
Points¶
Attribute (data)
The points of the PolyLine.
Stroke¶
Attribute (data)
The stroke of the PolyLine.
Multiplicity: 1
Type: Stroke