[VTM] make getRules() in RenderTheme public and maybe add a setter

30 views
Skip to first unread message

Karsten T.

unread,
Mar 5, 2021, 7:49:09 AM3/5/21
to Mapsforge & VTM
Hello,

I want to make getRules() in RenderTheme public, so I can access rules for existing themes to create new themes.

I don't know how the rules work, but a setter method would also be nice.

greetz

Emux

unread,
Mar 5, 2021, 8:01:58 AM3/5/21
to mapsfo...@googlegroups.com
The rules variable is final in the RenderTheme.

You can use the RenderTheme.traverseRules method to modify them.
See the ThemeStylerActivity and the RuleVisitorTest examples.

Or use a TileLoaderThemeHook, see the MapsforgeActivity example.

--
Emux

Karsten T.

unread,
Mar 5, 2021, 10:05:42 AM3/5/21
to Mapsforge & VTM
You can use the RenderTheme.traverseRules method to modify them.
See the ThemeStylerActivity and the RuleVisitorTest examples.

i ended up using this approach and it works, thanks. one question remains: in my current implementation i'm only resetting the TextStyle - does this have a negative impact on performance or can i even remove the TextStyle? i didn't try to remove the style yet because styles in Rule is also final

Emux

unread,
Mar 5, 2021, 1:48:19 PM3/5/21
to mapsfo...@googlegroups.com
If you want to hide a rule you could try the TileLoaderThemeHook (see the MapsforgeActivity).

Check for your key / value tag and the needed style and could return true to skip it.


But you just have to customize your own theme instead of reverse engineering with code.

--
Emux
Reply all
Reply to author
Forward
0 new messages