コード例 #1
0
 public void ScalarVisibilityOff()
 {
     _polyDataMapper.ScalarVisibilityOff();
     _polyDataMapper.Modified();
     actor.Modified();
 }
コード例 #2
0
        public void SetPosition(List <double[]> xyz1)
        {
            if (_points == null)
            {
                this._xyz = xyz1;
                _points   = vtkPoints.New();

                for (int index = 0; index < xyz1.Count; index++)
                {
                    double[] doubles = xyz1[index];
                    _points.InsertPoint(index, doubles[0], doubles[1], doubles[2]);
                }

                _lines = vtkCellArray.New();
                _lines.InsertNextCell(xyz1.Count);

                for (int index = 0; index < xyz1.Count; index++)
                {
                    _lines.InsertCellPoint(index);
                }

                _profileData = vtkPolyData.New();
                _profileData.SetPoints(_points);
                _profileData.SetLines(_lines);
                _profileData.SetVerts(_lines);
                _profileData.Update();

                _cleanFilter = vtkCleanPolyData.New();
                _cleanFilter.SetInput(_profileData);
                _cleanFilter.Update();

                _profileTubes = vtkTubeFilter.New();
                _profileTubes.CappingOn();
                _profileTubes.SetNumberOfSides(10);
                _profileTubes.SetInput(_cleanFilter.GetOutput());
                //profileTubes.SetVaryRadiusToVaryRadiusByVector();

                _profileTubes.SetRadius(radius);
                _profileTubes.SetInputArrayToProcess(1, 0, 0, 0, "vectors");

                //vtkPolyDataMapper profileMapper = new vtkPolyDataMapper();
                //profileMapper.SetInputConnection(profileTubes.GetOutputPort());

                PolyData = _profileTubes.GetOutput();

                _mapper = vtkPolyDataMapper.New();
                _mapper.SetInput(_profileTubes.GetOutput());

                centerLineActor.SetMapper(_mapper);
                centerLineActor.GetProperty().SetOpacity(0.5);
            }
            else
            {
                vtkPoints _newpoints = vtkPoints.New();

                for (int index = 0; index < xyz1.Count; index++)
                {
                    double[] doubles = xyz1[index];
                    _newpoints.InsertPoint(index, doubles[0], doubles[1], doubles[2]);
                }

                vtkCellArray _newlines = vtkCellArray.New();
                _newlines.InsertNextCell(xyz1.Count);

                for (int index = 0; index < xyz1.Count; index++)
                {
                    _newlines.InsertCellPoint(index);
                }

                _profileData.SetPoints(_newpoints);
                _profileData.SetLines(_newlines);
                _profileData.SetVerts(_newlines);
                _profileData.Update();

                _profileTubes.SetRadius(radius);

                _points.Dispose();
                _lines.Dispose();

                _points = _newpoints;
                _lines  = _newlines;

                _points.Modified();
                _mapper.Modified();
            }
        }