[vtkusers] Coloring Angle or Distance Widgets

mirko heuegger mheuegger at gmail.com
Mon Apr 26 02:41:05 EDT 2010


Hello!
On Fri, Apr 23, 2010 at 8:42 PM, Robbie Banks <robbie.banks at gmail.com> wrote:
> How do I change the color of the lines in an Angle or Distance Widget?

I have only done this for the vtkDistanceWidget, but the
vtkAngleWidget should work similar,
and the code-segment is in C# (and ActiViz.NET), so some conversions
might be needed ;-)

   vtkDistanceWidget distWidGet = new vtkDistanceWidget();
   /* init, ... DistanceWidget  */
   //get 2D representation
   vtkDistanceRepresentation2D rep2D =
   	(vtkDistanceRepresentation2D)distWidGet.GetRepresentation();
   vtkPropCollection propies = new vtkPropCollection();
   rep2D.GetAxis().GetActors2D(propies);
   //propies.GetItemAsObject(0) |-> vtkAxisActor2D
   if (propies.GetItemAsObject(0) is vtkAxisActor2D)
   {
      vtkAxisActor2D ax =
      	(vtkAxisActor2D) propies.GetItemAsObject(0);
      ax.GetProperty().SetColor(0, 0, 0); //black
   }

hth

mirko

-- 
Real programmers don't document; if it was
hard to write, it should be hard to understand.



More information about the vtkusers mailing list