renderWay method
void
renderWay(
- RenderInfo<
Renderinstruction> renderInfo, - RenderContext renderContext,
- WayProperties wayProperties
Renders an icon for a way.
The icon is drawn at the center of the way's bounding box.
Implementation
@override
void renderWay(RenderInfo renderInfo, RenderContext renderContext, WayProperties wayProperties) {
if (renderContext is! UiRenderContext) throw Exception("renderContext is not UiRenderContext ${renderContext.runtimeType}");
if (textPainter == null) return;
Mappoint point = wayProperties.getCenterAbsolute(renderContext.projection);
MappointRelative relative = point.offset(renderContext.reference);
MapRectangle boundary = renderinstruction.getBoundary(renderInfo);
UiMatrix? matrix;
if (renderinstruction.theta != 0 || renderContext.rotationRadian != 0) {
matrix = UiMatrix();
matrix.rotate(renderinstruction.theta - renderContext.rotationRadian, pivotX: boundary.left, pivotY: boundary.top);
}
renderContext.canvas.drawIcon(textPainter: textPainter!, left: relative.dx + boundary.left, top: relative.dy + boundary.top, matrix: matrix);
}