[vtkusers] how can I scale a vtkActor2D?

Liang Ma leo at esit.com
Tue Nov 25 12:49:54 EST 2008


Dear Peter,

Thank you so much for your reply. I did try  this->pvtkRenderer->Render() 
after     this->pvtkRenderer->AddActor(this->pvtkActor); It does not work.

my pvtkActor is a vtkActor2D:

  vtkActor2D            *pvtkActor2D;

In fact  this->pvtkActor->GetPositionCoordinate()->SetValue(0.5, 0.5); will 
move the actor to the center. But 
this->pvtkActor->GetPosition2Coordinate()->SetValue(0.9, 0.9);  will not 
scale the actor.

I searched in the archive of  vtkuser and could not fond the answer. I read 
from the help that  vtkActor2D->GetPosition2Coordinate()->SetValue sometims 
will not work "Some 2D actor subclasses ignore the position2 variable ". But 
I do not know why. Will a vtkXYPlotActor be better? I can change the size of 
the font in the same program.Whould you please give me some more advices? 
Thanks again.

Best regards

Liang Ma



----- Original Message ----- 
From: "Peter F Bradshaw" <pfb at exadios.com>
To: "VTK Users" <vtkusers at vtk.org>
Sent: Tuesday, November 25, 2008 11:15 AM
Subject: Re: [vtkusers] how can I scale a vtkActor2D?


> Hi Liang Ma;
>
> Are you calling this->pvtkRenderer->Render() anywhere?
>
> On Mon, 24 Nov 2008, Liang Ma wrote:
>
>> Hi all,
>>
>> I tried to scale a 2D actor but it doesn't work. I tried 
>> GetPosition2Coordinate() function but it doesn't work.  Also I tried to 
>> zoom the camera. It does not work either.
>>
>> Whould you give me some advices? Thanks.
>>
>> Regards
>>
>> Liang Ma
>>
>> Here is the code:
>>
>>   vtkActor2D   *pvtkActor;
>>            ..........................
>> 
>> this->pvtkActor->GetPositionCoordinate()->SetCoordinateSystemToNormalizedViewport();
>>  this->pvtkActor->GetPositionCoordinate()->SetValue(0.5, 0.5);  // 
>> works, could move the actor to the center
>>  this->pvtkActor->GetPosition2Coordinate()->SetValue(0.9, 0.9); // does 
>> not work, no effect
>>  this->pvtkActor->GetProperty()->SetColor(1, 0, 0);
>>
>> the code for zoom:
>>
>> ////////////////////////////////////////////////////////////////////////
>>         this->pvtkCamera = this->pvtkRenderer->GetActiveCamera ();
>>         this->pvtkCamera->Zoom(5);    //     zoom doesn't work
>>         this->pvtkRenderer->SetActiveCamera (this->pvtkCamera) ;
>> ///////////////////////////////////////////////////////////////////////////
>>
>
> Cheers
>
> -- 
> Peter F Bradshaw: http://www.exadios.com (public keys avaliable there).
> Personal site: http://personal.exadios.com
> "I love truth, and the way the government still uses it occasionally to
> keep us guessing." - Sam Kekovich.
> _______________________________________________
> 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