Mapsui
Mapsui copied to clipboard
Owner drawn bitmap type
Is it possible to implement an owner drawn bitmap type?
In the moment we have the possibility to use a Svg, a bitmap or a sprite type bitmap for any images. The idea is now, to add a bitmap type, that could be drawn by owner in the moment, the map is drawn. It could be done by object, that implement an interface
void Draw(object canvas, float destination.X, float destination.Y, float rotation, float offsetX, float offsetY, float opacity, float scale);
This is related to the custom renderer idea that came up in other issues. The setup could be similar to the Widgets. There a user can add a widget class which has to be accompanied by a renderer for that class. It would be nice to have a generic mechanism for this. A question that comes up is what would trigger the custom renderer. It could be a custom geometry type. This would allow users to add a circle geometry that has been requested in the past.
In this case the geometry would just be a point and the renderer would depend on the type of the bitmap in the symbol. So there is a SymbolStyle which has a bitmapId. If you fetch that bitmap from the cache it has a Type property that can be Bitmap, Svg, or Sprite. So this solution would make it quite specific for this purpose. Another option would be to make it depend on the Style. So the user could add a MyCustomStyle, derived from a general CustomStyle. Whenever a style is derived from CustomStyle the render starts looking for a custom renderer for that specific style. So, this way it is like the widgets again. A benefit could be that it could be used for other geometries as well.
The notes above are just to get my thoughts started.