MCPcopy Create free account
hub / github.com/Kitware/VTK / BindRenderWindow

Method BindRenderWindow

Web/WebAssemblySession/vtkRemoteSession.cxx:236–272  ·  view source on GitHub ↗

-------------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

234
235//-------------------------------------------------------------------------------
236bool vtkRemoteSession::BindRenderWindow(vtkTypeUInt32 object, const std::string canvasSelector)
237{
238 if (auto* manager = static_cast<vtkObjectManager*>(vtkSessionGetManager(this->Session)))
239 {
240 if (auto renderWindowObject = manager->GetObjectAtId(object))
241 {
242 (void)renderWindowObject;
243 // Update the canvas selector in the render window.
244 manager->UpdateObjectFromState({ { "Id", object }, { "CanvasSelector", canvasSelector } });
245 // Get the interactor associated with the render window
246 // and set the canvas selector on it.
247 const auto& renderWindowState = manager->GetDeserializer()->GetContext()->GetState(object);
248 if (auto interactorStateIter = renderWindowState.find("Interactor");
249 interactorStateIter != renderWindowState.end())
250 {
251 if (auto interactorIdIter = interactorStateIter->find("Id");
252 interactorIdIter != interactorStateIter->end())
253 {
254 // Update the interactor state with the canvas selector
255 const auto interactorId = interactorIdIter->get<vtkTypeUInt32>();
256 manager->UpdateObjectFromState(
257 { { "Id", interactorId }, { "CanvasSelector", canvasSelector } });
258 return true;
259 }
260 }
261 vtkLog(ERROR, "Failed to get interactor for render window: " << object);
262 return false;
263 }
264 else
265 {
266 vtkLog(ERROR, "No render window found with identifier: " << object);
267 return false;
268 }
269 }
270 vtkLog(ERROR, "Invalid session: " << this->Session);
271 return false;
272}
273
274//-------------------------------------------------------------------------------
275unsigned long vtkRemoteSession::Observe(

Callers

nothing calls this directly

Calls 7

vtkSessionGetManagerFunction · 0.85
GetObjectAtIdMethod · 0.45
UpdateObjectFromStateMethod · 0.45
GetStateMethod · 0.45
GetContextMethod · 0.45
findMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected