/// <summary> /// The main entry method called by the CSharp driver /// </summary> /// <param name="argv"></param> public static void AVTestPolyDataPieces(String [] argv) { //Prefix Content is: "" math = new vtkMath(); vtkMath.RandomSeed((int)22); pf = new vtkParallelFactory(); vtkParallelFactory.RegisterFactory((vtkObjectFactory)pf); sphere = new vtkSphereSource(); sphere.SetPhiResolution((int)32); sphere.SetThetaResolution((int)32); extract = new vtkExtractPolyDataPiece(); extract.SetInputConnection((vtkAlgorithmOutput)sphere.GetOutputPort()); normals = new vtkPolyDataNormals(); normals.SetInputConnection((vtkAlgorithmOutput)extract.GetOutputPort()); ps = new vtkPieceScalars(); ps.SetInputConnection((vtkAlgorithmOutput)normals.GetOutputPort()); mapper = vtkPolyDataMapper.New(); mapper.SetInputConnection((vtkAlgorithmOutput)ps.GetOutputPort()); mapper.SetNumberOfPieces((int)2); actor = new vtkActor(); actor.SetMapper((vtkMapper)mapper); sphere2 = new vtkSphereSource(); sphere2.SetPhiResolution((int)32); sphere2.SetThetaResolution((int)32); extract2 = new vtkExtractPolyDataPiece(); extract2.SetInputConnection((vtkAlgorithmOutput)sphere2.GetOutputPort()); mapper2 = vtkPolyDataMapper.New(); mapper2.SetInputConnection((vtkAlgorithmOutput)extract2.GetOutputPort()); mapper2.SetNumberOfPieces((int)2); mapper2.SetPiece((int)1); mapper2.SetScalarRange((double)0,(double)4); mapper2.SetScalarModeToUseCellFieldData(); mapper2.SetColorModeToMapScalars(); mapper2.ColorByArrayComponent((string)"vtkGhostLevels",(int)0); mapper2.SetGhostLevel((int)4); // check the pipeline size[] extract2.UpdateInformation(); psize = new vtkPipelineSize(); if ((psize.GetEstimatedSize((vtkAlgorithm)extract2,(int)0,(int)0)) > 100) { //puts skipedputs ['stderr', '"ERROR: Pipeline Size increased"'] } if ((psize.GetNumberOfSubPieces((uint)10,(vtkPolyDataMapper)mapper2)) != 2) { //puts skipedputs ['stderr', '"ERROR: Number of sub pieces changed"'] } actor2 = new vtkActor(); actor2.SetMapper((vtkMapper)mapper2); actor2.SetPosition((double)1.5,(double)0,(double)0); sphere3 = new vtkSphereSource(); sphere3.SetPhiResolution((int)32); sphere3.SetThetaResolution((int)32); extract3 = new vtkExtractPolyDataPiece(); extract3.SetInputConnection((vtkAlgorithmOutput)sphere3.GetOutputPort()); ps3 = new vtkPieceScalars(); ps3.SetInputConnection((vtkAlgorithmOutput)extract3.GetOutputPort()); mapper3 = vtkPolyDataMapper.New(); mapper3.SetInputConnection((vtkAlgorithmOutput)ps3.GetOutputPort()); mapper3.SetNumberOfSubPieces((int)8); mapper3.SetScalarRange((double)0,(double)8); actor3 = new vtkActor(); actor3.SetMapper((vtkMapper)mapper3); actor3.SetPosition((double)0,(double)-1.5,(double)0); sphere4 = new vtkSphereSource(); sphere4.SetPhiResolution((int)32); sphere4.SetThetaResolution((int)32); extract4 = new vtkExtractPolyDataPiece(); extract4.SetInputConnection((vtkAlgorithmOutput)sphere4.GetOutputPort()); ps4 = new vtkPieceScalars(); ps4.RandomModeOn(); ps4.SetScalarModeToCellData(); ps4.SetInputConnection((vtkAlgorithmOutput)extract4.GetOutputPort()); mapper4 = vtkPolyDataMapper.New(); mapper4.SetInputConnection((vtkAlgorithmOutput)ps4.GetOutputPort()); mapper4.SetNumberOfSubPieces((int)8); mapper4.SetScalarRange((double)0,(double)8); actor4 = new vtkActor(); actor4.SetMapper((vtkMapper)mapper4); actor4.SetPosition((double)1.5,(double)-1.5,(double)0); ren = vtkRenderer.New(); ren.AddActor((vtkProp)actor); ren.AddActor((vtkProp)actor2); ren.AddActor((vtkProp)actor3); ren.AddActor((vtkProp)actor4); renWin = vtkRenderWindow.New(); renWin.AddRenderer((vtkRenderer)ren); iren = new vtkRenderWindowInteractor(); iren.SetRenderWindow((vtkRenderWindow)renWin); iren.Initialize(); //deleteAllVTKObjects(); }