如何检测用户与图形流的交互?
How to detect user interaction with graphstream?
我正在使用
调查在 Android 上使用 GraphStream
api 'com.github.graphstream:gs-ui-android:2.0-alpha'
api 'com.github.graphstream:gs-core:2.0-alpha'
我已经成功构建并显示了我的图表,
但是我看不到如何在我的图表中的节点上监听用户交互。
我需要在用户点击任意节点时显示一个Dialog,显示具体的节点信息。
我已经尝试在 org.graphstream.ui.android_viewer.AndroidViewer
上设置监听器,但是我从未收到任何回调
我可以在屏幕上拖动显示的节点,这样我就知道有默认的侦听器,但是如何添加我自己的侦听器?
您可以像这样使用 ViewerPipe 实现 ViewerListener :
ViewerPipe pipe = fragment.getViewer().newViewerPipe();
pipe.addAttributeSink( graph );
pipe.addViewerListener( this ); // this or any class which implements ViewerListener
pipe.pump();
在这里了解 ViewerPipe 的工作原理:http://graphstream-project.org/doc/Tutorials/Graph-Visualisation/
我正在使用
调查在 Android 上使用 GraphStreamapi 'com.github.graphstream:gs-ui-android:2.0-alpha'
api 'com.github.graphstream:gs-core:2.0-alpha'
我已经成功构建并显示了我的图表,
但是我看不到如何在我的图表中的节点上监听用户交互。
我需要在用户点击任意节点时显示一个Dialog,显示具体的节点信息。
我已经尝试在 org.graphstream.ui.android_viewer.AndroidViewer
上设置监听器,但是我从未收到任何回调
我可以在屏幕上拖动显示的节点,这样我就知道有默认的侦听器,但是如何添加我自己的侦听器?
您可以像这样使用 ViewerPipe 实现 ViewerListener :
ViewerPipe pipe = fragment.getViewer().newViewerPipe();
pipe.addAttributeSink( graph );
pipe.addViewerListener( this ); // this or any class which implements ViewerListener
pipe.pump();
在这里了解 ViewerPipe 的工作原理:http://graphstream-project.org/doc/Tutorials/Graph-Visualisation/