-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature-boolean-overlap
- Loading branch information
Showing
90 changed files
with
3,756 additions
and
67 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,4 +12,5 @@ doc/api/ | |
|
||
coverage/ | ||
|
||
.idea/ | ||
.idea/ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,24 +3,29 @@ | |
Welcome and thank you for deciding to contribute to the project! | ||
|
||
Here is how cooperation works perfectly at [Turf Dart](https://github.com/dartclub/turf_dart) | ||
|
||
#### Table of Contents | ||
- [Code of Conduct](#code-of-conduct) | ||
- [Get started](#get-started) | ||
- [Structure of modules](#structure-of-modules) | ||
- [Implementation Process](#implementation-process) | ||
- [Documentation](#documentation) | ||
- [GeoJSON object model](#GeoJSON-object-model) | ||
|
||
- [Code of Conduct](#code-of-conduct) | ||
- [Get started](#get-started) | ||
- [Structure of modules](#structure-of-modules) | ||
- [Implementation Process](#implementation-process) | ||
- [Documentation](#documentation) | ||
- [GeoJSON object model](#GeoJSON-object-model) | ||
|
||
## Code of conduct | ||
|
||
By participating, you are expected to uphold international human rights and fundamental freedoms! | ||
To put it simply, be kind to each other. | ||
To put it simply, be kind to each other. | ||
|
||
## Get started | ||
|
||
- Get the [Dart tools](https://dart.dev/tools) | ||
- Clone the repository: ```git clone [email protected]:dartclub/turf_dart.git``` | ||
- Navigate to project's folder in terminal & get its dependencies: ```dart pub get``` | ||
- Go through [Implementation Process](#implementation-process) | ||
- Import the library in your code and use it. For example: | ||
|
||
```dart | ||
import 'package:turf/helpers.dart'; | ||
import 'package:turf/src/line_segment.dart'; | ||
|
@@ -58,7 +63,8 @@ var total = segmentReduce<int>(poly, (previousValue, | |
``` | ||
|
||
## Structure of modules | ||
``` | ||
|
||
```text | ||
TURF_DART/lib/<MODULE NAME>.dart // public facing API, exports the implementation | ||
│ │ | ||
│ └───src/<MODULE NAME>.dart // the implementation | ||
|
@@ -67,7 +73,9 @@ TURF_DART/lib/<MODULE NAME>.dart // public facing API, exports the implementatio | |
│ | ||
└───test/components/<MODULE NAME>_test.dart // all the related tests | ||
``` | ||
|
||
## Implementation process | ||
|
||
- Check the Backlog/Issues for similar issues | ||
- Create a new branch _feature-_ from _main_ | ||
- Create a _draft Pull request_, mention in it the associated issues | ||
|
@@ -80,16 +88,17 @@ TURF_DART/lib/<MODULE NAME>.dart // public facing API, exports the implementatio | |
- run the benchmark: ```dart pub run benchmark``` | ||
- Commit | ||
- Convert to real Pull request _ready for review_ | ||
- Code review / mention a reviewer from [contributors list](https://github.com/dartclub/turf_dart/graphs/contributors) | ||
|
||
- Code review / mention a reviewer from [contributors list](https://github.com/dartclub/turf_dart/graphs/contributors) | ||
|
||
## Documentation | ||
|
||
We follow [Effective Dart](https://dart.dev/guides/language/effective-dart/documentation) guidelines for documentation. | ||
|
||
After going through the [Implementation Process](#implementation-process), please mention the made changes in [README.md](https://github.com/dartclub/turf_dart/blob/main/README.md) | ||
|
||
In order to add to this very documentation, please develop CONTRIBUTING.md in [documentation branch](https://github.com/dartclub/turf_dart/tree/documentation) | ||
|
||
## GeoJSON Object Model | ||
|
||
If you have not read our [README.md](https://github.com/dartclub/turf_dart/blob/main/README.md) this diagram will give you a lot of information. Please consider looking our [notable design decisions](https://github.com/dartclub/turf_dart/blob/main/README.md#notable-design-decisions). | ||
![polymorphism](https://user-images.githubusercontent.com/10634693/159876354-f9da2f37-02b3-4546-b32a-c0f82c372272.png) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
# turf.dart | ||
|
||
ℹ️ Looking for maintainers as a work student position in Germany: Write an email to [[email protected]](mailto:[email protected]) ℹ️ | ||
|
||
[![pub package](https://img.shields.io/pub/v/turf.svg)](https://pub.dev/packages/turf) | ||
|
||
THIS PROJECT IS WORK IN PROCESS | ||
|
@@ -85,7 +87,7 @@ Any new benchmarks must be named `*_benchmark.dart` and reside in the | |
- [x] [bearing](https://github.com/dartclub/turf_dart/blob/main/lib/src/bearing.dart) | ||
- [x] [center](https://github.com/Dennis-Mwea/turf_dart/blob/main/lib/src/center.dart) | ||
- [ ] centerOfMass | ||
- [ ] centroid | ||
- [x] [centroid](https://github.com/dartclub/turf_dart/blob/main/lib/src/centroid.dart) | ||
- [x] [destination](https://github.com/dartclub/turf_dart/blob/main/lib/src/destination.dart) | ||
- [x] [distance](https://github.com/dartclub/turf_dart/blob/main/lib/src/distance.dart) | ||
- [ ] envelope | ||
|
@@ -95,8 +97,8 @@ Any new benchmarks must be named `*_benchmark.dart` and reside in the | |
- [ ] polygonTangents | ||
- [ ] pointToLineDistance | ||
- [x] [rhumbBearing](https://github.com/dartclub/turf_dart/blob/main/lib/src/rhumb_bearing.dart) | ||
- [ ] rhumbDestination | ||
- [ ] rhumbDistance | ||
- [x] [rhumbDestination](https://github.com/dartclub/turf_dart/blob/main/lib/src/rhumb_destination.dart) | ||
- [x] [rhumbDistance](https://github.com/dartclub/turf_dart/blob/main/lib/src/rhumb_distance.dart) | ||
- [ ] square | ||
- [ ] greatCircle | ||
|
||
|
@@ -124,7 +126,7 @@ Any new benchmarks must be named `*_benchmark.dart` and reside in the | |
- [x] [polygonSmooth](ttps://github.com/dartclub/turf_dart/blob/main/lib/src/polygon_smooth.dart) | ||
- [ ] simplify | ||
- [ ] tesselate | ||
- [ ] transformRotate | ||
- [x] [transformRotate](https://github.com/dartclub/turf_dart/blob/main/lib/src/transform_rotate.dart) | ||
- [ ] transformTranslate | ||
- [ ] transformScale | ||
- [ ] union | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
include: package:dartclub_lint/dart.yaml | ||
include: package:lints/recommended.yaml | ||
|
||
analyzer: | ||
errors: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
library turf_centroid; | ||
|
||
export 'src/centroid.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
library turf_destination; | ||
|
||
export 'src/destination.dart'; | ||
export 'src/rhumb_destination.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
library turf_distance; | ||
|
||
export 'src/distance.dart'; | ||
export 'src/rhumb_distance.dart'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import 'package:turf/helpers.dart'; | ||
import 'package:turf/meta.dart'; | ||
|
||
/// Takes a [Feature] or a [FeatureCollection] and computes the centroid as the mean of all vertices within the object. | ||
/// | ||
/// example: | ||
/// ```dart | ||
/// final line = Feature<LineString>(geometry: LineString(coordinates: [Position(0, 0), Position(1, 1)])); | ||
/// | ||
/// final pt = centroid(line); | ||
/// ``` | ||
Feature<Point> centroid( | ||
GeoJSONObject geoJSON, { | ||
Map<String, dynamic>? properties, | ||
}) { | ||
num xSum = 0; | ||
num ySum = 0; | ||
int len = 0; | ||
|
||
coordEach(geoJSON, (coords, _, __, ___, ____) { | ||
if (coords != null) { | ||
xSum += coords[0]!; | ||
ySum += coords[1]!; | ||
len++; | ||
} | ||
}, true); | ||
|
||
return Feature<Point>( | ||
geometry: Point( | ||
coordinates: Position(xSum / len, ySum / len), | ||
), | ||
properties: properties, | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.