rvlib/tools_data/annotations/
mod.rs1pub use self::bbox_annotations::BboxAnnotations;
3pub use self::bbox_splitmode::SplitMode;
4pub use self::brush_annotations::BrushAnnotations;
5pub use self::core::{ClipboardData, InstanceAnnotations};
6
7mod bbox_annotations;
8mod bbox_splitmode;
9mod brush_annotations;
10mod core;
11#[macro_export]
12macro_rules! implement_annotations_getters {
13 ($tool_data_type:ident) => {
14 pub fn get_annos_mut(
15 &mut self,
16 file_path: &str,
17 shape_initial: ShapeI,
18 ) -> Option<&mut $tool_data_type> {
19 if !self.annotations_map.contains_key(file_path) {
20 self.annotations_map.insert(
21 file_path.to_string(),
22 ($tool_data_type::default(), shape_initial),
23 );
24 } else {
25 if let Some((_, shape)) = self.annotations_map.get_mut(file_path) {
28 if *shape != shape_initial {
29 *shape = shape_initial;
30 }
31 }
32 }
33 self.annotations_map
34 .get_mut(file_path)
35 .map(|(annos, _)| annos)
36 }
37 #[must_use]
38 pub fn get_annos(&self, file_path: &str) -> Option<&$tool_data_type> {
39 let annos = self.annotations_map.get(file_path);
40 annos.map(|(annos, _shape)| annos)
41 }
42 pub fn get_annos_mut_noinsert(&mut self, file_path: &str) -> Option<&mut $tool_data_type> {
43 self.annotations_map
44 .get_mut(file_path)
45 .map(|(annos, _)| annos)
46 }
47 pub fn anno_iter_mut(
48 &mut self,
49 ) -> impl Iterator<Item = (&String, &mut ($tool_data_type, ShapeI))> {
50 self.annotations_map.iter_mut()
51 }
52 pub fn anno_iter(&self) -> impl Iterator<Item = (&String, &($tool_data_type, ShapeI))> {
53 self.annotations_map.iter()
54 }
55 pub fn anno_intoiter(self) -> impl Iterator<Item = (String, ($tool_data_type, ShapeI))> {
56 self.annotations_map.into_iter()
57 }
58 };
59}