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 instruction that is stored on the server under anchor.
A web client applies the instructions when its URL hash names the
anchor, e.g. http://localhost:8077/#top. Only that web client is
affected. The live data on the server and other clients stay unchanged.
Several anchors can be combined (#dark,top), later ones win on
conflicts. Adding an anchor with an existing name replaces its
instructions. The anchor name must not contain a comma.
Only the values contained in the instructions are overridden:
- Configuration values (e.g. the active camera, scene color, grid and logo) take precedence over the live data as long as the anchor is set and fall back to the live values once it is removed.
- Object and material values are applied when the anchor is set. Later live updates of the same values overwrite them, and removing the anchor does not restore the previous values.
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).