Skip to content

Commit

Permalink
Rename Label, add TextDocument
Browse files Browse the repository at this point in the history
  • Loading branch information
emilk committed Sep 6, 2023
1 parent 09350ab commit fcefc12
Show file tree
Hide file tree
Showing 137 changed files with 1,517 additions and 582 deletions.
14 changes: 12 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ re_space_view_bar_chart = { path = "crates/re_space_view_bar_chart", version = "
re_space_view_spatial = { path = "crates/re_space_view_spatial", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_tensor = { path = "crates/re_space_view_tensor", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_text = { path = "crates/re_space_view_text", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_text_box = { path = "crates/re_space_view_text_box", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_text_document = { path = "crates/re_space_view_text_document", version = "=0.9.0-alpha.3", default-features = false }
re_space_view_time_series = { path = "crates/re_space_view_time_series", version = "=0.9.0-alpha.3", default-features = false }
re_string_interner = { path = "crates/re_string_interner", version = "=0.9.0-alpha.3", default-features = false }
re_tensor_ops = { path = "crates/re_tensor_ops", version = "=0.9.0-alpha.3", default-features = false }
Expand Down
6 changes: 3 additions & 3 deletions crates/re_components/src/datagen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ pub fn build_some_instances_from(instances: impl IntoIterator<Item = u64>) -> Ve
#[cfg(not(target_arch = "wasm32"))]
pub fn data_table_example(timeless: bool) -> re_log_types::DataTable {
use re_log_types::{DataRow, DataTable, RowId, TableId, TimePoint};
use re_types::components::{Color, Label, Point2D};
use re_types::components::{Color, Point2D, Text};

let table_id = TableId::random();

Expand All @@ -110,7 +110,7 @@ pub fn data_table_example(timeless: bool) -> re_log_types::DataTable {
let num_instances = 2;
let points: &[Point2D] = &[[10.0, 10.0].into(), [20.0, 20.0].into()];
let colors: &[_] = &[Color::from_rgb(128, 128, 128)];
let labels: &[Label] = &[];
let labels: &[Text] = &[];

DataRow::from_cells3(
RowId::random(),
Expand All @@ -131,7 +131,7 @@ pub fn data_table_example(timeless: bool) -> re_log_types::DataTable {
let row2 = {
let num_instances = 1;
let colors: &[_] = &[Color::from_rgb(255, 255, 255)];
let labels: &[_] = &[Label("hey".into())];
let labels: &[_] = &[Text("hey".into())];

DataRow::from_cells2(
RowId::random(),
Expand Down
10 changes: 4 additions & 6 deletions crates/re_components/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use arrow2_convert::{
serialize::ArrowSerialize,
};
use lazy_static::lazy_static;

use re_types::Loggable;

mod bbox;
Expand All @@ -29,7 +30,6 @@ mod rect;
mod scalar;
mod tensor;
mod tensor_data;
mod text_box;
mod text_entry;
mod vec;

Expand All @@ -56,7 +56,6 @@ pub use self::{
DecodedTensor, Tensor, TensorCastError, TensorData, TensorDataMeaning, TensorDimension,
},
tensor_data::{TensorDataType, TensorDataTypeTrait, TensorElement},
text_box::TextBox,
text_entry::TextEntry,
};

Expand All @@ -83,12 +82,12 @@ pub mod external {

use re_types::components::{
AnnotationContext, ClassId, Color, DisconnectedSpace, DrawOrder, InstanceKey, KeypointId,
Label, LineStrip2D, LineStrip3D, Origin3D, Point2D, Point3D, Radius, Transform3D, Vector3D,
LineStrip2D, LineStrip3D, Origin3D, Point2D, Point3D, Radius, Text, Transform3D, Vector3D,
};

lazy_static! {
//TODO(john): use a run-time type registry
static ref FIELDS: [Field; 28] = [
static ref FIELDS: [Field; 27] = [
<Box3D as LegacyComponent>::field(),
<LegacyVec3D as LegacyComponent>::field(),
<Mesh3D as LegacyComponent>::field(),
Expand All @@ -98,7 +97,6 @@ lazy_static! {
<Scalar as LegacyComponent>::field(),
<ScalarPlotProps as LegacyComponent>::field(),
<Tensor as LegacyComponent>::field(),
<TextBox as LegacyComponent>::field(),
<TextEntry as LegacyComponent>::field(),
<ViewCoordinates as LegacyComponent>::field(),
AnnotationContext::arrow_field(),
Expand All @@ -108,13 +106,13 @@ lazy_static! {
DrawOrder::arrow_field(),
InstanceKey::arrow_field(),
KeypointId::arrow_field(),
Label::arrow_field(),
LineStrip2D::arrow_field(),
LineStrip3D::arrow_field(),
Origin3D::arrow_field(),
Point2D::arrow_field(),
Point3D::arrow_field(),
Radius::arrow_field(),
Text::arrow_field(),
Transform3D::arrow_field(),
Vector3D::arrow_field(),
];
Expand Down
43 changes: 0 additions & 43 deletions crates/re_components/src/text_box.rs

This file was deleted.

4 changes: 2 additions & 2 deletions crates/re_components/tests/data_row.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use re_log_types::{DataRow, DataRowError, EntityPath, RowId, TimePoint};
use re_types::{
components::{Color, Label, Point2D},
components::{Color, Point2D, Text},
Loggable as _,
};

Expand All @@ -12,7 +12,7 @@ fn data_row_error_num_instances() {
let num_instances = 2;
let points: &[Point2D] = &[[10.0, 10.0].into(), [20.0, 20.0].into()];
let colors: &[_] = &[Color::from_rgb(128, 128, 128)];
let labels: &[Label] = &[];
let labels: &[Text] = &[];

// 0 = clear: legal
DataRow::try_from_cells1(row_id, "a/b/c", timepoint.clone(), num_instances, labels).unwrap();
Expand Down
8 changes: 4 additions & 4 deletions crates/re_components/tests/data_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,9 @@ fn data_table_sizes_basics() {
// utf8 (and more generally: dyn_binary)
let mut cell = DataCell::from_native(
[
re_types::components::Label("hey".into()),
re_types::components::Label("hey".into()),
re_types::components::Label("hey".into()),
re_types::components::Text("hey".into()),
re_types::components::Text("hey".into()),
re_types::components::Text("hey".into()),
]
.as_slice(),
);
Expand All @@ -79,7 +79,7 @@ fn data_table_sizes_basics() {
);
expect(
DataCell::from_arrow(
re_types::components::Label::name(),
re_types::components::Text::name(),
cell.to_arrow().sliced(1, 1),
),
10_000, // num_rows
Expand Down
6 changes: 3 additions & 3 deletions crates/re_components/tests/data_table_batcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use re_log_types::{
DataRow, DataTableBatcher, DataTableBatcherConfig, RowId, SizeBytes, TimePoint, Timeline,
};
use re_log_types::{DataTable, TableId, Time};
use re_types::components::{Color, Label, Point2D};
use re_types::components::{Color, Point2D, Text};

#[test]
fn manual_trigger() {
Expand Down Expand Up @@ -283,7 +283,7 @@ fn create_table() -> DataTable {
let num_instances = 2;
let points: &[Point2D] = &[[10.0, 10.0].into(), [20.0, 20.0].into()];
let colors: &[_] = &[Color::from_rgb(128, 128, 128)];
let labels: &[Label] = &[];
let labels: &[Text] = &[];

DataRow::from_cells3(
RowId::random(),
Expand All @@ -304,7 +304,7 @@ fn create_table() -> DataTable {
let row2 = {
let num_instances = 1;
let colors: &[_] = &[Color::from_rgb(255, 255, 255)];
let labels: &[_] = &[Label("hey".into())];
let labels: &[_] = &[Text("hey".into())];

DataRow::from_cells2(
RowId::random(),
Expand Down
10 changes: 5 additions & 5 deletions crates/re_query/benches/query_benchmark2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use re_log_types::{entity_path, DataRow, EntityPath, Index, RowId, TimeInt, Time
use re_query::query_archetype;
use re_types::{
archetypes::Points2D,
components::{Color, InstanceKey, Label, Point2D},
components::{Color, InstanceKey, Point2D, Text},
Loggable as _,
};

Expand Down Expand Up @@ -64,7 +64,7 @@ pub fn build_frame_nr(frame_nr: TimeInt) -> (Timeline, TimeInt) {
(Timeline::new("frame_nr", TimeType::Sequence), frame_nr)
}

pub fn build_some_strings(len: usize) -> Vec<Label> {
pub fn build_some_strings(len: usize) -> Vec<Text> {
use rand::Rng as _;
let mut rng = rand::thread_rng();

Expand All @@ -76,7 +76,7 @@ pub fn build_some_strings(len: usize) -> Vec<Label> {
.take(ilen)
.map(char::from)
.collect();
Label::from(s)
Text::from(s)
})
.collect()
}
Expand Down Expand Up @@ -278,7 +278,7 @@ fn query_and_visit_points(store: &mut DataStore, paths: &[EntityPath]) -> Vec<Sa
}

struct SaveString {
_label: Option<Label>,
_label: Option<Text>,
}

fn query_and_visit_strings(store: &mut DataStore, paths: &[EntityPath]) -> Vec<SaveString> {
Expand All @@ -290,7 +290,7 @@ fn query_and_visit_strings(store: &mut DataStore, paths: &[EntityPath]) -> Vec<S
for path in paths {
let arch_view = query_archetype::<Points2D>(store, &query, path).unwrap();
arch_view
.iter_optional_component::<Label>()
.iter_optional_component::<Text>()
.unwrap()
.for_each(|label| {
strings.push(SaveString { _label: label });
Expand Down
2 changes: 1 addition & 1 deletion crates/re_sdk/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ pub mod components {
};
pub use re_types::components::{
AnnotationContext, ClassId, Color, DisconnectedSpace, DrawOrder, InstanceKey, KeypointId,
Label, LineStrip2D, LineStrip3D, Origin3D, Point2D, Point3D, Radius, Transform3D, Vector3D,
LineStrip2D, LineStrip3D, Origin3D, Point2D, Point3D, Radius, Text, Transform3D, Vector3D,
};
}

Expand Down
Loading

0 comments on commit fcefc12

Please sign in to comment.