distance property

  1. @override
double distance
override

Gets the distance of the geometry.

This should be implemented by subclasses to compute the correct distance.

Implementation

@override
double get distance {
  var length = 0.0;
  for (var i = 0; i < coordinates.length - 1; i++) {
    var p1 = coordinates[i];
    var p2 = coordinates[i + 1];
    length += calculateHaversineDistance(p1[1], p1[0], p2[1], p2[0]);
  }
  return length;
}