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

David Gobbi david.gobbi at gmail.com
Fri Aug 31 16:14:33 EDT 2012


On Fri, Aug 31, 2012 at 10:39 AM, David Thompson
<david.thompson at kitware.com> wrote:
>
> ... but why wouldn't GetColor() work? It would always return a pointer to a 4-tuple of doubles.

I misunderstood.. I thought that in some cases it would returning a
pointer to a table of colors.  If it's always a 4-tuple, then it will
wrap just fine.

>  Or do the wrappers prefer
>    void GetColor( double color[4], std::string name, int swatch = 0 );

Right-hand-side getter methods are wrapped in python but are
un-pythonic.  They aren't wrapped in Java or Tcl.

> 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).

I prefer "Set" over "Insert", as far as names go.  The
vtkDataArray::InsertTuple() method drives me crazy, because its
semantics are completely different from the STL container "insert"
method.

 - David



More information about the vtk-developers mailing list