public void SetTopMost() { vtkRenderer _aRender = _rendererPackage.Renderer; if (_aRender.GetLayer() > 0) { return; } if (_aRender.GetRenderWindow().GetRenderers().GetNumberOfItems() == 1) { vtkRenderer ren1 = vtkRenderer.New(); // 2d actor ren1.SetLayer(1); // top layer ren1.InteractiveOff(); _aRender.SetLayer(0); _aRender.GetRenderWindow().SetNumberOfLayers(2); _aRender.GetRenderWindow().AddRenderer(ren1); //ren1.SetActiveCamera(_aRender.GetActiveCamera()); //new SpherePackage(ren1, new double[] { 0, 0, 0 }, 600).SetOpacity(0.01f); _aRender.SetActiveCamera(ren1.GetActiveCamera()); _aRender.RemoveActor(Actor); ren1.AddActor(Actor); _aRender.InteractiveOn(); } else { for (int i = 0; i < _aRender.GetRenderWindow().GetRenderers().GetNumberOfItems(); ++i) { int layer = vtkRenderer.SafeDownCast(_aRender.GetRenderWindow().GetRenderers().GetItemAsObject(i)).GetLayer(); if (layer == 1) { vtkRenderer.SafeDownCast(_aRender.GetRenderWindow().GetRenderers().GetItemAsObject(i)).AddActor(Actor); } else { vtkRenderer.SafeDownCast(_aRender.GetRenderWindow().GetRenderers().GetItemAsObject(i)).RemoveActor(Actor); } } } }