1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
use std::fmt;
use glam::DVec2;
use mln_style::geo::LatLng;
/// The ground of a terrain as a frame drew it, which the map's camera
/// stands on. A renderer makes it and hands it to the map; it doesn't change
/// once made, so the map reads it on its own thread.
pub trait Elevation: fmt::Debug + Send + Sync {
/// The height of the ground at `location`, in meters with the terrain's
/// exaggeration, as the frame drew it: by the height rule, from the DEM
/// that the tile drawn there read, its own or, while that loads, an
/// ancestor's; 0 where the tile draws flat, as before any of them has
/// loaded. `None` where no tile was drawn.
fn at(&self, location: LatLng) -> Option<f64>;
/// The height of the ground at `location` that the camera's center
/// stands on, in meters with the exaggeration: by the finest DEM data
/// loaded there, whatever tiles the frame drew, as
/// [`clearance_at`](Self::clearance_at) takes heights, so that the
/// center stands the same whichever camera drew the frame; else as
/// [`at`](Self::at) gives it. By default, [`at`](Self::at).
fn ground_at(&self, location: LatLng) -> Option<f64> {
self.at(location)
}
/// The lowest height, in meters with the exaggeration, of the DEM that
/// the tile drawn at `location` read; `None` where no tile was drawn.
fn min_at(&self, location: LatLng) -> Option<f64>;
/// The height of the surface the frame drew at `world`, a Web Mercator
/// point at zoom 0 (from 0 to 1 across, y south, x in the world copy the
/// view shows it in), in meters with the exaggeration: as
/// [`at`](Self::at), but only of the tiles drawn in `world`'s copy.
/// `None` where no tile was drawn there.
fn surface_at(&self, world: DVec2) -> Option<f64>;
/// The height of the ground at `world`, as [`surface_at`](Self::surface_at)
/// takes the point, by the finest DEM data loaded there, whatever tiles
/// the frame drew: what a camera at rest keeps its eye above, which a
/// coarser frame, as of a raised camera, doesn't smooth away. `None`
/// where no DEM data has loaded, as under a tile drawn flat before any
/// has. By default, the drawn surface.
fn clearance_at(&self, world: DVec2) -> Option<f64> {
self.surface_at(world)
}
/// The lowest and highest ground of the tiles the frame drew, in meters
/// with the exaggeration, as their DEM data says, 0 for a tile drawn
/// flat: it holds every height [`surface_at`](Self::surface_at) gives
/// but along a tile's edge, which reads its neighbors' data within half
/// a pixel of the DEM. `None` where no tile was drawn.
fn range(&self) -> Option<(f64, f64)>;
}