[vtkusers] Possible but in vtkSetGet?

Prabhu Ramachandran prabhu at aero.iitm.ernet.in
Thu Apr 5 17:24:46 EDT 2001


hi,

While working with a vtkScalarBarActor I had an annoying problem and
found the following code in vtkSetGet.h for the
vtkViewportCoordinateMacro

   524  #define vtkViewportCoordinateMacro(name) \
   525  virtual vtkCoordinate *Get##name##Coordinate () \
   526  { \
   527      vtkDebugMacro(<< this->GetClassName() << " (" << this << "): returni
   527  ng " #name "Coordinate address " << this->name##Coordinate ); \
   528      return this->name##Coordinate; \
   529  } \
   530  virtual void Set##name(float x[2]) {this->Set##name(x[0],x[1]);}; \
   531  virtual void Set##name(float x, float y) \
   532  { \
   533      this->name##Coordinate->SetCoordinateSystem(VTK_VIEWPORT); \
   534      this->name##Coordinate->SetValue(x,y); \
   535  } \

My question is why on earth is the code in line number 533 necessary
at all?  The problem with this line is demonstrated by the foll.  Say
you have something like this in Python

  sb = vtkScalarBarActor()
  sb.GetPositionCoordinate().SetCoordinateSystemToNormalizedViewPort()

  # carefully position the actor...

  pos = sb.GetPosition ()
  sb.SetPosition (pos)

Bang! All your carefult positioning is a waste!!  So is this an error
or is it there by design?

thanks,
prabhu




More information about the vtkusers mailing list