[vtkusers] PLEASE HELP, convert Tcl to C++ code

Amy Squillacote amy.squillacote at kitware.com
Thu Jan 11 08:59:45 EST 2007



Rio wrote:
>
> Hi, I am a quite newbie to VTK.
> I am involving in a project. I consider to write a VTK mouse picking 
> method in C++ code. I know the sample Tcl code, partially as following:
>  
> # Create a text mapper and actor to display the results of picking.
> vtkTextMapper textMapper
> set tprop [textMapper GetTextProperty]
>     $tprop SetFontFamilyToArial
>     $tprop SetFontSize 10
>     $tprop BoldOn
>     $tprop ShadowOn
>     $tprop SetColor 1 0 0
> vtkActor2D textActor
>     textActor VisibilityOff
>     textActor SetMapper textMapper
>  
> in the sample, tprop is created, but what kind of object it is? 
> vtkTextProperty or vtkProperty? Or i dunt need to specify the type of 
> object?
> Can anybody help me what is the code in C++ ???
>
Take a look at the documentation for vtkTextMapper: 
http://www.vtk.org/doc/nightly/html/classvtkTextMapper.html. The method 
GetTextProperty returns a vtkTextProperty*. So the following lines of 
Tcl code

vtkTextMapper textMapper
set tprop [textMapper GetTextProperty]

look like the following when converted to C++:

vtkTextMapper *textMapper = vtkTextMapper::New();
vtkTextProperty *tprop = textMapper->GetTextProperty();

- Amy

>  
> vtkTextMapper textMapper
> set tprop [textMapper GetTextProperty]
>
> set selPt [picker GetSelectionPoint]
> set x [lindex $selPt 0]
> set y [lindex $selPt 1]
> set pickPos [picker GetPickPosition]
> set xp [lindex $pickPos 0]
> set yp [lindex $pickPos 1]
> set zp [lindex $pickPos 2]
>
>  
> Thanks very much!
>  
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> 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
>   



More information about the vtkusers mailing list