Skip to content

Commit

Permalink
fix equality bug for lineString
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiedentop committed Feb 14, 2024
1 parent a30eed4 commit ebb3dec
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/turf_equality_base.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ class Equality {
line1.coordinates.first, newLine.coordinates.first)) {
return false;
} else {
_compareLine(line1, newLine);
return _compareLine(line1, newLine);
}
}
} else {
Expand Down
25 changes: 25 additions & 0 deletions test/context/helper.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import 'package:turf/helpers.dart';

LineString lineString(List<List<int>> coordinates) {
return LineString(coordinates: coordinates.toPositions());
}

Point point(List<double> coordinates) {
return Point(coordinates: Position.of(coordinates));
}

Feature<Polygon> polygon(List<List<List<int>>> coordinates) {
return Feature(
geometry: Polygon(coordinates: coordinates.toPositions()),
);
}

extension PointsExtension on List<List<int>> {
List<Position> toPositions() =>
map((position) => Position.of(position)).toList(growable: false);
}

extension PolygonPointsExtensions on List<List<List<int>>> {
List<List<Position>> toPositions() =>
map((element) => element.toPositions()).toList(growable: false);
}

0 comments on commit ebb3dec

Please sign in to comment.