VTK  9.7.1
vtkRemoteSession.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2 // SPDX-License-Identifier: BSD-3-Clause
3 
30 #ifndef vtkRemoteSession_h
31 #define vtkRemoteSession_h
32 
33 #include "vtkType.h" // for vtkTypeUInt32
34 #include "vtkWebAssemblySessionModule.h" // for no export macro
35 
36 #include <emscripten/val.h> // for emscripten::val
37 
38 VTK_ABI_NAMESPACE_BEGIN
39 
40 typedef struct vtkSessionImpl* vtkSession;
41 class VTKWEBASSEMBLYSESSION_EXPORT vtkRemoteSession
42 {
43 public:
48 
53 
59  bool RegisterState(emscripten::val state);
60 
66  bool UnRegisterState(vtkTypeUInt32 object);
67 
74  bool Set(vtkTypeUInt32 object, emscripten::val properties);
75 
81  emscripten::val Get(vtkTypeUInt32 object);
82 
88  void SkipProperty(const std::string& className, const std::string& propertyName);
89 
95  void UnSkipProperty(const std::string& className, const std::string& propertyName);
96 
103  bool RegisterBlob(const std::string& hash, emscripten::val jsArray);
104 
110  bool UnRegisterBlob(const std::string& hash);
111 
117  emscripten::val GetBlob(const std::string& hash);
118 
126  emscripten::val Invoke(vtkTypeUInt32 object, const std::string& methodName, emscripten::val args);
127 
133  emscripten::val GetAllDependencies(vtkTypeUInt32 object);
134 
140  bool UpdateObjectFromState(emscripten::val state);
141 
146  void UpdateStateFromObject(vtkTypeUInt32 object);
147 
155  bool SetSize(vtkTypeUInt32 object, int width, int height);
156 
162  bool Render(vtkTypeUInt32 object);
163 
169  bool ResetCamera(vtkTypeUInt32 object);
170 
177  bool StartWebXR(
178  vtkTypeUInt8 mode, vtkTypeUInt32 requiredFeatures, vtkTypeUInt32 optionalFeatures);
179 
183  bool StopWebXR();
184 
190  bool StartEventLoop(vtkTypeUInt32 object);
191 
197  bool StopEventLoop(vtkTypeUInt32 object);
198 
205  bool BindRenderWindow(vtkTypeUInt32 object, const std::string canvasSelector);
206 
214  unsigned long Observe(
215  vtkTypeUInt32 object, const std::string& eventName, emscripten::val jsFunction);
216 
223  bool UnObserve(vtkTypeUInt32 object, unsigned long tag);
224 
230  bool UnObserveAll(vtkTypeUInt32 object);
231 
235  void UnObserveAllObjects();
236 
242  void Export(const std::string& fileName);
243 
249  void Import(const std::string& stateFileName, const std::string& blobFileName);
250 
254  void UpdateObjectsFromStates();
255 
259  void UpdateStatesFromObjects();
260 
264  void PruneUnusedBlobs();
265 
269  void PruneUnusedObjects();
270 
274  void PruneUnusedStates();
275 
279  void Clear();
280 
285  std::size_t GetTotalBlobMemoryUsage();
286 
291  std::size_t GetTotalVTKDataObjectMemoryUsage();
292 
298  std::string PrintObjectToString(vtkTypeUInt32 object);
299 
303  void PrintSceneManagerInformation();
304 
309  void SetDeserializerLogVerbosity(const std::string& verbosityLevel);
310 
315  void SetInvokerLogVerbosity(const std::string& verbosityLevel);
316 
321  void SetObjectManagerLogVerbosity(const std::string& verbosityLevel);
322 
327  void SetSerializerLogVerbosity(const std::string& verbosityLevel);
328 
330 };
331 
332 VTK_ABI_NAMESPACE_END
333 #endif
struct vtkSessionImpl * vtkSession
Definition: vtkSession.h:91
struct vtkSessionImpl * vtkSession
Provides a remote session interface wrapped around vtk.h for managing VTK objects and states in a Web...