[英]interactive planar straight line graph in swing
I am trying to draw an interactive planar straight line graph (PSLG) on a JApplet.我正在尝试在 JApplet 上绘制交互式平面直线图 (PSLG)。 I am using mouse-clicks to determine the vertices of the PSLG.
我使用鼠标点击来确定 PSLG 的顶点。
Here is the algorithm which I am following for drawing edges of the PSLG 1. The point where user performs a mouse-click is added as a vertex of the PSLG.这是我为绘制 PSLG 1 的边缘而遵循的算法。用户执行鼠标单击的点被添加为 PSLG 的顶点。 2. If he clicks a second point,an edge is directly created among the point and the previously clicked-point
2. 如果他点击第二个点,则直接在该点和之前点击的点之间创建一条边
Here are certain flaws which I observed due to the use of this algorithm:由于使用此算法,我观察到以下某些缺陷:
I've checked out some similar questions over here and people suggest to use the JFreeChart library.我在这里检查了一些类似的问题,人们建议使用JFreeChart库。 But as far as I get, the scenario in those questions was that the points of the PSLG were already known.
但据我所知,这些问题的场景是 PSLG 的要点已经为人所知。 I do not know whether JFreeChart can be used for creating interactive PSLG's
我不知道JFreeChart是否可以用于创建交互式 PSLG
I thought about adding points and having a button which would say add edges among points,but if that's the case selecting the 2 points will still involve the proximity problem encountered in 2.我考虑过添加点并有一个按钮会说在点之间添加边缘,但如果是这样选择2个点仍然会涉及2中遇到的邻近问题。
I was wondering if anybody could suggest me a better approach on how to handle this situation.我想知道是否有人可以建议我更好的方法来处理这种情况。
Thanks in advance提前致谢
GraphPanel
could be adapted to this task, although it might benefit from a more advanced edge model for faster searching. GraphPanel
可以适应这项任务,尽管它可能受益于更高级的边缘 model以加快搜索速度。 Also consider JGraph
.还可以考虑
JGraph
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.