Transient Highlight

Smallworld™ provides an easy way of highlighting stuff in the application. Simply put geometry on the databus with the key :geometry_to_highlight and it will light up on the maps in a different color.
However the fun is for a short time, as soon as the map is refreshed the highlight is gone. If you require a more permanent highlight there is another mechanism.

Debugging Note If you send send something to the databus and it isn't drawing. Verify that the dynamic !current_coordinate_system! is set to the application coordinate system.

The map_manager supports transient rendering of map_views. A map_view renders in two images. In one image the visible parts of the database is rendered, in another image the transient data is rendered. Transient data is data like the selection, the trail, the node/link information, trace results, etc. Each transient data has its z-order and is rendered in a strict order: e.g. first the selection, then the networktrace, then the topology indicators, etc. Consult the documentation to find the exact order of things.
Eventually the two images are superimposed to create the final result.
Every plugin can register itself as a provider of transient data. That turns out to be an excellent mechanism to implement transient highlight. As an example I have created a plugin that highlights the path between a supplypoint and its feeding substation. The basic sequence structure is like this:
The plugin adds itself as a transient provider (add_post_renderer()) and it will automatically be called during every refresh (map_damage_notify()).
The highlight style is free to choose by the plugin. I choose a fat yellow dashpattern, but really anything is possible.
I have attached the sourcecode for further reading.
Have fun!
Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License