CoordinateArraySequence.fromSequence constructor

CoordinateArraySequence.fromSequence(
  1. CoordinateSequence? coordSeq
)

Creates a sequence based on a deep copy of the given {@link CoordinateSequence}. The coordinate dimension is set to equal the dimension of the input.

@param coordSeq the coordinate sequence that will be copied.

Implementation

CoordinateArraySequence.fromSequence(CoordinateSequence? coordSeq) {
  // NOTE: this will make a sequence of the default dimension
  if (coordSeq == null) {
    coordinates = [];
    return;
  }
  dimension = coordSeq.getDimension();
  measures = coordSeq.getMeasures();
  coordinates = []; //..length = (coordSeq.size());

  for (int i = 0; i < coordSeq.size(); i++) {
    coordinates!.add(coordSeq.getCoordinateCopy(i));
    // coordinates![i] = coordSeq.getCoordinateCopy(i);
  }
}