From ebb3dec1a25ad0534a354e22355e4da926f13435 Mon Sep 17 00:00:00 2001 From: Jonas Siedentop Date: Wed, 14 Feb 2024 18:11:45 +0100 Subject: [PATCH] fix equality bug for lineString --- lib/src/turf_equality_base.dart | 2 +- test/context/helper.dart | 25 +++++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 test/context/helper.dart diff --git a/lib/src/turf_equality_base.dart b/lib/src/turf_equality_base.dart index 114a00c..b614bbe 100644 --- a/lib/src/turf_equality_base.dart +++ b/lib/src/turf_equality_base.dart @@ -133,7 +133,7 @@ class Equality { line1.coordinates.first, newLine.coordinates.first)) { return false; } else { - _compareLine(line1, newLine); + return _compareLine(line1, newLine); } } } else { diff --git a/test/context/helper.dart b/test/context/helper.dart new file mode 100644 index 0000000..f786283 --- /dev/null +++ b/test/context/helper.dart @@ -0,0 +1,25 @@ +import 'package:turf/helpers.dart'; + +LineString lineString(List> coordinates) { + return LineString(coordinates: coordinates.toPositions()); +} + +Point point(List coordinates) { + return Point(coordinates: Position.of(coordinates)); +} + +Feature polygon(List>> coordinates) { + return Feature( + geometry: Polygon(coordinates: coordinates.toPositions()), + ); +} + +extension PointsExtension on List> { + List toPositions() => + map((position) => Position.of(position)).toList(growable: false); +} + +extension PolygonPointsExtensions on List>> { + List> toPositions() => + map((element) => element.toPositions()).toList(growable: false); +}