Skip to content

Commit

Permalink
get rid of the old defunct process_labels_3d
Browse files Browse the repository at this point in the history
  • Loading branch information
teh-cmc committed Jul 31, 2024
1 parent 0aecf27 commit 13bcc8d
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use crate::{

use super::{
entity_iterator::clamped_or, process_annotation_and_keypoint_slices, process_color_slice,
process_labels_3d_2, process_radius_slice, SpatialViewVisualizerData,
process_labels_3d, process_radius_slice, SpatialViewVisualizerData,
SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES,
};

Expand Down Expand Up @@ -136,7 +136,7 @@ impl Arrows3DVisualizer {
))
};

self.data.ui_labels.extend(process_labels_3d_2(
self.data.ui_labels.extend(process_labels_3d(
entity_path,
label_positions,
&data.labels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ use crate::{

use super::{
entity_iterator::clamped_or, filter_visualizable_3d_entities,
process_annotation_and_keypoint_slices, process_color_slice, process_labels_3d_2,
process_annotation_and_keypoint_slices, process_color_slice, process_labels_3d,
process_radius_slice, SpatialViewVisualizerData, SIZE_BOOST_IN_POINTS_FOR_LINE_OUTLINES,
};

Expand Down Expand Up @@ -171,7 +171,7 @@ impl Boxes3DVisualizer {
)
};

self.0.ui_labels.extend(process_labels_3d_2(
self.0.ui_labels.extend(process_labels_3d(
entity_path,
label_positions,
&data.labels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use re_viewer_context::{

use crate::{
contexts::SpatialSceneEntityContext, view_kind::SpatialSpaceViewKind,
visualizers::process_labels_3d_2,
visualizers::process_labels_3d,
};

use super::{
Expand Down Expand Up @@ -129,7 +129,7 @@ impl Lines3DVisualizer {
}))
};

self.data.ui_labels.extend(process_labels_3d_2(
self.data.ui_labels.extend(process_labels_3d(
entity_path,
label_positions,
&data.labels,
Expand Down
6 changes: 3 additions & 3 deletions crates/viewer/re_space_view_spatial/src/visualizers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ pub use images::ImageVisualizer;
pub use segmentation_images::SegmentationImageVisualizer;
pub use transform3d_arrows::{add_axis_arrows, AxisLengthDetector, Transform3DArrowsVisualizer};
pub use utilities::{
bounding_box_for_textured_rect, entity_iterator, process_labels_3d, process_labels_3d_2,
textured_rect_from_image, textured_rect_from_tensor, SpatialViewVisualizerData, UiLabel,
UiLabelTarget, MAX_NUM_LABELS_PER_ENTITY,
bounding_box_for_textured_rect, entity_iterator, process_labels_3d, textured_rect_from_image,
textured_rect_from_tensor, SpatialViewVisualizerData, UiLabel, UiLabelTarget,
MAX_NUM_LABELS_PER_ENTITY,
};

// ---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::{
};

use super::{
filter_visualizable_3d_entities, process_labels_3d_2, SpatialViewVisualizerData,
filter_visualizable_3d_entities, process_labels_3d, SpatialViewVisualizerData,
SIZE_BOOST_IN_POINTS_FOR_POINT_OUTLINES,
};

Expand Down Expand Up @@ -144,7 +144,7 @@ impl Points3DVisualizer {
positions
};

self.data.ui_labels.extend(process_labels_3d_2(
self.data.ui_labels.extend(process_labels_3d(
entity_path,
label_positions.iter().copied(),
&data.labels,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,41 +39,7 @@ pub const MAX_NUM_LABELS_PER_ENTITY: usize = 30;
///
/// Does nothing if there's no positions or no labels passed.
/// Otherwise, produces one label per position passed.
//
// TODO(cmc): remove
pub fn process_labels_3d<'a>(
entity_path: &'a EntityPath,
positions: impl Iterator<Item = glam::Vec3> + 'a,
labels: &'a [re_types::components::Text],
colors: &'a [egui::Color32],
annotation_infos: &'a ResolvedAnnotationInfos,
world_from_obj: glam::Affine3A,
) -> impl Iterator<Item = UiLabel> + 'a {
let labels = izip!(
annotation_infos.iter(),
labels.iter().map(Some).chain(std::iter::repeat(None))
)
.map(|(annotation_info, label)| annotation_info.label(label.map(|l| l.as_str())));

let colors = clamped_or(colors, &egui::Color32::WHITE);

itertools::izip!(positions, labels, colors)
.enumerate()
.filter_map(move |(i, (point, label, color))| {
label.map(|label| UiLabel {
text: label,
color: *color,
target: UiLabelTarget::Position3D(world_from_obj.transform_point3(point)),
labeled_instance: InstancePathHash::instance(entity_path, Instance::from(i as u64)),
})
})
}

/// Produces 3D ui labels from component data.
///
/// Does nothing if there's no positions or no labels passed.
/// Otherwise, produces one label per position passed.
pub fn process_labels_3d_2<'a>(
entity_path: &'a EntityPath,
positions: impl Iterator<Item = glam::Vec3> + 'a,
labels: &'a [re_types::ArrowString],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ mod spatial_view_visualizer;
mod textured_rect;

pub use labels::{
process_labels_2d, process_labels_3d, process_labels_3d_2, UiLabel, UiLabelTarget,
MAX_NUM_LABELS_PER_ENTITY,
process_labels_2d, process_labels_3d, UiLabel, UiLabelTarget, MAX_NUM_LABELS_PER_ENTITY,
};
pub use spatial_view_visualizer::SpatialViewVisualizerData;
pub use textured_rect::{
Expand Down

0 comments on commit 13bcc8d

Please sign in to comment.