53 lines
2.4 KiB
Python
53 lines
2.4 KiB
Python
# geoelevation/map_viewer/__init__.py
|
|
"""
|
|
GeoElevation Map Viewer Subpackage.
|
|
|
|
This package provides components for displaying and interacting with tiled web maps,
|
|
such as OpenStreetMap, within the GeoElevation application. It includes:
|
|
- GeoElevationMapViewer: Orchestrates map display and user interactions.
|
|
- MapDisplayWindow: Manages the OpenCV window for map rendering.
|
|
- MapTileManager: Handles fetching, caching, and stitching of map tiles.
|
|
- MapServices: Defines interfaces and implementations for map tile providers.
|
|
- MapUtils: Contains utility functions for map-related calculations.
|
|
"""
|
|
|
|
# Import key classes to make them available when importing the package, e.g.:
|
|
# from geoelevation.map_viewer import GeoElevationMapViewer
|
|
# This is optional; users could also import directly from the submodules.
|
|
|
|
# Attempt to import the main class. If it fails (e.g., due to missing dependencies
|
|
# like OpenCV, which would prevent GeoElevationMapViewer or its components from loading),
|
|
# this __init__.py will still execute, but the name won't be available.
|
|
# The main application (elevation_gui.py) already has try-except blocks around
|
|
# its import of GeoElevationMapViewer, so this is mostly for programmatic users
|
|
# of this sub-package.
|
|
|
|
try:
|
|
from .geo_map_viewer import GeoElevationMapViewer
|
|
# If there are other classes/functions from this subpackage you want to make
|
|
# directly accessible, import them here as well.
|
|
# e.g., from .map_services import OpenStreetMapService
|
|
|
|
# Define __all__ to specify what `from geoelevation.map_viewer import *` imports.
|
|
# This is good practice.
|
|
__all__ = [
|
|
"GeoElevationMapViewer",
|
|
# Add other explicitly exported names here, e.g.:
|
|
# "MapDisplayWindow",
|
|
# "MapTileManager",
|
|
# "OpenStreetMapService",
|
|
# "get_map_service_instance", # from map_services
|
|
# "get_bounding_box_from_center_size", # from map_utils
|
|
# "get_tile_ranges_for_bbox" # from map_utils
|
|
]
|
|
|
|
except ImportError as e_init_map_viewer:
|
|
# Log a warning if the primary class cannot be imported,
|
|
# as it indicates a problem with the subpackage's dependencies or structure.
|
|
import logging
|
|
logging.getLogger(__name__).warning(
|
|
f"Could not import GeoElevationMapViewer from .geo_map_viewer, "
|
|
f"possibly due to missing dependencies: {e_init_map_viewer}"
|
|
)
|
|
# If GeoElevationMapViewer is critical, __all__ might be empty or not defined.
|
|
__all__ = [] |