forked from MapComplete/MapComplete
Add gps track line, add documentation
This commit is contained in:
parent
7b7076168f
commit
d3d51af667
18 changed files with 278 additions and 145 deletions
|
@ -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