appendCoordinate static method

void appendCoordinate(
  1. CoordinateSequence seq,
  2. List<Ordinate> outputOrdinates,
  3. int i,
  4. StringBuffer writer,
  5. NumberFormat formatter,
)

Appends the i'th coordinate from the sequence to the writer

If the {@code seq} has coordinates that are {@link double.NAN}, these are not written, even though {@link #outputDimension} suggests this.

@param seq the CoordinateSequence to process @param i the index of the coordinate to write @param writer the output writer to append to @param formatter the formatter to use for writing ordinate values

Implementation

static void appendCoordinate(
    CoordinateSequence seq,
    List<Ordinate> outputOrdinates,
    int i,
    StringBuffer writer,
    NumberFormat formatter) {
  writer.write(writeNumber(seq.getX(i), formatter) +
      " " +
      writeNumber(seq.getY(i), formatter));

  if (outputOrdinates.contains(Ordinate.Z)) {
    double z = seq.getZ(i);
    if (!z.isNaN) {
      writer.write(" ");
      writer.write(writeNumber(seq.getZ(i), formatter));
    } else {
      writer.write(" NaN");
    }
  }

  if (outputOrdinates.contains(Ordinate.M)) {
    writer.write(" ");
    writer.write(writeNumber(seq.getM(i), formatter));
  }
}