Module

LinesOverlay/doc

From Dogcraft Wiki

No edit summary
No edit summary
Line 60: Line 60:
| <code>icon 845,-512 fa-solid fa-sailboat fa-house</code> || <i class="fa-solid fa-sailboat fa-house" style="color: red;"></i> Located at coordinates X:845, Z:-512 <sup>1</sup>
| <code>icon 845,-512 fa-solid fa-sailboat fa-house</code> || <i class="fa-solid fa-sailboat fa-house" style="color: red;"></i> Located at coordinates X:845, Z:-512 <sup>1</sup>
|-
|-
| <code>icon 845,-512 fa-solid fa-sailboat green</code> || <i class="fa-solid fa-sailboat green"></i> Located at coordinates X:845, Z:-512 <sup>2</sup>
| <code>icon 845,-512 fa-solid fa-sailboat green</code> || <i class="fa-solid fa-sailboat green" style="color: green;"></i> Located at coordinates X:845, Z:-512 <sup>2</sup>
|-
|-
| <code>icon 845,-512 fa-solid fa-sailboat otherclass</code> || <i class="fa-solid fa-sailboat otherclass" style="color: red;"></i> Located at coordinates X:845, Z:-512 <sup>2</sup>
| <code>icon 845,-512 fa-solid fa-sailboat otherclass</code> || <i class="fa-solid fa-sailboat otherclass" style="color: red;"></i> Located at coordinates X:845, Z:-512 <sup>2</sup>
Line 66: Line 66:
<sup>1</sup> Note that multiple different icons overwrite each other and only one of the icon classes will have effect, thus only showing one icon.<br>
<sup>1</sup> Note that multiple different icons overwrite each other and only one of the icon classes will have effect, thus only showing one icon.<br>
<sup>2</sup> Note that the class "otherclass" is not styled in any way on this page and thus has no effect. The class green sets the color to green, thus changing the color of the icon.
<sup>2</sup> Note that the class "otherclass" is not styled in any way on this page and thus has no effect. The class green sets the color to green, thus changing the color of the icon.


==== Lines ====
==== Lines ====
Lines use the identifier <code>line</code> and accept first a color and width block and after that an arbitrary number of coordinate blocks.<br>
The color and width block consists of a valid css color and a number for the line width (thickness) separated by a colon ':'.<br>
Specifying the width is optional and defaults to 5.<br>
CSS colors can be a word (eg "green"), a hex color (eg "#ff0000"), a rgb color (eg "rgb(255, 0, 0)"), or a rgba color (eg "rgba(255, 0, 0, 0.5)"). Please check the internet for examples or a list of available color names.<br>
The following coordinate blocks are read left to right and the line is drawn in segments from point to point.<br>
All coordinate blocks on the same ''line'' of text will be used to draw a '''single''' visible line.<br>
To draw a line splitting to 2 lines, you can either specify them as 2 lines (the starting line continuing after the split as one of the two ends and the other end as a separate line) or as 3 lines (the starting line and 2 separate ends).<br>
Lines can cross, overlap and coincide arbitrarily. Multiple lines can also have points at the exact same coordinates.<br>

Revision as of 14:02, 21 March 2024

The {{LinesOverlay}} template uses Module:LinesOverlay to draw lines and place icons based on coordinates. This is intended for marking connections and facilities of the transport networks on the Dogcraft Server to be overlayed on a map. This module uses line by line markup for generating the lines and icons.

This template is intended to be used to create an overlay to be overlayed on a map, but can still be used for other purposes if so desired. The lines it creates are not particularly nice at sharp corners, as due to the limitations of Mediawiki lines are drawn with html <div> elements.

Usage

This template can generate a effectively unlimited number of lines and/or icons. It is important to note however, that this template only accepts a single parameter: a block of text of special markup.

Template opener

Open a LinesOverlay template with the template identifier: {{LinesOverlay|

Lines Overlay Markup

The markup is parsed line by line, meaning that every line of text given to the template acts as one parameter.
Please note that spaces ' ' and line breaks '\n' are significant in markup for this template and should only be used where needed. Generally pieces of information are sperated by a single space ' ' in this templates markup and each line of markup acts like a parameter and provides a full set of information for one element. Every line begins with a line identifier and this is followed by information for this identifier.

This template accepts 3 types of information in markup: info, icon and line

Coordinate blocks

The template markup accepts many sets of coordinates, which are all specified as a coordinate block.
A coordinate block consists of a X and a Z coordinate separated by a comma ','.
For example the coordinates X:500, Z:300 translate to the following coordinate block: 500,300


The info line

info is an optional line that can be specified in markup. If used, this line should be the first under the template opener.
The info line can set a coordinate offset and a specific size and thus aspect ratio of the output.
The info line begins with the info identifier, which is followed by 2 coordinate blocks.
The first coordinate block specifies offset coordinates for the output, which sets the top-left corner of the output to the given coordinates. The default for this is 0,0.
The second coordinate block specifies a custom size of the output. The x coordinate in this case specifies width and the z coordinate specifies height. The default for this is 500,500.

Example

info 500,-1000 1000,500
This will set the top-left corner of the output to be at coordinates X:500, Z:-1000 and will set the width of the output to be 1000 and the height to be 500, making the output twice as wide as it is high.


Icons

In addition to drawing lines, you can also place specific icons at specific coordinates with this template.
There are 4 predefined icons and you have the ability to specify a custom FontAwesome icon as well.
The 4 predefined icons are:
station
port
shelter
portal

The predefined icons use the identifier shown above and accept a single coordinate block after the identifier. This coordinate block specifies the coordinates where the icon will be located.

A custom icon can be specified using the icon identifier.
This identifier accepts 1 coordinate block and after that a unspecified number of css class names. This can be used with FontAwesome classes to specify an arbitrary icon.
The coordinate block, similar to the predefined icons, specifies the coordinates at which the icon will be located.
The css class names are inserted into the class attribute of a <i> html tag. If FontAwesome classes are used here, this can result in a FontAwesome icon being displayed.

Example
Markup Result
station 500,354 Located at coordinates X:500, Z:354
icon 500,354 fa-solid fa-door-open Located at coordinates X:500, Z:354
icon 845,-512 fa-solid fa-sailboat fa-house Located at coordinates X:845, Z:-512 1
icon 845,-512 fa-solid fa-sailboat green Located at coordinates X:845, Z:-512 2
icon 845,-512 fa-solid fa-sailboat otherclass Located at coordinates X:845, Z:-512 2

1 Note that multiple different icons overwrite each other and only one of the icon classes will have effect, thus only showing one icon.
2 Note that the class "otherclass" is not styled in any way on this page and thus has no effect. The class green sets the color to green, thus changing the color of the icon.


Lines

Lines use the identifier line and accept first a color and width block and after that an arbitrary number of coordinate blocks.
The color and width block consists of a valid css color and a number for the line width (thickness) separated by a colon ':'.
Specifying the width is optional and defaults to 5.
CSS colors can be a word (eg "green"), a hex color (eg "#ff0000"), a rgb color (eg "rgb(255, 0, 0)"), or a rgba color (eg "rgba(255, 0, 0, 0.5)"). Please check the internet for examples or a list of available color names.

The following coordinate blocks are read left to right and the line is drawn in segments from point to point.
All coordinate blocks on the same line of text will be used to draw a single visible line.
To draw a line splitting to 2 lines, you can either specify them as 2 lines (the starting line continuing after the split as one of the two ends and the other end as a separate line) or as 3 lines (the starting line and 2 separate ends).
Lines can cross, overlap and coincide arbitrarily. Multiple lines can also have points at the exact same coordinates.

This page was last modified on 21 March 2024, at 14:02. (7 months ago)