[vtkusers] subclass of vtkSphereSource

Tim Soper tim_d_soper at yahoo.com
Mon Mar 3 16:55:30 EST 2008


What is the correct way to subclass a pre-existing vtkPolyDataAlgorithm such as vtkSphereSource?

I am trying to create a sphere with a couple extra lines added.  To save myself the time and space of rewriting all the vtkSphereSource interfaces, I tried to rewrite in the following way:

// HEADER

class vtkSphereWithLinesSource : public vtkSphereSource
{
         :
        :
};


//REQUEST DATA
int vtkSphereWithLinesSource::RequestData(
  vtkInformation *vtkNotUsed(request),
  vtkInformationVector **vtkNotUsed(inputVector),
  vtkInformationVector *outputVector)
{

    //call the vtkSphereSource request data first
    vtkSphereSource::RequestData( NULL, NULL, outputVector );

    // get the info object
    vtkInformation *outInfo = outputVector->GetInformationObject(0);

    // get the ouptut
    vtkPolyData *output = vtkPolyData::SafeDownCast(
        outInfo->Get(vtkDataObject::DATA_OBJECT()));


  //Make some extra lines
  vtkCellArray* newLines = vtkCellArray::New();
                        :
                        :

       /*
                now how do I add the lines to the output of the 
                vtkSphereSource::RequestData output???

                  I tried to use vtkAppendPolyData... did not work for me?
      */

}






 
Tim Soper

Research Assistant
University of Washington
Department of Bioengineering 
Box 352142





      ____________________________________________________________________________________
Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs



More information about the vtkusers mailing list