public void SetSceneRoot(VtkSceneGraph sceneGraphRoot) { if (!Equals(_sceneGraphRoot, sceneGraphRoot)) { if (_sceneGraphRoot != null) { _sceneGraphRoot.DeinitializeSceneGraph(_vtkRenderer); _sceneGraphRoot.Dispose(); _sceneGraphRoot = null; } _vtkRenderer.RemoveAllViewProps(); _vtkRenderer.ResetCamera(); _sceneGraphRoot = sceneGraphRoot; if (_sceneGraphRoot != null) { _sceneGraphRoot.InitializeSceneGraph(_vtkRenderer); } } else { sceneGraphRoot.Dispose(); } }
protected virtual void Dispose(bool disposing) { if (disposing) { if (_dynamicRenderEventPublisher != null) { _dynamicRenderEventPublisher.Cancel(); _dynamicRenderEventPublisher.Dispose(); _dynamicRenderEventPublisher = null; } if (_vtkRenderWindow != null) { _vtkRenderWindow.Dispose(); _vtkRenderWindow = null; } if (_vtkRenderer != null) { _vtkRenderer.Dispose(); _vtkRenderer = null; } if (_sceneGraphRoot != null) { _sceneGraphRoot.Dispose(); _sceneGraphRoot = null; } if (_imageBuffer != null) { _imageBuffer.Dispose(); _imageBuffer = null; } if (_overlayBuffer != null) { _overlayBuffer.Dispose(); _overlayBuffer = null; } if (_finalBuffer != null) { _finalBuffer.Dispose(); _finalBuffer = null; } } }