[vtk-developers] Proposal to make small enhancement to vtkSetGet

Sebastien BARRE seb-ml-vtk at barre.nom.fr
Thu Apr 26 15:19:33 EDT 2001


At 26/04/2001 23:28, Prabhu Ramachandran wrote:

>There are quite a few variables that use the vtkSetClampMacro for
>variables that have ranges of valid values.  AFAIK, right now there is
>no way to extract the actual range of allowed values.  If this
>information were available it would be easy to create a scale or
>slider widget to control such widgets automatically.  By adding about
>10 lines of code to vtkSetGet.h it should be trivially possible to add
>methods that return the max and min allowed values.  Here is sample
>code.

[...]

>What do you folks think of this proposal?  If no one objects I will
>test and commit it this weekend.

Seems a good idea to me (as we both have the same GUI ideas in mind :)

>This should not affect any existing code.  I am not sure about the
>naming conventions that I have used here.  Let me know if I should use
>something like GetRadiusMinValue()/GetRadiusMaxValue() or anything
>else instead of what I used earlier.

I guess the Get___MinValue and Get__MaxValue would be better. Check :

   vtkSetClampMacro(MaximumSpeed,float,0.0,VTK_LARGE_FLOAT)

where :
         GetMaximumSpeedMax might be a bit difficult to grab. Or am I just 
paranoid ? :)

Of course, do not forget to rebuild VTK first :), to check if these new 
functions won't clash with any existing function with the same signature 
among the 122 files using vtkSetClampMacro.

I guess the next step would be to include these "semantic hints" at a 
higher level, directly in more meaningful types (typedefs would be fine), 
for example a vtkRGBTriplet instead of an array of float, a 
vtkAngleInDegrees instead of a float, so that we might detect these types 
in scripting language and provide a GUI that would allow the user to enter 
the value in any unit/way (RGB/CMYK/Lab, degrees/rad), and convert it to 
RGB/degrees, etc.). Of course, this fit in the famous "let's remove the 
'hints' file" process :)





More information about the vtk-developers mailing list