Struct Visu
pub struct Visu {
pub client: VisuClient,
}Expand description
The high-level client for the 3D visualization service.
Fields§
§client: VisuClientThe underlying client router.
Implementations§
§impl Visu
impl Visu
pub fn add_line_basic_material(
&self,
color: [f64; 3],
options: LineBasicMaterialOptions,
) -> Result<LineBasicMaterial>
pub fn add_line_basic_material( &self, color: [f64; 3], options: LineBasicMaterialOptions, ) -> Result<LineBasicMaterial>
Adds a line basic material.
§impl Visu
impl Visu
pub fn add_mesh_basic_material(
&self,
color: [f64; 3],
options: MeshBasicMaterialOptions,
) -> Result<MeshBasicMaterial>
pub fn add_mesh_basic_material( &self, color: [f64; 3], options: MeshBasicMaterialOptions, ) -> Result<MeshBasicMaterial>
Adds a mesh basic material.
§impl Visu
impl Visu
pub fn add_mesh_standard_material(
&self,
color: [f64; 3],
options: MeshStandardMaterialOptions,
) -> Result<MeshStandardMaterial>
pub fn add_mesh_standard_material( &self, color: [f64; 3], options: MeshStandardMaterialOptions, ) -> Result<MeshStandardMaterial>
Adds a mesh standard material.
§impl Visu
impl Visu
pub fn add_points_material(
&self,
color: [f64; 3],
options: PointsMaterialOptions,
) -> Result<PointsMaterial>
pub fn add_points_material( &self, color: [f64; 3], options: PointsMaterialOptions, ) -> Result<PointsMaterial>
Adds a points material.
§impl Visu
impl Visu
pub fn add_camera(&self, options: CameraOptions) -> Result<Camera>
pub fn add_camera(&self, options: CameraOptions) -> Result<Camera>
Adds a camera object.
pub fn get_camera(&self, identifier: &str) -> Result<Camera>
pub fn get_camera(&self, identifier: &str) -> Result<Camera>
Gets the camera object for the provided identifier.
§Errors
Returns Error::ObjectTypeMismatch
if the server object is not a camera.
§impl Visu
impl Visu
pub fn add_cylinder(&self, options: CylinderOptions) -> Result<Cylinder>
pub fn add_cylinder(&self, options: CylinderOptions) -> Result<Cylinder>
Adds a cylinder object.
pub fn get_cylinder(&self, identifier: &str) -> Result<Cylinder>
pub fn get_cylinder(&self, identifier: &str) -> Result<Cylinder>
Gets the cylinder object for the provided identifier.
§Errors
Returns Error::ObjectTypeMismatch
if the server object is not a cylinder.
§impl Visu
impl Visu
pub fn add_line(&self, points: PointsType, options: LineOptions) -> Result<Line>
pub fn add_line(&self, points: PointsType, options: LineOptions) -> Result<Line>
Adds a line object.
If options.segments is enabled the number of points must be even.
§impl Visu
impl Visu
pub fn add_model(
&self,
source: ModelSource,
options: ModelOptions,
) -> Result<Model>
pub fn add_model( &self, source: ModelSource, options: ModelOptions, ) -> Result<Model>
Adds a model object loaded from a local path or remote URL.
Local files are cached by content hash and remote URLs by URL, so the model is only uploaded when it is not already present on the server.
Returns Error::Value if both rotation and quaternion are set.
§impl Visu
impl Visu
pub fn add_point_cloud(
&self,
data_format: PointCloudFormat,
options: PointCloudOptions,
) -> Result<PointCloud>
pub fn add_point_cloud( &self, data_format: PointCloudFormat, options: PointCloudOptions, ) -> Result<PointCloud>
Adds a point cloud object.
pub fn get_point_cloud(&self, identifier: &str) -> Result<PointCloud>
pub fn get_point_cloud(&self, identifier: &str) -> Result<PointCloud>
Gets the point cloud object for the provided identifier.
§Errors
Returns Error::ObjectTypeMismatch
if the server object is not a point cloud.
§impl Visu
impl Visu
pub fn add_sphere(&self, options: SphereOptions) -> Result<Sphere>
pub fn add_sphere(&self, options: SphereOptions) -> Result<Sphere>
Adds a sphere object.
pub fn get_sphere(&self, identifier: &str) -> Result<Sphere>
pub fn get_sphere(&self, identifier: &str) -> Result<Sphere>
Gets the sphere object for the provided identifier.
§Errors
Returns Error::ObjectTypeMismatch
if the server object is not a sphere.
§impl Visu
impl Visu
pub fn add_text_panel(
&self,
text: &str,
options: TextPanelOptions,
) -> Result<TextPanel>
pub fn add_text_panel( &self, text: &str, options: TextPanelOptions, ) -> Result<TextPanel>
Adds a text panel object.
pub fn get_text_panel(&self, identifier: &str) -> Result<TextPanel>
pub fn get_text_panel(&self, identifier: &str) -> Result<TextPanel>
Gets the text panel object for the provided identifier.
§Errors
Returns Error::ObjectTypeMismatch
if the server object is not a text panel.
§impl Visu
impl Visu
pub fn new(
http_uri: &str,
clear: bool,
ignore_meta_check: bool,
clear_all: bool,
identifier: Option<String>,
) -> Result<Self>
pub fn new( http_uri: &str, clear: bool, ignore_meta_check: bool, clear_all: bool, identifier: Option<String>, ) -> Result<Self>
Initializes the client for the 3D visualization service.
clearclears all objects and materials for this client’s identifier.clear_allclears the entire scene (takes precedence overclear).ignore_meta_checkskips the server name and version check.
pub fn with_timeout(
http_uri: &str,
clear: bool,
ignore_meta_check: bool,
clear_all: bool,
identifier: Option<String>,
timeout_s: f64,
) -> Result<Self>
pub fn with_timeout( http_uri: &str, clear: bool, ignore_meta_check: bool, clear_all: bool, identifier: Option<String>, timeout_s: f64, ) -> Result<Self>
Initializes the client with an explicit request timeout.
pub fn get_objects(&self) -> Result<Vec<AnyObject>>
pub fn get_objects(&self) -> Result<Vec<AnyObject>>
Gets all objects in the scene as their typed write-access helpers.
pub fn get_object(&self, identifier: &str) -> Result<AnyObject>
pub fn get_object(&self, identifier: &str) -> Result<AnyObject>
Gets a single object by its identifier as its typed write-access helper.
pub fn add_hash_instruction(
&self,
anchor: &str,
instructions: Vec<Instruction>,
) -> Result<AnchorInstruction>
pub fn add_hash_instruction( &self, anchor: &str, instructions: Vec<Instruction>, ) -> Result<AnchorInstruction>
Adds a hash (anchor) instruction.
The instructions are flattened into a single ordered map and stored
under anchor.
pub fn disconnect(&mut self)
pub fn disconnect(&mut self)
Closes the live websocket connection (no-op if not connected).
pub fn connection(&mut self) -> Result<ConnectionGuard<'_>>
pub fn connection(&mut self) -> Result<ConnectionGuard<'_>>
Opens the live connection and returns an RAII guard that closes it on drop.
The guard dereferences to Visu, so live operations such as
Visu::update can be called through it.
pub fn update(&mut self, instructions: Vec<Instruction>) -> Result<()>
pub fn update(&mut self, instructions: Vec<Instruction>) -> Result<()>
Sends live updates via the websocket connection.
Requires an open connection (see Visu::connection).