Files
dpg-map/examples/cache_stress.py

44 lines
999 B
Python

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()