class GM_LineString extends GM_CurveSegment implements ILineString {

  @Override
  public double[] paramForPoint(IDirectPosition p) {
    double minDistance = Double.POSITIVE_INFINITY;
    double minParam = -1;
    double d = 0;
    for (int i = 0; i < this.sizeControlPoint() - 1; i++) {
      IDirectPosition p1 = this.getControlPoint(i);
      IDirectPosition p2 = this.getControlPoint(i + 1);
      double param = Operateurs.paramForPoint(p, p1, p2);
      IDirectPosition point = Operateurs.param(param, p1, p2);
      double distance = p.distance(point);
      if (distance < minDistance) {
        minDistance = distance;
        minParam = d + param;
      }
      d += p1.distance(p2);
    }
    return new double[] { minParam };
  }

  public  GM_LineString(List<IDirectPosition> list, boolean allowRepeated);
  public  GM_LineString(List<IDirectPosition> list);
  public  GM_LineString(IDirectPosition... list);
  public  GM_LineString(IDirectPositionList points);
  public  GM_LineString(IDirectPositionList points, boolean allowRepeated);

}