renderWay method
void
renderWay(
- RenderInfo<
Renderinstruction> renderInfo, - RenderContext renderContext,
- WayProperties wayProperties
Renders a symbol for a way.
The symbol 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 (symbolImage == 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);
}
//if (bitmap.debugDisposed())
// print(
// "drawing ${bitmap} at ${this.xy.x - origin.x + boundary!.left} / ${this.xy.y - origin.y + boundary!.top} $theta"); //bitmap.debugGetOpenHandleStackTraces();
//print(StackTrace.current);
renderContext.canvas.drawPicture(
symbolImage: symbolImage!,
matrix: matrix,
left: relative.dx + boundary.left,
top: relative.dy + boundary.top,
paint: fill,
);
}