简体   繁体   English

如何在 Sphere 上引发 MouseClick 事件

[英]How can I raise MouseClick Event on Sphere

I am trying to raise an event in C# using VTK when I clicked in a sphere当我在一个球体中单击时,我试图使用 VTK 在 C# 中引发一个事件

How can I do it?我该怎么做?

First you have to implement a custom InteractorStyle.首先,您必须实现自定义的 InteractorStyle。 Inside it's OnLeftButtonDown(), you have to use a Picker, and then the ->GetActor() function of the picker will tell you which object you picked.在它的 OnLeftButtonDown() 里面,你必须使用一个 Picker,然后选择器的 ->GetActor() 函数会告诉你你选择了哪个对象。 If this object equals the object you were looking for, you now have the condition in which you have clicked your sphere and can do whatever you want.如果此对象与您要查找的对象相同,则您现在处于单击球体并可以执行任何操作的条件。

(Here is a shell of this sort of situation (it doesn't check which object you clicked, but shows how to subclass the InteractorStyle and use the Picker): http://www.vtk.org/Wiki/VTK/Examples/Cxx/Interaction/Picking (这是这种情况的外壳(它不检查您单击了哪个对象,但显示了如何子类化 InteractorStyle 和使用选择器): http : //www.vtk.org/Wiki/VTK/Examples/ Cxx/交互/拣货

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM