mapsforge_flutter
mapsforge_flutter copied to clipboard
Added possibility to exclude symbols from drawing on the map
Use case
My map has an XML file containing multiple elements (symbols) that are drawn on the map. In many cases the user wont need 50% of them. Example:
<rule e="any" k="tourism" v="alpine_hut" zoom-min="12">
<rule e="any" k="name" v="*">
<rule e="any" k="access" v="~">
<rule e="any" k="abandoned" v="~yes|~">
<rule e="any" k="winter_room" v="wr_yes">
<symbol id="BGM_Hiza" priority="2" display="always" src="assets/map/mapstyles/bgm_res/BGM_Hiza.svg" symbol-scaling="size" symbol-height="20" symbol-width="20" />
<caption k="name" priority="2" symbol-id="BGM_Hiza" position="above" font-style="bold" font-size="11" fill="#DD0000" stroke="#E5FFFFFF" stroke-width="2" />
<caption k="ele" priority="-5" symbol-id="BGM_Hiza" position="below" font-style="bold" font-size="8" fill="#DD0000" stroke="#E5FFFFFF" stroke-width="2" />
</rule>
<rule e="any" k="winter_room" v="~">
<symbol id="BGM_Hiza" priority="2" display="always" src="assets/map/mapstyles/bgm_res/BGM_Hiza.svg" symbol-scaling="size" symbol-height="20" symbol-width="20" />
<caption k="name" priority="2" symbol-id="BGM_Hiza" position="above" font-style="bold" font-size="11" fill="#DD0000" stroke="#E5FFFFFF" stroke-width="2" />
<caption k="ele" priority="-5" symbol-id="BGM_Hiza" position="below" font-style="bold" font-size="8" fill="#DD0000" stroke="#E5FFFFFF" stroke-width="2" />
</rule>
</rule>
</rule>
</rule>
</rule>
Thats why I am proposing this PR to add an option to exclude some symbol Ids from drawing on the map.
Usage
final Set<String> excludedElements = {"BGM_Hiza"};
final renderTheme = await RenderThemeBuilder.create(
_displayModel,
'assets/map/mapstyles/Elevate.xml',
excludeIds: excludedElements,
);
final jobRenderer = MapDataStoreRenderer(
mapFileLoaded,
renderTheme,
_symbolCache,
true,
);
The excludedIds is optional.