Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions crates/map/src/layout/profile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,4 +204,12 @@ impl Profile {
}
cut
}

/// The value axis' ends given, when they make one (the least below the most).
pub fn given_range(&self) -> (Option<f64>, Option<f64>) {
Comment thread
elpidioassinaturas marked this conversation as resolved.
Resolved
match (self.min, self.max) {
(Some(lo), Some(hi)) if lo >= hi => (None, None),
Comment thread
elpidioassinaturas marked this conversation as resolved.
Resolved
given => given,
}
}
}
15 changes: 12 additions & 3 deletions crates/render/src/layout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,12 +170,15 @@ pub fn meets(e: &rustgis_map::layout::Element, [x, y, w, h]: [f64; 4], margin: f
}

/// What a page actually drew without, kept separately so legend-only waits redraw only on completion.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[derive(Clone, Debug, Default, PartialEq, Eq)]
pub struct PagePending {
/// A frame drew without tiles, streamed data or cast shadows still on their way.
pub frames: bool,
/// A legend drew while one of its own pictures was still on its way.
pub legends: bool,
/// What its profiles said of what they read as they were drawn ([`profiles_not_drawn`]), so
/// the Layout view needn't read them again to say it.
pub profiles: Vec<ProfileNote>,
}

/// [`render`], and whether a frame or legend was drawn while content was still on its way.
Expand Down Expand Up @@ -696,8 +699,14 @@ fn draw_page(
None => placeholder(&mut pm, r, "Chart", ppp),
}
}
// Its curve comes in its own step (#2863 part 2d); what it reads is said meanwhile.
ElementKind::Profile(_) => placeholder(&mut pm, r, "Profile", ppp),
ElementKind::Profile(p) => {
let read = profile_samples(layout, maps, p);
Comment thread
elpidioassinaturas marked this conversation as resolved.
Resolved
pending.profiles.extend(profile_note(e, &read));
match read {
Ok((samples, section)) => draw_profile(&mut pm, r, p, (&samples, &section), layout.decimal_comma, ppp),
Err(_) => placeholder(&mut pm, r, "Profile", ppp),
}
}
ElementKind::Rectangle { fill, outline, width, radius, dash } => {
// Square corners filled as before, so an existing layout draws to the same pixels.
let rounded = rounded_rect(r, (*radius * PT_PER_MM * ppp) as f32);
Expand Down
Loading
Loading