pub struct ViewerState {
pub version: u32,
pub camera: Camera,
pub viewport: ViewportSize,
pub layers: Vec<LayerPresentation>,
pub selected_layer: Option<LayerId>,
pub pending_files: Vec<String>,
}Expand description
Portable state shared by native, Web, Python, and notebook surfaces.
Fields§
§version: u32Schema version, currently VIEWER_STATE_VERSION.
camera: CameraActive camera.
viewport: ViewportSizeLogical viewport dimensions.
layers: Vec<LayerPresentation>Ordered layer presentation state.
selected_layer: Option<LayerId>Selected layer identity.
pending_files: Vec<String>Validated data files queued by native drag/drop.
Implementations§
Source§impl ViewerState
impl ViewerState
Sourcepub fn try_new(camera: Camera, viewport: ViewportSize) -> ViewerResult<Self>
pub fn try_new(camera: Camera, viewport: ViewportSize) -> ViewerResult<Self>
Creates an empty viewer state.
Sourcepub fn validate(&self) -> ViewerResult<()>
pub fn validate(&self) -> ViewerResult<()>
Validates the complete portable state before it is handed to a renderer, serialized, or embedded in a larger Studio state.
Sourcepub fn sync_scene(&mut self, scene: &VisualScene<'_>)
pub fn sync_scene(&mut self, scene: &VisualScene<'_>)
Synchronizes layer metadata from a borrowed visual scene.
Existing visibility and style edits are retained for matching stable IDs.
Sourcepub fn set_layer_visible(
&mut self,
id: &LayerId,
visible: bool,
) -> ViewerResult<()>
pub fn set_layer_visible( &mut self, id: &LayerId, visible: bool, ) -> ViewerResult<()>
Changes a layer’s visibility.
Sourcepub fn select_layer(&mut self, id: Option<&LayerId>) -> ViewerResult<()>
pub fn select_layer(&mut self, id: Option<&LayerId>) -> ViewerResult<()>
Selects a layer for attribute inspection.
Sourcepub fn set_layer_style(
&mut self,
id: &LayerId,
style: VisualStyle,
) -> ViewerResult<()>
pub fn set_layer_style( &mut self, id: &LayerId, style: VisualStyle, ) -> ViewerResult<()>
Replaces the visual style after validating attribute compatibility.
Sourcepub fn inspector(&self) -> Option<InspectorSelection<'_>>
pub fn inspector(&self) -> Option<InspectorSelection<'_>>
Returns the selected layer and active point attribute.
Sourcepub fn queue_dropped_file(
&mut self,
path: impl Into<String>,
) -> ViewerResult<()>
pub fn queue_dropped_file( &mut self, path: impl Into<String>, ) -> ViewerResult<()>
Queues a supported point-cloud file from drag/drop.
Trait Implementations§
Source§impl Clone for ViewerState
impl Clone for ViewerState
Source§fn clone(&self) -> ViewerState
fn clone(&self) -> ViewerState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ViewerState
impl Debug for ViewerState
Source§impl<'de> Deserialize<'de> for ViewerState
impl<'de> Deserialize<'de> for ViewerState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for ViewerState
impl PartialEq for ViewerState
Source§fn eq(&self, other: &ViewerState) -> bool
fn eq(&self, other: &ViewerState) -> bool
self and other values to be equal, and is used by ==.Source§impl Serialize for ViewerState
impl Serialize for ViewerState
impl StructuralPartialEq for ViewerState
Auto Trait Implementations§
impl Freeze for ViewerState
impl RefUnwindSafe for ViewerState
impl Send for ViewerState
impl Sync for ViewerState
impl Unpin for ViewerState
impl UnsafeUnpin for ViewerState
impl UnwindSafe for ViewerState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more