[vtkusers] VTK and Java - JNI issue

Monnier, Gilles Gilles.Monnier at oce.com
Thu Aug 16 11:06:53 EDT 2012



I'm currently facing an issue using VTK with java.


Actually, I'm trying to integrate a C++ library into my software. This
library is PCL (Point Cloud Library), which offer some interesting
features concerning triangulation and registration. Here is below how my
application is designed:




Kitware already provide the JNI interface for VTK, but PCL does not.
What I would like to do is to be able to request PCL to perform a
triangulation on the vtkPolyData I instanciated into my java code.


Therefore, I started to create the PCL JNI interface by creating a
simple method on the java side:


public native int nativePCL_triangulation(vtkPolyData inputCloud);


Then after having generated the header file, I need to implement the C++
code of the interface:


#include <vtkPolyData.h>

JNIEXPORT jint JNICALL nativePCL_triangulation(JNIEnv * env, jobject
obj, jobject polyDataJava)


       //vtkPolyData* vp = dynamic_cast<vtkPolyData*>(polyDataJava);

       return 0;



And here is my issue : How can I retrieve the pointer on the polyData I
instanciated into my java code? 

To be clear, I would like to access the C++ object instanciated by VTK
from the C++ part of the interface I want to implement (the best would
be a stuff like a dynamic_cast as in the comment above...). I have
absolutely no idea how to achieve that.


Thanks much,

Gilles Monnier

This message and attachment(s) are intended solely for use by the addressee and may contain information that is privileged, confidential or otherwise exempt from disclosure under applicable law.

If you are not the intended recipient or agent thereof responsible for delivering this message to the intended recipient, you are hereby notified that any dissemination, distribution or copying of this communication is strictly prohibited.

If you have received this communication in error, please notify the sender immediately by telephone and with a 'reply' message.

Thank you for your co-operation.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120816/c347eb01/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 9362 bytes
Desc: pic2.png
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20120816/c347eb01/attachment.png>

More information about the vtkusers mailing list