[vtkusers] VTK Java/C Wrapping/Coding Problem

Ambar C ambarc at gmail.com
Wed Aug 18 18:22:34 EDT 2010


Hi Luke,

>From what I see - the field vtkID in the vtkObjectBase class is of
type 'long' - how would I use this to cast into C++ recognizable
objects? Is there some hash that the ID is a key to; or something of
the sort?

Thanks,
Ambar

On Thu, Aug 12, 2010 at 1:52 PM, Luke Dodd <i.like.bread at gmail.com> wrote:
> Hi Ambar,
>
> If you look in vtkObjectBase.java (will only exist after comping vtk,
> in the build directory - not the source) you will see that it has a
> (protected) field called vtkId. This is essentially a C pointer to the
> vtk object the java object is wrapping. If you retrieve value and get
> it into C++ with a few horrible casts you could have a pointer to the
> object. You'll have to work around trying to get the protected field -
> this is possible in java (google it) or you could tweak
> vtkObjectBase.java (this is annoying because vtk object base is
> generated when building).
>
> Hopefully that should be enough to get you started. If you need more
> detailed help just ask.
>
> Best Wishes,
> Luke
>
> On 10 August 2010 23:12, Ambar C <ambarc at gmail.com> wrote:
>> Hello VTK users,
>>
>> I currently have a project that's in both Java and C++, and part of
>> the project involves a wrapper using the Java Native Interface (JNI)
>> where I use functionality from my C++ libraries in the Java code.
>>
>> Now the problem that I face is, both my Java and C++ codes use VTK
>> objects - and when I pass down, say a vtkPolyDataAlgorithm object
>> created in Java through to the C++ code, I'm not quite sure how to
>> cast/use it.
>>
>> Please feel free to ask any questions that would help you to answer my question.
>>
>> Best Regards,
>> Ambar
>> _______________________________________________
>> Powered by www.kitware.com
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ
>>
>> Follow this link to subscribe/unsubscribe:
>> http://www.vtk.org/mailman/listinfo/vtkusers
>>
>



More information about the vtkusers mailing list