convertDatum method

dynamic convertDatum(
  1. dynamic toDatum
)

Implementation

convertDatum(toDatum) {
  var oldCartesian;
  var transform;

  if (this.datum == null || this.datum == datums["WGS84"]) {
    oldCartesian = this;
    transform = toDatum["transform"];
  }
  if (toDatum == datums["WGS84"]) {
    oldCartesian = this;
    transform = this.datum["transform"].map((t) => -t).toList();
  }
  if (transform == null) {
    oldCartesian = this.convertDatum(datums["WGS84"]);
    transform = toDatum["transform"];
  }

  final newCartesian = oldCartesian.applyTransform(transform);
  newCartesian.datum = toDatum;

  return newCartesian;
}