Smrender October News

There was nearly two months of develop going since my last release of Smrender.

Today I released a new version (SVN revision 1326) with a lot of new features. For a quick overview have a look at the News on the project’s web page.

Dynamic Symbols Renamed

The most important thing for all of you who wrote your own functions for Smrender is that a changed the naming convention for the library symbols. As always, all symbols have to be prefixed with ‘act_’ and initialization (constructor) and finalization (destructor) function have the suffixes ‘_ini’ and ‘_fini’. Now the main rule function itself has to be suffixed by ‘_main’. So please rename your main functions.

This was done for security reasons because with a special crafted ruleset one could falsely call the constructor or destructor in the wrong place. And because the main function has two parameters and not just one this may lead to a stack corruption and everything the could result from that (segfaults, buffer overflows,…).

Imagine the following action and try to figure out which functions will actually be called:

<node>
<tag k='man_made' v='lighthouse'/>
<tag k='_action_' v='img_ini'/>
</node>

New Actions

I added several new actions to Smrender. ‘ruler’ will add a ruler which will be partitioned into sections of several kilometers in an appropriate scale. This feature is thought to be used mainly for hiking maps or similar. Have a look at the lower left corner of the picture at the top of this posting.1 The rule as in the picture is added with the following rule:

<node>
<tag k='_action_' v='ruler:section=10;count=5'/>
</node>

The grid (and its legend) may now optionally be added with a rule instead of using the option -g. Please note that Smrender (currently) generates a grid by default even if the option -g is omitted because it is assumed that a grid is a mandatory feature of a sea chart. If you explicitly want to suppress the grid add the option -G.

Smrender now supports the option -u which will output a set of URLs which are appropriate for downloading the OSM data which you will need to render the selected region.

The following actions are added which may be useful in some cases:

  • ‘poly_len’ allows to calculate the length of a way. Smrender will add the new tag ‘smrender:length=*’ to each way to which this action was applied.
  • ‘diff’ will match an OSM file to the internal database based on the object IDs.
  • ‘dist_median’

Rules Directory

Another important new feature is that Smrender is now able to read the rules from a set of “*.osm” files in a directory. This gives much more overview to the user about the rules. It let’s you easily organize different rulesets in such a way that you can combine them out of “rule building blocks”. On my notebook I currently maintain the following directory of rules:

rules/basemap.osm
rules/features.osm
rules/legend.osm
rules/natural.osm
rules/route.osm
rules/seamark.osm

I think the filenames are more or less self-explanatory ­čśë

Future Work

My next development goals are multi-threading, a code cleanup, captions on (open) polylines, and output to a marine vector file format (such as SHP).

  1. A high quality sample is found at http://www.abenteuerland.at/smrender/download/samples/.