Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
3b189c1
feat(render): a block's walls take a top band from a second polygon l…
elpidiofilho Nov 28, 2026
d723acd
Merge remote-tracking branch 'origin/main' into feat/2607-walls-top-band
elpidiofilho Nov 28, 2026
90aea43
Merge remote-tracking branch 'origin/main' into feat/2607-walls-top-band
elpidiofilho Nov 28, 2026
d5fce76
fix(render): the walls' top band keeps a box's corner outline and a f…
elpidiofilho Nov 28, 2026
907ecec
fix(render): the walls' top band's contacts stand upright in a turned…
elpidiofilho Nov 28, 2026
3b282b0
fix(render): the walls' top band takes its fill at the drawing scale …
elpidiofilho Nov 28, 2026
ea547c8
fix(render): the walls' top band's foot follows its top's line (#2607)
elpidiofilho Nov 28, 2026
415d1bf
fix(render): the walls' top band keeps a polygon corner's outline and…
elpidiofilho Nov 28, 2026
0caf051
fix(render): the walls' top band's foot bends where it meets the base…
elpidiofilho Nov 28, 2026
8dbf680
fix(render): the walls' top band reads the mesh edge's height exactly…
elpidiofilho Nov 28, 2026
d3d9403
Merge remote-tracking branch 'origin/main' into feat/2607-walls-top-band
elpidiofilho Nov 28, 2026
4f5554a
Merge remote-tracking branch 'origin/main' into feat/2607-walls-top-band
elpidiofilho Nov 28, 2026
94f7197
fix(render): the walls' top band's base notice names its layer and co…
elpidiofilho Nov 28, 2026
3257e6a
fix(render): a block's walls layer takes its fill at the drawing scal…
elpidiofilho Nov 28, 2026
5746d86
fix(render, engine): the walls' top band keeps contacts between class…
elpidiofilho Nov 28, 2026
d9c0a13
fix(render): the walls' top band's base notice counts each stretch on…
elpidiofilho Nov 28, 2026
43ae6cd
fix(engine): say when a removal leaves a block's walls or top band no…
elpidiofilho Nov 28, 2026
3d63f18
fix(render): the base notice counts a polygon block's long side's str…
elpidiofilho Nov 28, 2026
95ead1d
fix(engine): an imported map says its block's walls, top band and wat…
elpidiofilho Nov 28, 2026
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
3 changes: 3 additions & 0 deletions crates/engine/src/cmd/items.rs
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ fn import_maps(s: &mut Session, p: &Value) -> CmdResult {
crate::s3_connections::resolve_project_s3(s);
s.wait_in_place_reads();
super::project::say_conversion_fallbacks(s);
// What the imported maps' block diagrams can't draw their walls, top band or water bed
// from, as when a project opens.
super::project::say_block_layers(s, first_map..s.project.maps.len());
super::connections::note_waiting(s);
if let Some(n) = names.last()
&& let Some(i) = s.project.maps.iter().position(|m| &m.name == n)
Expand Down
28 changes: 25 additions & 3 deletions crates/engine/src/cmd/layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7480,6 +7480,10 @@ fn references_follow_layer(s: &mut Session, old: &str, new: &str) {
if let Some(walls) = s.map_mut().view.terrain.as_mut().and_then(|t| t.block.as_mut()).and_then(|b| b.walls_layer.as_mut()) {
replace(walls);
}
// And the layer of its walls' top band (#2607).
if let Some(top) = s.map_mut().view.terrain.as_mut().and_then(|t| t.block.as_mut()).and_then(|b| b.walls_top.as_mut()) {
replace(&mut top.layer);
}
// And the raster its water's bed is read from (#2434).
if let Some(bed) =
s.map_mut().view.terrain.as_mut().and_then(|t| t.block.as_mut()).and_then(|b| b.water.as_mut()).and_then(|w| w.bed.as_mut())
Expand Down Expand Up @@ -7838,6 +7842,12 @@ fn square_labels_follow_removal(s: &mut Session, names: &[String]) {
}
}

/// What brings back a block's walls layer or top band after its layer is gone: a layer
/// `rustgis_render::terrain::walls_layer` takes.
fn back_as_walls_layer() -> &'static str {
"a polygon layer of that name comes back, the only layer so named and not one read a view at a time"
}

/// After layers called `names` are removed: a terrain drawn from one of them would lose its
/// relief, or take another layer's heights by that name, so it is turned off, and said. Its water
/// layer removed (#1915), the water keeps the name, so a layer of that name brings it back, and
Expand All @@ -7853,12 +7863,24 @@ fn terrain_follows_removal(s: &mut Session, names: &[String]) {
}
let dem = terrain_dem(s).filter(|d| names.iter().any(|n| n.eq_ignore_ascii_case(d)));
// So does the block's walls layer (#1914): its walls are their own colour meanwhile. Not when
// the DEM goes too: the terrain, its block with it, is turned off below.
// the DEM goes too: the terrain, its block with it, is turned off below. Said whenever no layer
// of that name is left that the walls can be drawn from (`walls_layer`): none, or only one that
// isn't of polygons, or several sharing the name.
let drawable = |s: &Session, name: &str| rustgis_render::terrain::walls_layer(s.map(), name).is_some();
let walls = s.map().view.terrain.as_ref().and_then(|t| t.block.as_ref()).and_then(|b| b.walls_layer.clone());
if let Some(w) = walls.filter(|w| dem.is_none() && names.iter().any(|n| n.eq_ignore_ascii_case(w)) && named_layers(s, w) == 0) {
if let Some(w) = walls.filter(|w| dem.is_none() && names.iter().any(|n| n.eq_ignore_ascii_case(w)) && !drawable(s, w)) {
s.notify(
format!("Terrain: the block's walls layer '{w}' was removed, so the walls are one colour until {}", back_as_walls_layer()),
false,
);
}
// And its walls' top band's (#2607): no band meanwhile.
let top = s.map().view.terrain.as_ref().and_then(|t| t.block.as_ref()).and_then(|b| b.walls_top.as_ref()).map(|t| t.layer.clone());
if let Some(l) = top.filter(|l| dem.is_none() && names.iter().any(|n| n.eq_ignore_ascii_case(l)) && !drawable(s, l)) {
s.notify(
format!(
"Terrain: the block's walls layer '{w}' was removed, so the walls are one colour until a layer of that name comes back"
"Terrain: the block's walls' top layer '{l}' was removed, so the walls have no top band until {}",
back_as_walls_layer()
),
false,
);
Expand Down
152 changes: 95 additions & 57 deletions crates/engine/src/cmd/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,100 @@ pub(super) fn off_dem(extent: Option<[f64; 4]>, dem: Option<&(String, Option<[f6
}
}

/// What a block's walls layer (#1914), walls' top band (#2607) and water bed (#2434) can't be
/// drawn from in the project's maps `range` says: as a project opens ([`reset`]) and as maps are
/// imported (`map.import`), each kept by name so a layer of that name brings it back.
pub(crate) fn say_block_layers(s: &mut Session, range: std::ops::Range<usize>) {
// A block whose walls layer (#1914) is missing, holds no polygons, is read a view at a time or
// shares its name with another layer draws its walls in their own colour (`block::runs`, as
// the terrain command refuses such a layer): said, and kept, so a polygon layer of that name
// colours them again.
let plain: Vec<String> = s
.project
.maps
.get(range.clone())
.unwrap_or_default()
.iter()
.filter_map(|m| {
let l = m.view.terrain.as_ref()?.block.as_ref()?.walls_layer.as_ref()?;
rustgis_render::terrain::walls_layer(m, l).is_none().then(|| format!("{} ('{l}')", m.name))
})
.collect();
match plain.as_slice() {
[] => {}
[one] => s.notify(
format!("{one}: the block diagram's walls layer is missing, isn't a polygon layer, holds its features only a view at a time, or shares its name with another layer, so its walls are one colour"),
false,
),
_ => s.notify(
format!(
"{} block diagrams have a walls layer that is missing, isn't a polygon layer, holds its features only a view at a time, or shares its name with another layer, so their walls are one colour: {}",
plain.len(),
plain.join(", ")
),
false,
),
}
// So does a walls' top band (#2607) whose layer can't be read: no band, said, and kept.
let bandless: Vec<String> = s
.project
.maps
.get(range.clone())
.unwrap_or_default()
.iter()
.filter_map(|m| {
let l = &m.view.terrain.as_ref()?.block.as_ref()?.walls_top.as_ref()?.layer;
rustgis_render::terrain::walls_layer(m, l).is_none().then(|| format!("{} ('{l}')", m.name))
})
.collect();
match bandless.as_slice() {
[] => {}
[one] => s.notify(
format!("{one}: the block diagram's walls' top layer is missing, isn't a polygon layer, holds its features only a view at a time, or shares its name with another layer, so its walls have no top band"),
false,
),
_ => s.notify(
format!(
"{} block diagrams have a walls' top layer that is missing, isn't a polygon layer, holds its features only a view at a time, or shares its name with another layer, so their walls have no top band: {}",
bandless.len(),
bandless.join(", ")
),
false,
),
}
// A block's water bed (#2434) that is missing, isn't a raster layer or shares its name with
// another layer gives no floor (`block::water_runs` reads it as the terrain command takes it):
// said, and kept, so a raster layer of that name brings it back.
let unread: Vec<String> = s
.project
.maps
.get(range.clone())
.unwrap_or_default()
.iter()
.filter_map(|m| {
let bed = m.view.terrain.as_ref()?.block.as_ref()?.water.as_ref()?.bed.as_ref()?;
let mut named = m.layers.iter().filter(|l| l.name.eq_ignore_ascii_case(bed));
let read = named.next().filter(|l| l.raster.is_some()).is_some() && named.next().is_none();
(!read).then(|| format!("{} ('{bed}')", m.name))
})
.collect();
match unread.as_slice() {
[] => {}
[one] => s.notify(
format!("{one}: the block's water bed is missing, isn't a raster layer, or shares its name with another layer, so its walls show the water down to its depth or field (none without either)"),
false,
),
_ => s.notify(
format!(
"{} block diagrams have a water bed that is missing, isn't a raster layer, or shares its name with another layer, so their walls show the water down to its depth or field (none without either): {}",
unread.len(),
unread.join(", ")
),
false,
),
}
}

/// Replaces project authority, clearing the exchange record, item trust and active connections.
fn reset(s: &mut Session, p: Project) {
s.exchange = None;
Expand Down Expand Up @@ -386,19 +480,6 @@ fn reset(s: &mut Session, p: Project) {
);
}
}
// A block whose walls layer (#1914) is missing, holds no polygons, is read a view at a time or
// shares its name with another layer draws its walls in their own colour (`block::runs`, as
// the terrain command refuses such a layer): said, and kept, so a polygon layer of that name
// colours them again.
let plain: Vec<String> = s
.project
.maps
.iter()
.filter_map(|m| {
let l = m.view.terrain.as_ref()?.block.as_ref()?.walls_layer.as_ref()?;
rustgis_render::terrain::walls_layer(m, l).is_none().then(|| format!("{} ('{l}')", m.name))
})
.collect();
// A block cut to polygons (#2318) whose layer is missing or picks no polygon with an area
// isn't drawn: said, and kept, so a polygon layer of that name, or an edit, brings it back.
// One whose outline was simplified to stay under 65 535 sides is said as `map.terrain` says
Expand Down Expand Up @@ -436,50 +517,7 @@ fn reset(s: &mut Session, p: Project) {
);
super::terrain_blocks::told_uncut(s);
}
match plain.as_slice() {
[] => {}
[one] => s.notify(
format!("{one}: the block diagram's walls layer is missing, isn't a polygon layer, holds its features only a view at a time, or shares its name with another layer, so its walls are one colour"),
false,
),
_ => s.notify(
format!(
"{} block diagrams have a walls layer that is missing, isn't a polygon layer, holds its features only a view at a time, or shares its name with another layer, so their walls are one colour: {}",
plain.len(),
plain.join(", ")
),
false,
),
}
// A block's water bed (#2434) that is missing, isn't a raster layer or shares its name with
// another layer gives no floor (`block::water_runs` reads it as the terrain command takes it):
// said, and kept, so a raster layer of that name brings it back.
let unread: Vec<String> = s
.project
.maps
.iter()
.filter_map(|m| {
let bed = m.view.terrain.as_ref()?.block.as_ref()?.water.as_ref()?.bed.as_ref()?;
let mut named = m.layers.iter().filter(|l| l.name.eq_ignore_ascii_case(bed));
let read = named.next().filter(|l| l.raster.is_some()).is_some() && named.next().is_none();
(!read).then(|| format!("{} ('{bed}')", m.name))
})
.collect();
match unread.as_slice() {
[] => {}
[one] => s.notify(
format!("{one}: the block's water bed is missing, isn't a raster layer, or shares its name with another layer, so its walls show the water down to its depth or field (none without either)"),
false,
),
_ => s.notify(
format!(
"{} block diagrams have a water bed that is missing, isn't a raster layer, or shares its name with another layer, so their walls show the water down to its depth or field (none without either): {}",
unread.len(),
unread.join(", ")
),
false,
),
}
say_block_layers(s, 0..s.project.maps.len());
// Water on a layer read a view at a time (#2305), which `map.terrain` refuses, would come
// from the rows the view holds (the map draws none from it): dropped and said, as the project
// opens.
Expand Down
1 change: 1 addition & 0 deletions crates/engine/src/cmd/terrain_blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,6 +304,7 @@ mod tests {
depth: None,
walls: BLOCK_WALLS,
walls_layer: None,
walls_top: None,
shape: Default::default(),
water: None,
}),
Expand Down
Loading
Loading