[vtk-developers] Manual conversion of some Tcl to Python tests.

David Thompson david.thompson at kitware.com
Fri Aug 31 12:39:52 EDT 2012


Hi David,

>> Yes, although it might be easier to have
>> 
>>    void SetColor( std::string, double* rgba, int numRGBATuples = 1 );
>>    double* GetColor( std::string, int swatch = 0 );
> 
> But then you are making unwrappable methods.  It's possible to
> have a wrapper hint that "double *rgba" is a 4-tuple, but it isn't
> possible to hint that it is a "4*N-tuple".

I agree SetColor would not be wrappable as-is.

> If you want to support swatches, you should have a GetColorSwatch()
> method, rather than complicate the GetColor() method.

... but why wouldn't GetColor() work? It would always return a pointer to a 4-tuple of doubles. Or do the wrappers prefer

   void GetColor( double color[4], std::string name, int swatch = 0 );

How about the following for SetColor()?

   void InsertColor( std::string name, double* rgba, int swatch = 0 );
   void InsertColor( std::string name, double r, double g, double b, double a=1., int swatch = 0 );
   void RemoveColor( std::string name );
   int  GetNumberOfSwatches( std::string name );

That seems wrappable and the vector could just be increased in size to accommodate whatever swatch number was provided (hence the name change from SetXXX to InsertXXX).

	David


More information about the vtk-developers mailing list