pub struct RenderSessionHandle { /* private fields */ }Expand description
Owner-thread render session handle bound to a retained map.
Implementations§
Source§impl RenderSessionHandle
impl RenderSessionHandle
Sourcepub fn set_feature_state(
&self,
selector: &FeatureStateSelector,
state: &JsonValue,
) -> Result<()>
pub fn set_feature_state( &self, selector: &FeatureStateSelector, state: &JsonValue, ) -> Result<()>
Sets per-feature state on a render source for this session.
Sourcepub fn get_feature_state(
&self,
selector: &FeatureStateSelector,
) -> Result<JsonValue>
pub fn get_feature_state( &self, selector: &FeatureStateSelector, ) -> Result<JsonValue>
Copies per-feature state from a render source in this session.
Sourcepub fn remove_feature_state(
&self,
selector: &FeatureStateSelector,
) -> Result<()>
pub fn remove_feature_state( &self, selector: &FeatureStateSelector, ) -> Result<()>
Removes per-feature state selected for this session.
Sourcepub fn query_rendered_features(
&self,
geometry: &RenderedQueryGeometry,
options: Option<&RenderedFeatureQueryOptions>,
) -> Result<Vec<QueriedFeature>>
pub fn query_rendered_features( &self, geometry: &RenderedQueryGeometry, options: Option<&RenderedFeatureQueryOptions>, ) -> Result<Vec<QueriedFeature>>
Queries rendered features from the latest render session state.
Sourcepub fn query_source_features(
&self,
source_id: &str,
options: Option<&SourceFeatureQueryOptions>,
) -> Result<Vec<QueriedFeature>>
pub fn query_source_features( &self, source_id: &str, options: Option<&SourceFeatureQueryOptions>, ) -> Result<Vec<QueriedFeature>>
Queries source features from the latest render session state.
Sourcepub fn query_feature_extension(
&self,
source_id: &str,
feature: &Feature,
extension: &str,
extension_field: &str,
arguments: Option<&JsonValue>,
) -> Result<FeatureExtensionResult>
pub fn query_feature_extension( &self, source_id: &str, feature: &Feature, extension: &str, extension_field: &str, arguments: Option<&JsonValue>, ) -> Result<FeatureExtensionResult>
Queries a feature extension from the latest render session state.
The supercluster extension reads the cluster_id feature property and
the limit and offset arguments as JsonValue::UInt. Other numeric
types are treated as absent: a cluster_id that is not
JsonValue::UInt returns FeatureExtensionResult::Value holding
JsonValue::Null instead of a feature collection, and a limit or
offset that is not JsonValue::UInt leaves leaves at the native
defaults of ten leaves at offset zero. Queried feature properties keep
their JSON value type, so a queried cluster feature can be passed back
unmodified.
Source§impl RenderSessionHandle
impl RenderSessionHandle
Sourcepub fn close(self) -> Result<(), HandleOperationError<Self>>
pub fn close(self) -> Result<(), HandleOperationError<Self>>
Explicitly destroys the render session.
Native destruction errors are returned. When destruction fails, the
underlying native handle remains live so a later close can retry.
Sourcepub fn resize(&self, width: u32, height: u32, scale_factor: f64) -> Result<()>
pub fn resize(&self, width: u32, height: u32, scale_factor: f64) -> Result<()>
Resizes this attached render session.
Surface and owned-texture sessions resize in place. Borrowed texture targets are sized by their owner and report an unsupported-feature error: close this session, recreate the texture, and attach a new session. A map holds at most one attached session, so close before attaching the replacement.
Resizing discards the session renderer, so renderer-held state such as feature state does not survive. Map state such as camera, style, and sources lives on the map and survives both resize and reattach.
Sourcepub fn render_update(&self) -> Result<bool>
pub fn render_update(&self) -> Result<bool>
Processes the latest map render update for this render target.
The map retains its latest update, so repeated calls re-render it and
return true again; use this to redraw on demand after resize or
surface expose, and gate frame loops on render-update-available events
instead of the return value. Returns false when no frame was
rendered, because the map has not published an update yet or the
renderer skipped the frame; both are normal during startup, so keep
pumping the runtime until an update is reported.
Sourcepub fn detach(
self,
) -> Result<DetachedRenderSessionHandle, HandleOperationError<Self>>
pub fn detach( self, ) -> Result<DetachedRenderSessionHandle, HandleOperationError<Self>>
Detaches backend-bound render resources from the map.
The native session remains live only for destruction, so successful detach consumes this handle and returns a detached close-only handle.
Detach also releases this session’s retention of the parent map, so a detached session leaves the map free to close. Close the detached session whenever it suits the host; it stays destroyable after the map closes because a detached session no longer reaches its map.
Sourcepub fn reduce_memory_use(&self) -> Result<()>
pub fn reduce_memory_use(&self) -> Result<()>
Asks the session renderer to release cached resources where possible.
Sourcepub fn clear_data(&self) -> Result<()>
pub fn clear_data(&self) -> Result<()>
Clears renderer data for the session.
Sourcepub fn dump_debug_logs(&self) -> Result<()>
pub fn dump_debug_logs(&self) -> Result<()>
Dumps renderer debug logs through MapLibre Native logging.
Sourcepub fn texture_image_info(&self) -> Result<TextureImageInfo>
pub fn texture_image_info(&self) -> Result<TextureImageInfo>
Returns CPU readback metadata for the most recently rendered texture frame.
Sourcepub fn read_premultiplied_rgba8_into(
&self,
data: &mut [u8],
) -> Result<TextureImageInfo>
pub fn read_premultiplied_rgba8_into( &self, data: &mut [u8], ) -> Result<TextureImageInfo>
Reads the most recently rendered texture frame as premultiplied RGBA8.
Sourcepub fn acquire_metal_owned_texture_frame(
&self,
) -> Result<MetalOwnedTextureFrameHandle>
pub fn acquire_metal_owned_texture_frame( &self, ) -> Result<MetalOwnedTextureFrameHandle>
Acquires a borrowed Metal frame from a session-owned texture target.
Sourcepub fn acquire_vulkan_owned_texture_frame(
&self,
) -> Result<VulkanOwnedTextureFrameHandle>
pub fn acquire_vulkan_owned_texture_frame( &self, ) -> Result<VulkanOwnedTextureFrameHandle>
Acquires a borrowed Vulkan frame from a session-owned texture target.
Sourcepub fn acquire_opengl_owned_texture_frame(
&self,
) -> Result<OpenGLOwnedTextureFrameHandle>
pub fn acquire_opengl_owned_texture_frame( &self, ) -> Result<OpenGLOwnedTextureFrameHandle>
Acquires a borrowed OpenGL frame from a session-owned texture target.