diff --git a/.github/workflows/dart-unit-tests.yaml b/.github/workflows/dart-unit-tests.yaml index 8e2e566..31ad3fc 100644 --- a/.github/workflows/dart-unit-tests.yaml +++ b/.github/workflows/dart-unit-tests.yaml @@ -28,10 +28,6 @@ jobs: run: dart analyze if: always() - - name: Run build_runner - run: dart run build_runner build --delete-conflicting-outputs - if: always() - - name: Run tests with coverage enabled run: dart test --coverage=./coverage if: always() diff --git a/CHANGELOG.md b/CHANGELOG.md index fa6bae9..c9c23bf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,10 +1,21 @@ +## 0.1.0 +- Several bug fixes, including for LineString, FeatureCollection and Polygon equality +- Increase test coverage +- Relying on the GeoJson objects from geotypes instead of turf + +Huge thank to [@jsiedentop](https://github.com/jsiedentop) for helping! + ## 0.0.3 - This is solely a quality release, without new functionality. -## 0.0.2 +Huge thank to [@jsiedentop](https://github.com/jsiedentop) for helping! +## 0.0.2 - Several bugfixes, including fix of reversed and shifted polygon. -## 0.0.1 +Huge thank to [@armantorkzaban](https://github.com/armantorkzaban), [@lukas-h](https://github.com/lukas-h) for helping! +## 0.0.1 - Initial version. + +Huge thank to [@armantorkzaban](https://github.com/armantorkzaban), [@lukas-h](https://github.com/lukas-h) for helping! \ No newline at end of file diff --git a/README.md b/README.md index e93d31f..43ede0f 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # turf_equality -Comparison of two GeoJSON objects, based on the [turf pub-package](https://pub.dev/packages/turf). +Comparison of two GeoJSON objects, based on the [geotypes](https://pub.dev/packages/geotypes) library. diff --git a/lib/src/round.dart b/lib/src/round.dart new file mode 100644 index 0000000..e5e7b1b --- /dev/null +++ b/lib/src/round.dart @@ -0,0 +1,11 @@ +import 'dart:math'; + +/// Round number to precision +num round(num value, [num precision = 0]) { + if (!(precision >= 0)) { + throw Exception("precision must be a positive number"); + } + num multiplier = pow(10, precision); + num result = (value * multiplier); + return result.round() / multiplier; +} diff --git a/lib/src/turf_equality_base.dart b/lib/src/turf_equality_base.dart index fb6535a..f8db15a 100644 --- a/lib/src/turf_equality_base.dart +++ b/lib/src/turf_equality_base.dart @@ -1,5 +1,5 @@ -import 'package:turf/turf.dart'; -import 'package:turf/helpers.dart' as rounder; +import 'package:geotypes/geotypes.dart'; +import 'round.dart' as rounder; class Equality { /// Decides the number of fraction digits in a [double] diff --git a/pubspec.yaml b/pubspec.yaml index 3341609..0e8c53a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,18 +1,15 @@ name: turf_equality description: Comparison of two GeoJSON objects, based on the turf pub-package -version: 0.0.3 +version: 0.1.0 repository: https://github.com/dartclub/turf_equality environment: sdk: ">=2.17.3 <4.0.0" dependencies: - turf: ^0.0.8 - + geotypes: ^0.0.2 dev_dependencies: lints: ^3.0.0 test: ^1.19.3 - json_serializable: ^6.1.1 - build_runner: ^2.1.5 analyzer: ^6.4.0 benchmark: ^0.3.0 \ No newline at end of file diff --git a/test/context/helper.dart b/test/context/helper.dart index 3dffa4f..e5a5064 100644 --- a/test/context/helper.dart +++ b/test/context/helper.dart @@ -1,6 +1,6 @@ // A List of builders that are similar to the way TurfJs creates GeoJSON // objects. The idea is to make it easier to port JavaScript tests to Dart. -import 'package:turf/turf.dart'; +import 'package:geotypes/geotypes.dart'; Feature lineString(List> coordinates, {dynamic id}) { return Feature( diff --git a/test/geojson_equality_test.dart b/test/geojson_equality_test.dart index e495212..3b79fec 100644 --- a/test/geojson_equality_test.dart +++ b/test/geojson_equality_test.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:turf_equality/turf_equality.dart'; import 'package:test/test.dart'; -import 'package:turf/helpers.dart'; +import 'package:geotypes/geotypes.dart'; import 'context/helper.dart'; diff --git a/test/geojson_equality_wout_precision.dart b/test/geojson_equality_wout_precision.dart index a367d35..b3a1ada 100644 --- a/test/geojson_equality_wout_precision.dart +++ b/test/geojson_equality_wout_precision.dart @@ -3,7 +3,7 @@ import 'dart:io'; import 'package:turf_equality/turf_equality.dart'; import 'package:test/test.dart'; -import 'package:turf/helpers.dart'; +import 'package:geotypes/geotypes.dart'; void main() { group(