简体   繁体   English

Jung图直线平行边

[英]Jung graph straight parallel edges

Does Jung provide parallel straight edges without overlapping them? Jung是否提供平行的直边而不重叠? I want to obtain something like this 我想获得像这样

Is it possible to obtain this functionality without using QuadCurve/CubicCurve lines? 是否可以在不使用QuadCurve / CubicCurve行的情况下获得此功能?

You can define your own edge shapes as is done in EdgeShape.java; 您可以像在EdgeShape.java中那样定义自己的边缘形状。 specifically I would look at how BentLine is defined, since it would be fairly easy to modify to do something like what you want: 特别是,我将研究BentLine的定义方式,因为修改它来执行所需的操作相当容易:

https://github.com/jrtom/jung/blob/master/jung-visualization/src/main/java/edu/uci/ics/jung/visualization/decorators/EdgeShape.java#L141 https://github.com/jrtom/jung/blob/master/jung-visualization/src/main/java/edu/uci/ics/jung/visualization/decorators/EdgeShape.java#L141

In particular, I wouldn't actually recommend using 2+ parallel straight lines as edges, because it's cleaner when the endpoints of the lines are all at the same place (and this is what the visualization and rendering code assumes). 特别是,我实际上不建议使用2条以上的平行直线作为边缘,因为当直线的端点都在同一位置时(这是可视化和渲染代码所假定的),这样更干净。 If you want the lines to be basically straight, use lines that are straight for most of their length and then bend at each end to meet at the endpoint, eg: 如果要使线条基本是直线,请在大部分长度上使用直线,然后在两端弯曲以在端点处交汇,例如:

int index = getIndex(e, edgeIndexFunction);
float controlY = control_offset_increment + control_offset_increment * index;
BENT_LINE.reset();
BENT_LINE.moveTo(0.0f, 0.0f);
BENT_LINE.lineTo(0.1f, controlY);
BENT_LINE.lineTo(0.9f, controlY);
BENT_LINE.lineTo(1.0f, 1.0f);
return BENT_LINE;

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

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