Skip to content

Add SymbolStyle.ImageSource as alternative for SymbolStyle.BitmapId #1998

@pauldendulk

Description

@pauldendulk

The problem
Currently the registration and assignment of BitmapId is not very handy. Users need to do a couple of things, load a bitmap, register it and assign it to the SymbolStyle.BitmapId. There are various helpers to make this easier but it is not very clear what should be used.

The solution
Add a SymbolStyle.IconPath which specifies the location of the icon, like:

  • SymbolStyle.IconPath = "file://myfolder/myimage.png"
  • SymbolStyle.IconPath = "http://mywebsite.com/myimage.png"
  • SymbolStyle.IconPath = "embeddedResource://myassembly.resourses.images.myimage.png"

The images are loaded by Mapsui and added to BitmapRegistry. The IconPath string should be used as key to make sure they are loaded only once.

The BitmapId could still be used, but not in combination with IconPath.

A longer term goal is to serialize the entire layer definition to file. This would also need bigger changes to how layers are defined, and the fetching logic should be moved from the layers to the MapControl, Map, or a new Fetcher class.

Alternatives
I did not spend much time thinking about alternatives yet, but I am sure there are a lot.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions