示例#1
0
  @Override
  public Path extractPath(long nodeId) {
    // contruct path from source to the minimum common node [s->...->c]
    Path sourcePath = contructPath(this.previousSource, this.minCommonNode);

    // contruct path from target to the minimum common node [c->...->t]
    Path targetPath = contructPath(this.previousTarget, this.minCommonNode).reversePath();

    // connect the source path and target path
    sourcePath.connect(targetPath);

    // return the connected path
    return sourcePath;
  }
  @Override
  public void path(Point start, LineType[] types, Point[][] points) {
    if (types.length != points.length) {
      return;
    }

    Path p = new Path();
    p.setStart(start);

    ArrayList<PathPart> parts = new ArrayList<PathPart>();
    for (int i = 0; i < types.length; ++i) {
      parts.add(new PathPart(types[i], points[i]));
    }
    p.setParts(parts);

    addToShapes(p);
  }