示例#1
0
        public void VTKRender(string filePath)
        {
            if (renderer != null)
            {
                renderer.Clear();
                mapper.RemoveAllInputs();
            }

            renderWindowControl1.Refresh();
            reader = new Kitware.VTK.vtkSimplePointsReader();
            reader.SetFileName(filePath);
            reader.Update();

            mapper = Kitware.VTK.vtkPolyDataMapper.New();
            mapper.SetInputConnection(reader.GetOutputPort());
            actor = Kitware.VTK.vtkActor.New();
            actor.SetMapper(mapper);
            actor.SetScale(0.01, 0.01, 0.01);
            actor.GetProperty().SetPointSize(1);


            renderwindow = renderWindowControl1.RenderWindow;
            renderer     = renderwindow.GetRenderers().GetFirstRenderer();
            renderer.SetBackground(0.3, 0.6, 0.3);
            renderer.AddActor(actor);
            renderer.Clear();
            renderWindowControl1.Refresh();
        }
示例#2
0
        /// <summary>
        /// TestAddActorsToRenderWindow.
        /// </summary>
        private void TestAddActorsToRenderWindow(Kitware.VTK.vtkRenderWindow renWin)
        {
            Kitware.VTK.vtkConeSource source = new Kitware.VTK.vtkConeSource();

            Kitware.VTK.vtkMapper mapper = Kitware.VTK.vtkPolyDataMapper.New();
            mapper.SetInputConnection(source.GetOutputPort());

            Kitware.VTK.vtkActor actor = new Kitware.VTK.vtkActor();
            actor.SetMapper(mapper);

            Kitware.VTK.vtkRenderer ren = null;
            ren = renWin.GetRenderers().GetFirstRenderer();
            ren.AddActor(actor);

            Kitware.VTK.vtkTextActor textActor = new Kitware.VTK.vtkTextActor();
            textActor.SetInput(Kitware.VTK.vtkVersion.GetVTKSourceVersion());
            ren.AddActor(textActor);

            //int n = renWin.GetRenderers().GetNumberOfItems();
            //System.Diagnostics.Debug.WriteLine(n);
            //System.Diagnostics.Debug.WriteLine(
            //  Kitware.mummy.Runtime.Methods.Print(false)
            //  );
        }