Skip to content
14 changes: 8 additions & 6 deletions crates/data/src/lidar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -692,25 +692,27 @@ mod tests {
/// the source, while missing records still prevent a whole read.
#[test]
fn source_materializes_with_counted_losses() {
let mut bytes = las(2, 0, &[(0.0, 0.0, 3.0, 2), (1.0, 0.0, 4.0, 2)], Some("EPSG:32632"));
// A finite scale overflows only the second point's X during coordinate decoding.
let mut bytes = las(2, 0, &[(0.0, 0.0, 3.0, 2), (1.0, 0.0, 4.0, 2), (0.0, 0.0, 5.0, 2)], Some("EPSG:32632"));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This hunk changes lidar test expectations (a third point, ids and counts), but the PR body is about Edit Vertices and says nothing about lidar. The code it tests isn't changed here, so the new expectations hold on main too. Please say in the PR description why this is in the change, or move it to its own PR.

Category: quality

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It came from #2852's late review (thread 4680084081), which asked for a test with the dropped point in the middle. #2852 had merged by then, so it was folded into this PR and the reply there points here. The code it tests is unchanged, as you say.

// A finite scale overflows only the second point's X during coordinate decoding: the one in
// the middle.
bytes[131..139].copy_from_slice(&f64::MAX.to_le_bytes());
let (direct, report) = read_bytes(&bytes, "lossy", None).unwrap();
assert_eq!(direct.features.len(), 1);
assert_eq!(direct.features.len(), 2);
assert!(!direct.crs_incomplete);
assert_eq!(report.skipped, 1);
assert_eq!(report.messages, ["lossy: one point has a coordinate that isn't a number (NaN or infinite) and was left out"]);
let src = crate::source::open_bytes("lossy.las", bytes.clone(), None).unwrap();
assert_eq!(src.info().count, Some(2));
assert_eq!(src.info().count, Some(3));
let (ds, report) = crate::source::materialize(src.as_ref()).unwrap();
assert_eq!(ds.features, direct.features);
assert!(!ds.crs_incomplete);
assert_eq!(report.skipped, 1);
assert_eq!(report.messages.len(), 1, "{:?}", report.messages);
// The sample's places stay in step with its points past the one left out.
// The sample's places stay in step with its points past the one left out: the point after
// it is found by its own place.
let around = Extent::new(4.0, -1.0, 5.0, 1.0);
let batch = src.read(&crate::source::Request { extent: Some(around), limit: 10, own: None }).unwrap();
assert_eq!(batch.features.iter().map(|f| f.id).collect::<Vec<_>>(), [0]);
assert_eq!(batch.features.iter().map(|f| f.id).collect::<Vec<_>>(), [0, 2]);
bytes.truncate(bytes.len() - usize::from(RECORD_LEN[0]));
assert!(crate::io::read_bytes("truncated.las", &bytes).is_err());
let truncated = crate::source::open_bytes("truncated.las", bytes, None).unwrap();
Expand Down
1 change: 1 addition & 0 deletions crates/ui-egui/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ pub use chrome::{DoubleClick, TitlebarMetrics};
pub use coordreadout::{CoordReadout, MapSystem};
pub use rustgis_assistant;
pub use rustgis_engine;
pub use vertexedit::unplaced_feature_notice;
pub use widgets::big_split_menu;

/// Reconciles only command-result wrappers, not parameters or other arbitrary JSON.
Expand Down
19 changes: 19 additions & 0 deletions crates/ui-egui/src/mapview.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,16 @@ pub struct MapView {
pub vertex_drag: Option<crate::vertexedit::VertexDrag>,
/// Non-owning source identity for the held vertex gesture; never persisted with the project.
pub(crate) vertex_drag_owner: Option<crate::vertexedit::DragOwner>,
/// The selected features Edit Vertices last said it can't give handles to (their place can't
/// be given in longitude/latitude), by map index, live layer ([`rustgis_engine::map::Layer::instance_id`])
/// and row, so it says so once per selection.
pub(crate) vertex_unplaced_said: Vec<(usize, u64, usize)>,
/// Whether there were more than those, the notice saying "at least" so many.
pub(crate) vertex_unplaced_more: bool,
/// How many of each layer's selected rows that scan went through, by live layer.
pub(crate) vertex_unplaced_visited: Vec<(u64, usize)>,
/// What those features were last looked for under, so they aren't looked for each frame.
pub(crate) vertex_unplaced_seen: Option<u64>,
/// Session-only opt-in for coincident polygon moves; never saved with a project or preference.
pub move_shared_vertices: bool,
/// A sketch vertex clicked on an edge follows that edge from the previous vertex (Trace);
Expand Down Expand Up @@ -450,6 +460,10 @@ impl Default for MapView {
vertex_owner: None,
vertex_drag: None,
vertex_drag_owner: None,
vertex_unplaced_said: Vec::new(),
vertex_unplaced_more: false,
vertex_unplaced_visited: Vec::new(),
vertex_unplaced_seen: None,
move_shared_vertices: false,
trace_edges: false,
sketch_full_said: false,
Expand Down Expand Up @@ -523,6 +537,10 @@ impl MapView {
self.split_gpu = None;
self.live_rev = None;
self.gpu_turn_declined = None;
self.vertex_unplaced_said.clear();
self.vertex_unplaced_more = false;
self.vertex_unplaced_visited.clear();
self.vertex_unplaced_seen = None;
self.labels.clear();
self.label_lonlat.clear();
self.label_map.clear();
Expand Down Expand Up @@ -810,6 +828,7 @@ pub fn show(app: &mut RustGisApp, ui: &mut Ui) {
crate::modelbuilder::follow_view(app);
view_tabs(app, ui, &t);
crate::vertexedit::cancel_stale_drag(app);
crate::vertexedit::say_unplaced(app);
if app.mb.shown() {
crate::modelbuilder::show(app, ui);
return;
Expand Down
Loading
Loading