asString static method

String asString(
  1. CoordinateSequence cs
)

Creates a string representation of a {@link CoordinateSequence}. The format is:

  ( ord0,ord1.. ord0,ord1,...  ... )

@param cs the sequence to output @return the string representation of the sequence

Implementation

static String asString(CoordinateSequence cs) {
  int size = cs.size();
  if (size == 0) return "()";
  int dim = cs.getDimension();
  StringBuffer builder = new StringBuffer();
  builder.write('(');
  for (int i = 0; i < size; i++) {
    if (i > 0) builder.write(" ");
    for (int d = 0; d < dim; d++) {
      if (d > 0) builder.write(",");
      builder.write(cs.getOrdinate(i, d).toStringAsFixed(1));
    }
  }
  builder.write(')');
  return builder.toString();
}