|
11 | 11 |
|
12 | 12 | class Timeline(GeoJson):
|
13 | 13 | """
|
14 |
| - Creates a layer from GeoJSON with time data to append |
15 |
| - into a map with Map.add_child. |
| 14 | + Create a layer from GeoJSON with time data to add to a map. |
16 | 15 |
|
17 |
| - To add time data, you need to do one of the following: |
| 16 | + To add time data, you need to do one of the following: |
18 | 17 |
|
19 |
| - * Add a 'start' and 'end' property to each feature. The start and end |
20 |
| - can be any comparable item. |
| 18 | + * Add a 'start' and 'end' property to each feature. The start and end |
| 19 | + can be any comparable item. |
21 | 20 |
|
22 |
| - Alternatively, you can provide |
23 |
| - a `get_interval` function. |
| 21 | + Alternatively, you can provide a `get_interval` function. |
24 | 22 |
|
25 |
| - * This function should be a JsCode object and take as parameter |
26 |
| - a GeoJson feature and return a dict containing values for |
27 |
| - 'start', 'end', 'startExclusive' and 'endExcusive' (or false if no |
28 |
| - data could be extracted from the feature). |
29 |
| - * 'start' and 'end' can be any comparable items |
30 |
| - * 'startExclusive' and 'endExclusive' should be boolean values. |
| 23 | + * This function should be a JsCode object and take as parameter |
| 24 | + a GeoJson feature and return a dict containing values for |
| 25 | + 'start', 'end', 'startExclusive' and 'endExcusive' (or false if no |
| 26 | + data could be extracted from the feature). |
| 27 | + * 'start' and 'end' can be any comparable items |
| 28 | + * 'startExclusive' and 'endExclusive' should be boolean values. |
31 | 29 |
|
32 |
| - Parameters |
33 |
| - ---------- |
34 |
| - data: file, dict or str. |
35 |
| - The geojson data you want to plot. |
| 30 | + Parameters |
| 31 | + ---------- |
| 32 | + data: file, dict or str. |
| 33 | + The geojson data you want to plot. |
36 | 34 |
|
37 |
| - get_interval: JsCode, optional |
38 |
| - Called for each feature, and should return either a time range for the |
39 |
| - feature or `false`, indicating that it should not be included in the |
40 |
| - timeline. The time range object should have 'start' and 'end' properties. |
41 |
| - Optionally, the boolean keys 'startExclusive' and 'endExclusive' allow the |
42 |
| - interval to be considered exclusive. |
| 35 | + get_interval: JsCode, optional |
| 36 | + Called for each feature, and should return either a time range for the |
| 37 | + feature or `false`, indicating that it should not be included in the |
| 38 | + timeline. The time range object should have 'start' and 'end' properties. |
| 39 | + Optionally, the boolean keys 'startExclusive' and 'endExclusive' allow the |
| 40 | + interval to be considered exclusive. |
43 | 41 |
|
44 |
| - If `get_interval` is not provided, 'start' and 'end' properties are |
45 |
| - assumed to be present on each feature. |
| 42 | + If `get_interval` is not provided, 'start' and 'end' properties are |
| 43 | + assumed to be present on each feature. |
46 | 44 |
|
47 | 45 | Examples
|
48 | 46 | --------
|
@@ -142,35 +140,33 @@ def _get_self_bounds(self):
|
142 | 140 |
|
143 | 141 | class TimelineSlider(JSCSSMixin, MacroElement):
|
144 | 142 | """
|
145 |
| - Creates a timeline slider for timeline layers. |
146 |
| -
|
147 |
| - Parameters |
148 |
| - ---------- |
149 |
| - auto_play: bool, default True |
150 |
| - Whether the animation shall start automatically at startup. |
151 |
| -
|
152 |
| - start: str, int or float, default earliest 'start' in GeoJson |
153 |
| - The beginning/minimum value of the timeline. |
154 |
| - end: str, int or float, default latest 'end' in GeoJSON |
155 |
| - The end/maximum value of the timeline. |
156 |
| -
|
157 |
| - date_options: str, default "YYYY-MM-DD HH:mm:ss" |
158 |
| - A format string to render the currently active time in the control. |
159 |
| - enable_playback: bool, default True |
160 |
| - Show playback controls (i.e. prev/play/pause/next). |
161 |
| - enable_keyboard_controls: bool, default False |
162 |
| - Allow playback to be controlled using the spacebar (play/pause) and |
163 |
| - right/left arrow keys (next/previous). |
164 |
| - show_ticks: bool, default True |
165 |
| - Show tick marks on the slider |
166 |
| - steps: int, default 1000 |
167 |
| - How many steps to break the timeline into. |
168 |
| - Each step will then be (end-start) / steps. Only affects playback. |
169 |
| - playback_duration: int, default 10000 |
170 |
| - Minimum time, in ms, for the playback to take. Will almost certainly |
171 |
| - actually take at least a bit longer -- after each frame, the next |
172 |
| - one displays in playback_duration/steps ms, so each frame really |
173 |
| - takes frame processing time PLUS step time. |
| 143 | + Creates a timeline slider for timeline layers. |
| 144 | +
|
| 145 | + Parameters |
| 146 | + ---------- |
| 147 | + auto_play: bool, default True |
| 148 | + Whether the animation shall start automatically at startup. |
| 149 | + start: str, int or float, default earliest 'start' in GeoJson |
| 150 | + The beginning/minimum value of the timeline. |
| 151 | + end: str, int or float, default latest 'end' in GeoJSON |
| 152 | + The end/maximum value of the timeline. |
| 153 | + date_options: str, default "YYYY-MM-DD HH:mm:ss" |
| 154 | + A format string to render the currently active time in the control. |
| 155 | + enable_playback: bool, default True |
| 156 | + Show playback controls (i.e. prev/play/pause/next). |
| 157 | + enable_keyboard_controls: bool, default False |
| 158 | + Allow playback to be controlled using the spacebar (play/pause) and |
| 159 | + right/left arrow keys (next/previous). |
| 160 | + show_ticks: bool, default True |
| 161 | + Show tick marks on the slider |
| 162 | + steps: int, default 1000 |
| 163 | + How many steps to break the timeline into. |
| 164 | + Each step will then be (end-start) / steps. Only affects playback. |
| 165 | + playback_duration: int, default 10000 |
| 166 | + Minimum time, in ms, for the playback to take. Will almost certainly |
| 167 | + actually take at least a bit longer -- after each frame, the next |
| 168 | + one displays in playback_duration/steps ms, so each frame really |
| 169 | + takes frame processing time PLUS step time. |
174 | 170 |
|
175 | 171 | Examples
|
176 | 172 | --------
|
|
0 commit comments