Add gps track line, add documentation
This commit is contained in:
parent
7b7076168f
commit
d3d51af667
18 changed files with 278 additions and 145 deletions
|
@ -27,6 +27,22 @@ export default interface LineRenderingConfigJson {
|
|||
*/
|
||||
dashArray?: string | TagRenderingConfigJson
|
||||
|
||||
/**
|
||||
* The form at the end of a line
|
||||
*/
|
||||
lineCap?: "round" | "square" | "butt" | string | TagRenderingConfigJson
|
||||
|
||||
/**
|
||||
* Wehter or not to fill polygons
|
||||
*/
|
||||
fill?: "yes" | "no" | TagRenderingConfigJson
|
||||
|
||||
/**
|
||||
* The color to fill a polygon with.
|
||||
* If undefined, this will be slightly more opaque version of the stroke line
|
||||
*/
|
||||
fillColor?: string | TagRenderingConfigJson
|
||||
|
||||
/**
|
||||
* The number of pixels this line should be moved.
|
||||
* Use a positive numbe to move to the right, a negative to move to the left (left/right as defined by the drawing direction of the line).
|
||||
|
|
|
@ -397,6 +397,9 @@ export default class LayerConfig extends WithContextLoader {
|
|||
const extraProps = []
|
||||
|
||||
if (canBeIncluded) {
|
||||
if(addedByDefault){
|
||||
extraProps.push("**This layer is included automatically in every theme. This layer might contain no points**" )
|
||||
}
|
||||
if (this.title === undefined) {
|
||||
extraProps.push("Not clickable by default. If you import this layer in your theme, override `title` to make this clickable")
|
||||
}
|
||||
|
@ -410,6 +413,7 @@ export default class LayerConfig extends WithContextLoader {
|
|||
extraProps.push("This layer can **not** be included in a theme. It is solely used by [special renderings](SpecialRenderings.md) showing a minimap with custom data.")
|
||||
}
|
||||
|
||||
|
||||
|
||||
let usingLayer: BaseUIElement[] = []
|
||||
if (usedInThemes?.length > 0 && !addedByDefault) {
|
||||
|
@ -420,12 +424,13 @@ export default class LayerConfig extends WithContextLoader {
|
|||
|
||||
return new Combine([
|
||||
new Title(this.id, 3),
|
||||
addedByDefault ? "**This layer is included automatically in every theme. This layer might contain no points**" : undefined,
|
||||
new Link("Go to the source code", `../assets/layers/${this.id}/${this.id}.json`),
|
||||
this.description,
|
||||
|
||||
new Link("Go to the source code", `../assets/layers/${this.id}/${this.id}.json`),
|
||||
|
||||
new List(extraProps),
|
||||
...usingLayer
|
||||
])
|
||||
]).SetClass("flex flex-col")
|
||||
}
|
||||
|
||||
public CustomCodeSnippets(): string[] {
|
||||
|
|
|
@ -9,7 +9,10 @@ export default class LineRenderingConfig extends WithContextLoader {
|
|||
public readonly color: TagRenderingConfig;
|
||||
public readonly width: TagRenderingConfig;
|
||||
public readonly dashArray: TagRenderingConfig;
|
||||
public readonly lineCap: TagRenderingConfig;
|
||||
public readonly offset: TagRenderingConfig;
|
||||
public readonly fill: TagRenderingConfig;
|
||||
public readonly fillColor: TagRenderingConfig;
|
||||
public readonly leftRightSensitive: boolean
|
||||
|
||||
constructor(json: LineRenderingConfigJson, context: string) {
|
||||
|
@ -17,6 +20,9 @@ export default class LineRenderingConfig extends WithContextLoader {
|
|||
this.color = this.tr("color", "#0000ff");
|
||||
this.width = this.tr("width", "7");
|
||||
this.dashArray = this.tr("dashArray", "");
|
||||
this.lineCap = this.tr("lineCap", "round");
|
||||
this.fill = this.tr("fill", "round");
|
||||
this.fillColor = this.tr("fillColor", "round");
|
||||
|
||||
this.leftRightSensitive = json.offset !== undefined && json.offset !== 0 && json.offset !== "0"
|
||||
|
||||
|
@ -24,12 +30,7 @@ export default class LineRenderingConfig extends WithContextLoader {
|
|||
}
|
||||
|
||||
public GenerateLeafletStyle(tags: {}):
|
||||
{
|
||||
color: string,
|
||||
weight: number,
|
||||
dashArray: string,
|
||||
offset: number
|
||||
} {
|
||||
{ fillColor: string; color: string; lineCap: string; offset: number; weight: number; dashArray: string; fill: string } {
|
||||
function rendernum(tr: TagRenderingConfig, deflt: number) {
|
||||
const str = Number(render(tr, "" + deflt));
|
||||
const n = Number(str);
|
||||
|
@ -55,13 +56,14 @@ export default class LineRenderingConfig extends WithContextLoader {
|
|||
);
|
||||
}
|
||||
|
||||
const weight = rendernum(this.width, 5);
|
||||
const offset = rendernum(this.offset, 0)
|
||||
return {
|
||||
color,
|
||||
weight,
|
||||
dashArray,
|
||||
offset
|
||||
weight: rendernum(this.width, 5),
|
||||
lineCap: render(this.lineCap),
|
||||
offset: rendernum(this.offset, 0),
|
||||
fill: render(this.fill),
|
||||
fillColor: render(this.fillColor)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue