[vtkusers] X-Y Plots problem

Amy Squillacote ahs at cfdrc.com
Tue Mar 18 09:15:57 EDT 2008


You don't have to do the cast. All you need to do is include 
vtkStructuredGrid.h. See the following entry in the VTK FAQ: 
http://www.vtk.org/Wiki/VTK_FAQ#The_C.2B.2B_compiler_cannot_convert_some_pointer_type_to_another_pointer_type_in_my_little_program.

- Amy

Gennady Khokhorin wrote:
> Hi, Saira.
> probe->SetSource (reinterpret_cast<vtkDataObject*>(pl3d->GetOutput()));
> works fine. Thanks for the tip.
> Do you know why vtkStructuredGrid should be casted to parent
> vtkDataObject class?
> Kind of breaking rules of OOP
> gok
>
> -----Mensaje original-----
> De: Saira Saleem Pathan [mailto:sarakhan_engr at hotmail.com]
> Enviado el: lunes, 30 de abril de 2007 13:21
> Para: Lledo Museros Cabedo
> CC: vtkusers at vtk.org
> Asunto: RE: [vtkusers] X-Y Plots problem
>
> hi
> Apply Casting Function :)
> Read from Documentation ,how to convert one data type to another, if
> solve then let  me know otherwise i will send u code :)
>
>
>
>
>
> <DIV>
> <P><STRONG><FONT color=#0000ff>Saira Saleem Pathan</FONT></STRONG><IMG
> height=2 src="http://graphics.hotmail.com/greypixel.gif" width="100%" 
> vspace=9></P>
> <P> Ph.D. Student</P>
> <P>Univerity of Leeds </P>
> United Kingdom.
>
>
>
>
>
>   
>> From: "Lledo Museros Cabedo" <lledo.museros at itc.uji.es>
>> To: <vtkusers at vtk.org>
>> Subject: [vtkusers] X-Y Plots  problem
>> Date: Mon, 30 Apr 2007 12:51:45 +0200
>>
>> Hello,
>>
>> I am new using VTK, therefore I am reading the VTK books and trying to
>> do examples. I have written the example xyPlot.tcl (which is in
>> VTK/Examples/Annotation/TCl/) in C++, and now I have a compiler error
>> which I do not know how to solve. The error says that
>> 'vtkProbeFilter::SetSource' : cannot translate the parameter from
>> 'vtkStructuredGrid *' to 'vtkDataObject *'. I have read the doxygen
>> manuals and in fact SetSource needs as parameter a vtkDataObject but
>> GetOutput from a vtkPLOT3DReader returns a vtkStructuredGrid.
>>
>> I send the part of the code pointing out where the error is:
>>
>> //
>> // Create a PLOT3D reader and load the data.
>> //
>>
>> vtkPLOT3DReader *pl3d=vtkPLOT3DReader::New();
>> pl3d->SetXYZFileName("C:/VTKData/Data/combxyz.bin");
>> pl3d->SetQFileName("C:/VTKData/Data/combq.bin");
>> pl3d->SetScalarFunctionNumber(100);
>> pl3d->SetVectorFunctionNumber(202);
>> pl3d->Update();
>>
>> // Create three the line source to use for the probe lines.
>> vtkLineSource *line=vtkLineSource::New();
>> line->SetResolution(30);
>>
>> // Move the line into place and create the probe filter. For
>> vtkProbeFilter, // the probe line is the input, and the underlying data
>> set is the source.
>>
>> vtkTransform *transL1=vtkTransform::New();
>> transL1->Translate(3.7, 0.0, 28.37);
>> transL1->Scale(5,5,5);
>> transL1->RotateY(90);
>> vtkTransformPolyDataFilter *tf=vtkTransformPolyDataFilter::New();
>> tf->SetInputConnection(line->GetOutputPort());
>> tf->SetTransform(transL1);
>> vtkProbeFilter *probe=vtkProbeFilter::New();
>> probe->SetInputConnection(tf->GetOutputPort());
>> probe->SetSource(pl3d->GetOutput());   ----> In this line is the ERROR.
>>
>> Can anyone help me?
>>
>> Thank you in advance.
>>
>> Best regards,
>> LLEDO
>>
>>
>>
>>
>> _______________________________________________
>> This is the private VTK discussion list.
>> Please keep messages on-topic. Check the FAQ at: 
>> http://www.vtk.org/Wiki/VTK_FAQ
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>     
>
> _________________________________________________________________
> Express yourself instantly with MSN Messenger! Download today it's FREE!
>
> http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/
>
> _______________________________________________
> This is the private VTK discussion list. 
> Please keep messages on-topic. Check the FAQ at:
> http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
> _______________________________________________
> This is the private VTK discussion list.
> Please keep messages on-topic. Check the FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
> Follow this link to subscribe/unsubscribe:
> http://www.vtk.org/mailman/listinfo/vtkusers
>
>
>   

-- 
Amy Squillacote                    Phone: (256) 726-4839
Computer Scientist                 Fax: (256) 726-4806
CFD Research Corporation           Web: http://www.cfdrc.com
215 Wynn Drive, Suite 501
Huntsville, AL  35805





More information about the vtkusers mailing list