Skip to content

Conversation

yvonneyx
Copy link
Contributor

@yvonneyx yvonneyx commented Apr 15, 2024

  • 功能实现
  • 单测
  • 官网案例

平行边是指在图中两点之间存在多条边的情况。为了在视觉上区分,引入了两种处理平行边的方式:bundlemerge

  • bundle 模式下,每条边都会与其他所有平行边捆绑在一起,并通过改变曲率与其他边分开。如果一组平行边的数量是奇数,那么中心的边将被绘制为直线,其他的边将被绘制为曲线。

  • merge 模式下,所有平行边将被合并为一条边。

image image
interface ProcessParallelEdgesOptions extends BaseTransformOptions {
  /**
   * <zh/> 处理模式,默认为捆绑
   *
   * <en/> Processing mode, default is bundle
   * @description
   * <zh/>
   * - merge: 将平行边合并为一条边,适用于不需要区分平行边的情况
   * - bundle: 每条边都会与其他所有平行边捆绑在一起,并通过改变曲率与其他边分开。如果一组平行边的数量是奇数,那么中心的边将被绘制为直线,其他的边将被绘制为曲线
   * <en/>
   * - merge: Merge parallel edges into one edge which is suitable for cases where parallel edges do not need to be distinguished
   * - bundle: Each edge will be bundled with all other parallel edges and separated from them by varying the curvature. If the number of parallel edges in a group is odd, the central edge will be drawn as a straight line, and the others will be drawn as curves
   */
  mode: 'bundle' | 'merge';
  /**
   * <zh/> 考虑要处理的边,默认为全部边
   *
   * <en/> The edges to be handled, all edges by default
   */
  edges?: ID[];
  /**
   * <zh/> 边之间的距离,仅在捆绑模式下有效
   *
   * <en/> The distance between edges, only valid for bundling mode
   */
  distance?: number;
  /**
   * <zh/> 合并边的样式,仅在合并模式下有效
   *
   * <en/> The style of the merged edge, only valid for merging mode
   */
  style?: PathStyleProps;
}

@dosubot dosubot bot added size:XL labels Apr 15, 2024
@yvonneyx yvonneyx changed the title feat(transform): bundle parallel edges feat(transform): process parallel edges (bundle, merge) Apr 15, 2024
@yvonneyx yvonneyx force-pushed the feat/parallel-edges branch from 8e1e0ec to 8ecb340 Compare April 15, 2024 09:34
@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Apr 15, 2024
@yvonneyx yvonneyx force-pushed the feat/parallel-edges branch from 3a98a67 to e1ebdaa Compare April 15, 2024 13:13
@yvonneyx yvonneyx force-pushed the feat/parallel-edges branch from e1ebdaa to 97981a0 Compare April 15, 2024 13:46
@hustcc hustcc merged commit 0c58b62 into v5 Apr 15, 2024
@hustcc hustcc deleted the feat/parallel-edges branch April 15, 2024 17:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lgtm This PR has been approved by a maintainer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants