Repository navigation
feat(layout): a profile element beside a map frame (#2863 part 2a) #3277
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
elpidioassinaturas
merged 5 commits into
opengeos:main
from
elpidioassinaturas:feat/2863-margin-profiles-2a
Nov 29, 2026
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
99951c7
feat(layout): a profile element beside a map frame (#2863 part 2a)
elpidiofilho f192f10
Merge remote-tracking branch 'origin/main' into feat/2863-margin-prof…
elpidiofilho b2e8670
fix(layout): a profile's crossed value axis is dropped when read, cou…
elpidiofilho 715f603
fix(layout): a profile's import requires layout-profile; its copy and…
elpidiofilho 23821aa
fix(layout): a box given to a profile by layout.update is said (#2863…
elpidiofilho File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,48 @@ | ||
| //! Profiles beside a layout's map frame (#2863 part 2): the commands and what they say. | ||
|
|
||
| use crate::{Session, sample}; | ||
| use rustgis_map::layout::{ElementKind, Profile, ProfileSide}; | ||
| use serde_json::json; | ||
|
|
||
| /// A profile put beside the first frame of the session's first layout, and its id. | ||
| fn put_profile(s: &mut Session, frame: u32, side: ProfileSide) -> u32 { | ||
| let l = &mut s.project.layouts[0]; | ||
| let e = l.element(frame).expect("the frame"); | ||
| let at = (e.x, e.y, e.w, e.h); | ||
| let p = Profile::new(frame, "A".into(), "DEM".into(), side); | ||
| l.add("Profile", p.rect(at), ElementKind::Profile(p)) | ||
| } | ||
|
|
||
| /// A profile's copy stays beside its frame, over the original, and says it took no offset. | ||
| #[test] | ||
| fn a_profiles_copy_keeps_beside_its_frame_and_says_so() { | ||
| let mut s = Session::new(sample::world_project()); | ||
| s.run("layout.new", &json!({"page": "a4", "template": "map"})).unwrap(); | ||
| let frame = s.project.layouts[0].first_frame().unwrap(); | ||
| let id = put_profile(&mut s, frame, ProfileSide::Bottom); | ||
| let mark = s.notice_mark(); | ||
| let copy = s.run("layout.duplicateElement", &json!({"element": id, "dx": 20})).unwrap()["element"].as_u64().unwrap(); | ||
| let box_of = |id: u64| s.project.layouts[0].element(id as u32).map(|e| (e.x, e.y, e.w, e.h)); | ||
| assert_eq!(box_of(copy), box_of(u64::from(id))); | ||
| let said: Vec<String> = s.notices_since(mark).iter().map(|n| n.text.clone()).collect(); | ||
| assert!(said.iter().any(|t| t.contains("beside its frame") && t.contains("offset")), "{said:?}"); | ||
| } | ||
|
|
||
| /// A box given to a profile is its frame's side again, and said; the frame's own move is not. | ||
| #[test] | ||
| fn a_box_given_to_a_profile_is_said_not_kept() { | ||
| let mut s = Session::new(sample::world_project()); | ||
| s.run("layout.new", &json!({"page": "a4", "template": "map"})).unwrap(); | ||
| let frame = s.project.layouts[0].first_frame().unwrap(); | ||
| let id = put_profile(&mut s, frame, ProfileSide::Bottom); | ||
| let box_of = |s: &Session| s.project.layouts[0].element(id).map(|e| (e.x, e.y, e.w, e.h)); | ||
| let at = box_of(&s); | ||
| let mark = s.notice_mark(); | ||
| s.run("layout.update", &json!({"element": id, "x": 5, "h": 50})).unwrap(); | ||
| assert_eq!(box_of(&s), at); | ||
| let said: Vec<String> = s.notices_since(mark).iter().map(|n| n.text.clone()).collect(); | ||
| assert!(said.iter().any(|t| t.contains("Profile") && t.contains("beside its frame")), "{said:?}"); | ||
| let mark = s.notice_mark(); | ||
| s.run("layout.update", &json!({"element": frame, "x": 20})).unwrap(); | ||
| assert!(s.notices_since(mark).is_empty(), "the frame takes its profile along"); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.