摆动中的交互式平面直线图 [英] interactive planar straight line graph in swing

查看:146
本文介绍了摆动中的交互式平面直线图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在JApplet上绘制交互式平面直线图(PSLG)。我使用鼠标单击来确定PSLG的顶点。

I am trying to draw an interactive planar straight line graph (PSLG) on a JApplet. I am using mouse-clicks to determine the vertices of the PSLG.

这是我用来绘制PSLG
边缘的算法1.用户执行鼠标点击的点被添加为顶点PSLG。
2.如果他点击第二个点,则直接在点和之前点击的点之间创建边缘

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. 2. If he clicks a second point,an edge is directly created among the point and the previously clicked-point

以下是我观察到的某些缺陷使用此算法:

Here are certain flaws which I observed due to the use of this algorithm:


  1. 无法创建不相交的平面集,例如只说一个线段

  2. 只有当用户点击起点所在的确切位置时,才会创建一个封闭的多边形[基本上,如果用户点击非常接近起点,则无法确定此点实际上是起点因为它出现在距离点的某个公差范围内。

我在这里检查了一些类似的问题,人们建议使用 JFreeChart 库。但据我所知,这些问题的情况是PSLG的要点已经知道了。我不知道 JFreeChart 是否可以用于创建交互式PSLG

I've checked out some similar questions over here and people suggest to use the JFreeChart library. But as far as I get, the scenario in those questions was that the points of the PSLG were already known. I do not know whether JFreeChart can be used for creating interactive PSLG's

我想到了添加点并且有一个按钮可以说在分数,但如果是这种情况,选择2分仍然会涉及2中遇到的接近问题。

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.

我想知道是否有人可以建议我如何更好的方法处理这种情况。

I was wondering if anybody could suggest me a better approach on how to handle this situation.

提前致谢

推荐答案

GraphPanel 可以适应此任务,但它可能会受益于更高级的边缘模型,以便更快地进行搜索。另请考虑 JGraph

GraphPanel could be adapted to this task, although it might benefit from a more advanced edge model for faster searching. Also consider JGraph.

这篇关于摆动中的交互式平面直线图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆