* Render text to SVG
(text)
| 349 | * Render text to SVG |
| 350 | */ |
| 351 | textToSVG(text) { |
| 352 | const mapcoords = [ |
| 353 | this.xToPx(geoutils.lonToX(text.coord[0], this.zoom)) - text.offset[0], |
| 354 | this.yToPx(geoutils.latToY(text.coord[1], this.zoom)) - text.offset[1], |
| 355 | ]; |
| 356 | |
| 357 | return ` |
| 358 | <text |
| 359 | x="${mapcoords[0]}" |
| 360 | y="${mapcoords[1]}" |
| 361 | style="fill-rule: inherit; font-family: ${text.font};" |
| 362 | font-size="${text.size}pt" |
| 363 | stroke="${text.color}" |
| 364 | fill="${text.fill ? text.fill : 'none'}" |
| 365 | stroke-width="${text.width}" |
| 366 | text-anchor="${text.anchor}" |
| 367 | > |
| 368 | ${text.text} |
| 369 | </text> |
| 370 | `; |
| 371 | } |
| 372 | |
| 373 | /** |
| 374 | * Render MultiPolygon to SVG |
no test coverage detected