[vtkusers] Z-Order of vtkRenderer,vtkImageActor,vtkTextActor

Thomas Lambertz thomas at hexerei-software.de
Sat Sep 2 12:33:40 EDT 2006


Hi Shang,

Shang Mu schrieb:
> Tom,
>
> Sorry I don't have more solutions. It seems the problem comes from 
> overlaping viewports but not actors. My code worked for 2d and 3d 
> actors in the same viewport (actually in the same renderer as well). 
> And the document for SetDisplayLocationToForeground only mentions 
> about overlapping actors but not viewports.
Thats a good point. I should rewrite my code to use less renderer.
>
> By the way, since vtkTextActor inherits from vtkActor2D, you should be 
> able to directly use the method without the cast "((vtkActor2D 
> *)myTextActor)->". I wrote "actor2d.GetProperty()..." only because I 
> copied it out directly from my Python code and actor2d was my actor's 
> name. Sorry for any confusion.
>
Your right - first i simply missed to include vtkProperty2D.h so the 
compiler didnt know this - and i missinterpreted this behaviour. Thanks 
for this hint.
> good luck
> Shang
Thanks a lot for your help,
Tom

>
> ----- Original Message ----- From: "Thomas Lambertz" 
> <thomas at hexerei-software.de>
> To: <vtkusers at vtk.org>
> Sent: Saturday, September 02, 2006 9:51 AM
> Subject: Re: [vtkusers] Z-Order of vtkRenderer,vtkImageActor,vtkTextActor
>
>
>> Hi Shang,
>>
>> thanks for your hint.
>>
>> Looking into the online-documentation for the vtkProperty2D-class i 
>> found:
>>
>> void vtkProperty2D::SetDisplayLocationToForeground
>>
>> "The DisplayLocation is either background or foreground.  [...] If it 
>> is background [seemes to be a typo - must be foreground] , then this 
>> 2D actor will be drawn in front of all 3D props and background 2D 
>> actors."
>>
>>
>> There are no overlapping vtkActor2D and my vtkImageActors are such 3D 
>> props - so this should solve my problem.
>>
>> I implemented your advise in this way:
>>
>> ((vtkActor2D 
>> *)myTextActor)->GetProperty()->SetDisplayLocationToForeground();
>>
>>
>> Unfortunately the text is still invisible. Removing the 
>> vtkImageActors gives me the correct text, order of adding the 
>> renderers didnt change this.
>>
>> Any suggestions ?
>>
>> regards,
>> Tom
>>
>>
>> Shang Mu schrieb:
>>> try this:
>>> actor2d.GetProperty().SetDisplayLocationToForeground/Foreground() or 
>>> SetDisplayLocation(int)
>>>
>>> http://www.vtk.org/doc/nightly/html/classvtkProperty2D.html#aff92a7410107d67198f73fb1af85b9c 
>>>
>>>
>>> Shang
>>>
>>> ----- Original Message ----- From: "Thomas Lambertz" 
>>> <thomas at hexerei-software.de>
>>> To: <vtkusers at vtk.org>
>>> Sent: Friday, September 01, 2006 9:06 PM
>>> Subject: [vtkusers] Z-Order of vtkRenderer,vtkImageActor,vtkTextActor
>>>
>>>
>>>> Hi there,
>>>>
>>>> i have a problem with providing some text-information for 
>>>> dicom-slices.
>>>>
>>>> Each slice is represented by a vtkImageActor and a vtkRenderer. All 
>>>> vtkRenderers are arranged like a chessboard using their 
>>>> SetViewport() method. There is no overlapping and all went fine.
>>>>
>>>> I thought i could add some text-information by adding another 
>>>> vtkRenderer with a vtkTextActor. This renderer could use the hole 
>>>> RenderWindow - (SetViewport(0.0,0.0,1.0,1.0)). But whatever order 
>>>> of RenderWindow->AddRenderer() i choose - the text is never 
>>>> visible. By omitting the slice-renderer i see the text - so the 
>>>> TextActor/Renderer seemes to work (and is only hidden behind them ?).
>>>> But:
>>>> By adding the TextActor to each sliceRenderer the text is visible. 
>>>> But that´s not a real solution as all sliceRenderer are restricted 
>>>> by their viewport-settings - and i dont want to add the TextActor 
>>>> to all of them only to see the hole text.
>>>>
>>>> It looks to me as i am struggling with the z-order of these 
>>>> renderers. The order of adding the renderer seemes not to solve my 
>>>> problem.
>>>> What am i doing wrong ? Can i set an z-order by hand ? Should i use 
>>>> another classes for my problem ?
>>>>
>>>> Any suggestions are very appreciated.
>>>>
>>>> Thanks in advance,
>>>> Tom
>>>>
>>>>
>>>> _______________________________________________
>>>> 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 
>
>




More information about the vtkusers mailing list