Contents |
When the shape is set to custom, the shape-def property defines how the custom shape or shield symbols will look like.
shape-def consists of a set of drawing commands. You can think of these commands as instructing a virtual plotter to draw something by telling it where to move its plotter head, what colors to use etc. The supported commands are:
Example of a shape definition which renders a blue oval rectangle:
shape-def : p:blue;pw:7;f:blue;m:-10,-10;l:10,-10;a:10,10,10,10;l:-10,10;a:10,10,-10,-10;z
A semicolon (';') is used to delimit commands. The first part (before the colon) of each command specifies the command type. After the colon the command arguments are specified (delimited with commas).
In the above example we specify the following commands:
The coordinates must be integers. The coordinates are relative to the largest absolute coordinate value. In the case of our sample shape above, the largest absolute coordinate value is 10 and all the other coordinates are then calculated as percentages of that value.
In case of a shape symbol or if you use use the fixed shield-resize-mode for shields, the coordinates are then multiplied with the ShapeSize (TODO) value to get the actual pixel coordinates (for the y-axis, the ShapeAspect (TODO) is also used).
So in the case of a shape of an arrow
define shape : custom shape-def : -60,0;-20,-40;-20,-15;60,-15;60,15;-20,15;-20,40;Z shape-size : 10 shape-aspect : 0.5 draw : shape
the resulting arrow will have the nominal width of 10 pixels and height of 3 pixels (40 / 60 * 10 * 0.5).
In case of a shield symbol (when you don't have the fixed shield-resize-mode), the size of the shape will be determined automatically based on the size of the text and other shield-related properties.
If no styling commands are specified in the shape definition, it will use the styling defined in the rules for this particular shape symbol.
Using any of the styling commands (like setting the pen color) will automatically finish processing of any previous shape (so you cannot have a single polygon with two different border styles, for example).
Format: m : x, y
Moves the pen to the point (x, y).
Example:
m:20,-10
Format: l : x1, y1, x2, y2, ... xN, yN
Draws a series of lines specified specified by the coordinates. If the pen was moved before this command, the first line starts from that initial point.
Example:
l:20,-10,20,10,30,-10
Format: a : rx, ry, x, y
Draws an elliptical arc from the current point to the point (x, y) using an ellipse with horizontal radius of rx and vertical radius of ry.
Example:
a:30,10,-10,-10
Format: z
Closes the existing shape.
Example:
z
Format: f : color, opacity
Sets the color for the subsequent filled polygons. The color is specified using the Web colors syntax (examples: red, #ff00bb). If the color is set to none, polygons will not be filled. opacity parameter is optional and specifies the opacity of the color (see fill-opacity). The default is fully opaque color.
Examples:
f:red f:#ff00bb,0.4
Format: p : color, opacity
Sets the color of the pen. The color is specified using the Web colors syntax (examples: red, #ff00bb). If the color is set to none, polygons will not have a visible border. opacity parameter is optional and specifies the opacity of the color (see fill-opacity). The default is fully opaque color.
Examples:
p:red p:#ff00bb,0.4
Format: pw : width
Sets the width of the pen. The width must be a positive real number.
Examples:
pw:1 pw:5
Format: ps : style
Sets the style of the pen. See line-style for all the possible values.
Examples:
ps:solid ps:dash