private _calculatePath()

in web/src/app/pages/graph/architecture-graph/graph/base/path.ts [254:314]


  private _calculatePath(
    route: string[],
    currentPath: number[],
    from: Vector2,
    fromPipe: PathPipe | null,
    source: string,
  ) {
    if (route.length == 1) {
      // Destination should be connected to this pipe
      const pipeCenter = this.transform.anchorToPoint(AnchorPoints.CENTER);
      const middle = from;
      switch (this.direction) {
        case Direction.Horizontal:
          middle.y = pipeCenter.y + this.getOffsetFromSourceName(source);
          break;
        case Direction.Vertical:
          middle.x = pipeCenter.x + this.getOffsetFromSourceName(source);
          break;
      }
      currentPath.push(middle.x, middle.y);
      if (fromPipe) {
        fromPipe.includeJointForLine(source, middle);
      }
      this.includeJointForLine(source, middle);
      const pipeEndPoint = from;
      const endObject = this._connectedPoints[route[route.length - 1]];
      const endAnchor = this._connectedAnchors[route[route.length - 1]];
      const ep = endObject.transform.anchorToPoint(endAnchor);
      switch (this.direction) {
        case Direction.Horizontal:
          pipeEndPoint.x = ep.x;
          break;
        case Direction.Vertical:
          pipeEndPoint.y = ep.y;
          break;
      }
      this.includeJointForLine(source, pipeEndPoint);
      currentPath.push(pipeEndPoint.x, pipeEndPoint.y, ep.x, ep.y);
    } else {
      const pipeCenter = this.transform.anchorToPoint(AnchorPoints.CENTER);
      const pipeFirstPoint = from;
      switch (this.direction) {
        case Direction.Horizontal:
          pipeFirstPoint.y =
            pipeCenter.y + this.getOffsetFromSourceName(source);
          break;
        case Direction.Vertical:
          pipeFirstPoint.x =
            pipeCenter.x + this.getOffsetFromSourceName(source);
          break;
      }
      currentPath.push(pipeFirstPoint.x, pipeFirstPoint.y);
      const nextPipeId = route.pop()!;
      const nextPipe = this._connectedPipe[nextPipeId];
      if (fromPipe) {
        fromPipe.includeJointForLine(source, pipeFirstPoint);
      }
      this.includeJointForLine(source, pipeFirstPoint);
      nextPipe._calculatePath(route, currentPath, pipeFirstPoint, this, source);
    }
  }