VtkCellLocator and Java

OK, finally, FINALLY, coming back to this. What we’ve done is made child classes of the classes I mentioned above (since we can’t declare the method twice in the same file), and for the methods I mentioned, changing any places where an array is mentioned (which in C could be any size) and changing the signature to a fixed size array - this seems to help the wrapping mechanism recognize it as a valid function that can be exposed to Java (maybe? I’m unclear exactly how the wrapping works). This technique was done before I started working on this project, so I’m not sure if there is another way to do it that is more efficient. Here’s an example: For Common/DataModel/vtkCellLocator, we have a substitute class, vtksbCellLocator, that does the following for FindCellsWithinBounds (whose signature in the parent class is FindCellsWithinBounds(double*, vtkIdList*)

  // Description:
  // This simply calls the corresponding method in the base class but
  // allows this function to be called from Java since all pointers
  // have been replaced with 1 element arrays.
  void FindCellsWithinBounds(double bbox[6], vtkIdList *cells)
  {
	  return Superclass::FindCellsWithinBounds(bbox, cells);
  }

That’s a representative example of what we do in order to expose these methods to Java. So I guess what I’m looking for is:

  • Can a method like this be exposed to Java without jumping through these hoops? From your previous responses, it sounds like the answer to that is “no” even though it is possible in Python
  • If not, what is the possibility of adding a similarly named method that adopts this signature so it can co-exist alongside the current method call? The compiler (obviously) sees the signatures as the same, so it says it is a redeclaration of the method. Since it will be named differently, then maybe it would be exposed to Java?

We’re trying to avoid having to patch the VTK code every time a new release comes out and build it ourselves, and having this built in would save us a lot of time!

Any information or guidance you can give would be appreciated. I’m more than happy to put in an MR once a decision is made.

–Josh