equals3D method

  1. @override
bool equals3D(
  1. covariant PositionSeries other, {
  2. double toleranceHoriz = defaultEpsilon,
  3. double toleranceVert = defaultEpsilon,
})
override

True if this series of positions equals with other by testing 3D coordinates of all positions (that must be in same order in both views).

Returns false if this or other is empty (isEmptyByGeometry is true).

Returns false if this or other do not contain 3D coordinates.

Differences on 2D coordinate values (ie. x and y, or lon and lat) between this and other must be within toleranceHoriz.

Differences on vertical coordinate values (ie. z or elev) between this and other must be within toleranceVert.

Tolerance values must be positive (>= 0.0).

Implementation

@override
bool equals3D(
  PositionSeries other, {
  double toleranceHoriz = defaultEpsilon,
  double toleranceVert = defaultEpsilon,
}) {
  assertTolerance(toleranceHoriz);
  assertTolerance(toleranceVert);
  if (!is3D || !other.is3D) return false;
  if (isEmptyByGeometry || other.isEmptyByGeometry) return false;
  if (identical(this, other)) return true;
  if (positionCount != other.positionCount) return false;

  // test bounding boxes if both position series objects have it
  final bb1 = bounds;
  final bb2 = other.bounds;
  if (bb1 != null &&
      bb2 != null &&
      !bb1.equals3D(
        bb2,
        toleranceHoriz: toleranceHoriz,
        toleranceVert: toleranceVert,
      )) {
    // both position series objects have boxes and boxes do not equal in 3D
    return false;
  }

  return _testEquals3D(
    other,
    toleranceHoriz: toleranceHoriz,
    toleranceVert: toleranceVert,
  );
}