diff options
-rw-r--r-- | doc/developer/module/hittekaart_py.rst | 48 |
1 files changed, 30 insertions, 18 deletions
diff --git a/doc/developer/module/hittekaart_py.rst b/doc/developer/module/hittekaart_py.rst index 1df3e8c..052c2b0 100644 --- a/doc/developer/module/hittekaart_py.rst +++ b/doc/developer/module/hittekaart_py.rst @@ -16,15 +16,16 @@ Example .. code-block:: python from hittekaart_py import ( - Track, HeatmapRenderer, Storage, generate + Track, HeatmapRenderer, Settings, Storage, generate ) + settings = Settings(threads=3) tracks = [ Track.from_file(b"Documents/track.gpx", None), Track.from_coordinates([(45.0, 47.0)]), ] storage = Storage.Sqlite(b"/tmp/tiles.sqlite") - generate(tracks, HeatmapRenderer(), storage) + generate(settings, tracks, HeatmapRenderer(), storage) Input and output ---------------- @@ -100,14 +101,38 @@ Renderers :param zoom: The zoom level. :type zoom: int -Functions ---------- +Tile generation +--------------- + +.. class:: Settings(min_zoom=1, max_zoom=19, threads=0) + + Settings that apply to all renderers. + + .. attribute:: min_zoom + :type: int + + Smalles zoom level to generate tiles for. + + .. attribute:: max_zoom + :type: int + + Largest zoom level to generate tiles for. + + .. attribute:: threads + :type: int -.. function:: generate(items, renderer, storage) + Number of threads to use for tile generation. + + Setting this to 0 will automatically determine the number of available + cores and use that many threads. + +.. function:: generate(settings, items, renderer, storage) Generates the tiles using the given renderer, and saves them to the given storage. + :param settings: The settings. + :type settings: Settings :param items: The tracks to render. :type items: ~typing.Iterable[Track] :param renderer: The renderer to use. @@ -115,19 +140,6 @@ Functions :param storage: The storage to output to. :type storage: Storage -.. function:: set_threads(threads) - - Set the number of threads that hittekaart will use. - - Note that this is a global function, it will affect all subsequent calls. - - Note further that you may only call this function once, at startup. Calls - after the thread pool has been initialized (e.g. via a :func:`generate` or - :func:`set_threads` call) will raise an exception. - - :param threads: Number of threads to use. - :type threads: int - Errors ------ |