Exemplo n.º 1
0
        private void button2_Click_1(object sender, EventArgs e)
        {
            string        inscriptionpath = textBox1.Text;
            vtkVectorText text            = vtkVectorText.New();

            text.SetText(inscriptionpath);
            //text.GetOutput().GetPoints().GetNumberOfPoints();

            //

            //vtkLinearExtrusionFilter extrude = vtkLinearExtrusionFilter.New();
            //extrude.SetInputConnection(text.GetOutputPort());
            //extrude.SetExtrusionTypeToNormalExtrusion();
            //extrude.SetVector(0, 0, 1);
            //extrude.SetScaleFactor(0.5);

            //vtkTriangleFilter triangle = vtkTriangleFilter.New();
            //triangle.SetInputConnection(extrude.GetOutputPort());

            vtkDataSetMapper mapper = vtkDataSetMapper.New();

            mapper.SetInputConnection(text.GetOutputPort());

            vtkActor actor = vtkActor.New();

            actor.SetMapper(mapper);
            actor.GetProperty().SetColor(0.8900, 0.8100, 0.3400);
            actor.SetPosition(0, 0, 0);
            renderWindow.AddRenderer(renderer);
            renderer.AddActor(actor);
            renderer.ResetCamera();
            renderWindow.GetInteractor().Render();
        }
Exemplo n.º 2
0
        public SpherePackage(vtkRenderer aRender)
        {
            _aRender = aRender;

            _sphereSource = vtkSphereSource.New();
            _sphereSource.SetRadius(3);
            _sphereSource.SetRadius(0.5);
            _sphereSource.SetThetaResolution(26);
            _sphereSource.SetPhiResolution(26);
            _sphereSource.ModifiedEvt += _sphereSource_ModifiedEvt;

            SphereMapper = vtkPolyDataMapper.New();
            SphereMapper.SetInputConnection(_sphereSource.GetOutputPort());

            _sphereActor = vtkActor.New();
            _sphereActor.SetMapper(SphereMapper);
            aRender.AddActor(_sphereActor);

            _aText = vtkVectorText.New();
            _aText.SetText("");

            vtkPolyDataMapper textMapper = vtkPolyDataMapper.New();

            textMapper.SetInputConnection(_aText.GetOutputPort());
            _textActor = vtkFollower.New();
            //textActor.GetProperty().SetColor(point.Color.X, point.Color.Y, point.Color.Z);
            _textActor.SetMapper(textMapper);
            //textActor.SetScale(0.2, 0.2, 0.2);
            //textActor.SetScale(4);
            _textActor.SetCamera(aRender.GetActiveCamera());
            aRender.AddActor(_textActor);

            //SetOpacity(0.5f);

            //VisOff();

            RandColor();
        }
Exemplo n.º 3
0
        public void AddText(String Text, c3DWorld CurrentWorld, double scale)
        {
            if (TextActor == null)
            {
                TextActor = vtkFollower.New();
                TextMapper = vtkPolyDataMapper.New();
                TextVTK = vtkVectorText.New();

                TextVTK.SetText(Text);
                TextMapper.SetInputConnection(TextVTK.GetOutputPort());
                TextActor.SetMapper(TextMapper);

                //TextActor.SetPosition(this.GetActor().GetCenter()[0]-1, this.GetActor().GetCenter()[1]-1, this.GetActor().GetCenter()[2]-2);
                TextActor.SetPosition(Position.X , Position.Y , Position.Z - 1);
                TextActor.SetPickable(0);
                CurrentWorld.ren1.AddActor(TextActor);
                TextActor.SetCamera(CurrentWorld.ren1.GetActiveCamera());
            }
            else
            {
                TextVTK.SetText(Text);
            }
            TextActor.SetScale(scale);
        }
Exemplo n.º 4
0
        public void AddText(String Text, vtkRenderer ren1, double scale)
        {
            TextActor = vtkFollower.New();
            TextMapper = vtkPolyDataMapper.New();
            TextVTK = vtkVectorText.New();

            TextVTK.SetText(Text);
            TextMapper.SetInputConnection(TextVTK.GetOutputPort());
            TextActor.SetMapper(TextMapper);
            TextActor.SetPosition(Position.X - 1, Position.Y - 1, Position.Z - 1);
            TextActor.SetScale(scale);
            TextActor.SetPickable(0);
            ren1.AddActor(TextActor);
            TextActor.SetCamera(ren1.GetActiveCamera());
        }