Hi,<br><br>I am getting the following error message when I use my own class that converts from OOGL to a format viewable using VTK<br><br><br><br>ERROR: In /usr/student/tango/maclenna/cvs/VTK/Filtering/vtkDemandDrivenPipeline.cxx, line 692
<br>vtkStreamingDemandDrivenPipeline (0x8073228): Input port 0 of algorithm vtkPolyDataAlgorithm(0x8074588) has 0 connections but is not optional.<br><br>Its vtk compiled from CVS as of a few days ago.<br><br>Does anyone have some hints?
<br><br>cheers<br><br>alex<br><br>Here is my class:<br><br><br><br>import java.awt.color.ColorSpace;<br><br>public class vtkOOGLtoVtk extends vtk.vtkPolyDataAlgorithm {<br> private OOGLObject o;<br><br> public void setOOGL(OOGLObject o) {
<br> this.o = o;<br> }<br> <br> <br><br> /**<br> * Get oogl object in vtk format<br> * Follows the pattern set by vtkPLYReader.cxx<br> * <br> * @param request<br> * @param inputVector
<br> * @param outputVector<br> * @return<br> */<br> public int RequestData(vtkInformation request,<br> vtkInformationVector inputVector, vtkInformationVector outputVector) {<br> <br> // Ape the stuff from vtkPLYReader until I know whats going on
<br> vtkInformation outInfo = outputVector.GetInformationObject(0);<br> <br> // Casting done with C++ example, not the best for java???<br> vtkPolyData output = (vtkPolyData)outInfo.Get(new vtkInformationDataObjectKey());
<br> output.Initialize();<br> <br> // Return value<br> int result = 1;<br> <br> // Temp vertex holder<br> Point3d v = null;<br> <br> // Temp face holder
<br> Point3i f = null;<br> <br> // Temp variable for testing number of colours defined for OOGL Object<br> int count = 0;<br> <br> // Boolean variable for checking to see if RGB data available ( well HSV )
<br> boolean colourDataAvailable = false;<br> <br> // RGB values for points<br> vtkUnsignedCharArray rgbPoints = null;<br> <br> // Temp variable for putting colour into table as rgb
<br> float[] colourComponents = null;<br> <br> // Test number of colours defined for vertices<br> if ( o.getVertexColours() != null) <br> count = o.getVertexColours().size();<br>
<br> if ( count > 0)<br> colourDataAvailable = true;<br> <br> // If there are vertex colours then use RGB Points<br> if (colourDataAvailable){<br> rgbPoints = new vtkUnsignedCharArray();
<br> rgbPoints.SetName("RGB");<br> output.GetPointData().SetScalars(rgbPoints);<br> rgbPoints.Initialize();<br> rgbPoints.SetNumberOfComponents(3);<br> rgbPoints.SetNumberOfTuples
(this.o.getVertices().size());<br> <br> }<br> // Don't worry about colours by face for the moment.. its not important<br> // to implement this right now<br> <br> // Now load vertices into structure
<br> vtkPoints points = new vtkPoints();<br> points.SetDataTypeToFloat();<br> points.SetNumberOfPoints(this.o.getVertices().size());<br> <br> for ( int i = 0 ; i < o.getVertices().size(); i++){
<br> // Get the vertex values and set them in the point data object<br> v = o.getVertices().get(i);<br> points.SetPoint(i, v.x, v.y, v.z);<br> <br> // If colours available insert them, converting from hsb to rgb
<br><br> if (colourDataAvailable){<br> colourComponents = o.getVertexColours().get(i).get().getComponents(ColorSpace.getInstance(ColorSpace.TYPE_RGB), new float[3]);<br> rgbPoints.SetTuple3
(i, colourComponents[0], colourComponents[1], colourComponents[2]);<br> }<br> }<br> <br> // Now set the up the faces<br> vtkCellArray polys = new vtkCellArray();<br> <br> // Allocate space for faces
<br> for (int i = 0; i < this.o.getFaceCount(); i++) {<br> // Get face to insert<br> f = this.o.getFaces().get(i);<br><br> // Tell ca that next cell is a triangle<br>
polys.InsertNextCell(3);<br><br> // Insert point reference values that<br> // make up the face<br> polys.InsertCellPoint(f.x);<br> polys.InsertCellPoint(f.y);<br> polys.InsertCellPoint
(f.z);<br> }<br> <br> <br> output.SetPolys(polys);<br> output.SetPoints(points);<br> <br> <br> return result;<br> }<br><br>}<br><br>