[vtkusers] converting vtkCallBackCommand into java

David Cole DLRdave at aol.com
Tue Jul 7 10:29:59 EDT 2015


Take a look at the "myCallback" code here as an example of how to
handle VTK events in Java:

    http://www.vtk.org/Wiki/VTK/Examples/Java/Miscellaneous/Cone6

Does that work?


HTH,
David C.



On Mon, Jul 6, 2015 at 11:28 PM, James Potota
<tr_jun-jiang.ee at vitrox.com> wrote:
> I want to implement a clipping function in my java_wrapped vtk program
> exactly like this
> http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/ImplicitPlaneWidget2
> <http://www.vtk.org/Wiki/VTK/Examples/Cxx/Widgets/ImplicitPlaneWidget2>
>
> However I don't know how to convert the following code snippet (callback for
> interactor) into java:
>
> /// Callback for the interaction
> // This does the actual work: updates the vtkPlane implicit function.
> // This in turn causes the pipeline to update and clip the object.
>
> class vtkIPWCallback : public vtkCommand
> {
> public:
>   static vtkIPWCallback *New()
>     { return new vtkIPWCallback; }
>   virtual void Execute(vtkObject *caller, unsigned long, void*)
>     {
>     vtkImplicitPlaneWidget2 *planeWidget =
>       reinterpret_cast<vtkImplicitPlaneWidget2*>(caller);
>     vtkImplicitPlaneRepresentation *rep =
>
> reinterpret_cast<vtkImplicitPlaneRepresentation*>(planeWidget->GetRepresentation());
>     rep->GetPlane(this->Plane);
>     }
>   vtkIPWCallback():Plane(0),Actor(0) {}
>   vtkPlane *Plane;
>   vtkActor *Actor;
> };/
>
> If I'm not mistaken addObserver() in Java does the same function, however I
> don't know where to start as I have difficulty to understand the syntax such
> as Virtual Void. Can someone pls give me a hint or guide or example? thank
> you. Sorry for my noobies.
>
>
>
> --
> View this message in context: http://vtk.1045678.n5.nabble.com/converting-vtkCallBackCommand-into-java-tp5732734.html
> Sent from the VTK - Users mailing list archive at Nabble.com.
> _______________________________________________
> 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
>
> Search the list archives at: http://markmail.org/search/?q=vtkusers
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/vtkusers


More information about the vtkusers mailing list