step 4: add async tiles and persistent cache
This commit is contained in:
@@ -8,6 +8,8 @@ dpg: Any = _dpg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
dpgm.configure(user_agent="dpg-map basic example")
|
||||
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title="dpg-map basic", width=900, height=600)
|
||||
|
||||
|
||||
43
examples/cache_stress.py
Normal file
43
examples/cache_stress.py
Normal file
@@ -0,0 +1,43 @@
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
import dearpygui.dearpygui as _dpg
|
||||
|
||||
import dpg_map as dpgm
|
||||
|
||||
dpg: Any = _dpg
|
||||
|
||||
|
||||
def main() -> None:
|
||||
cache_dir = Path(__file__).resolve().parent / ".tile-cache"
|
||||
dpgm.configure(
|
||||
cache_dir=cache_dir,
|
||||
memory_cache_max_tiles=32,
|
||||
disk_cache_max_bytes=30_000_000,
|
||||
prefetch_margin_tiles=1,
|
||||
user_agent="dpg-map cache_stress example",
|
||||
)
|
||||
|
||||
dpg.create_context()
|
||||
dpg.create_viewport(title="dpg-map cache stress", width=1000, height=700)
|
||||
|
||||
with (
|
||||
dpg.window(label="Cache Stress", width=-1, height=-1),
|
||||
dpgm.map_widget(
|
||||
tag="cache-map",
|
||||
center=(47.9029, 1.9093),
|
||||
zoom=14,
|
||||
width=-1,
|
||||
height=-1,
|
||||
),
|
||||
):
|
||||
dpgm.add_marker("start", lat=47.9029, lon=1.9093, label="Orleans")
|
||||
|
||||
dpg.setup_dearpygui()
|
||||
dpg.show_viewport()
|
||||
dpg.start_dearpygui()
|
||||
dpg.destroy_context()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user