Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for release 0.0.7 #119

Merged
merged 52 commits into from
Jul 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
52 commits
Select commit Hold shift + click to select a range
ab88527
initial null-safety implementation
lukas-h Nov 21, 2021
851338f
attributes non-nullable + tests, fix meta tests
lukas-h Nov 22, 2021
31f9e21
make altitude for Position and BBox nullable
lukas-h Nov 22, 2021
d7a630b
update action deps, build runner
lukas-h Nov 22, 2021
b23f3f1
delete conflicting outputs, dart test on PR action
lukas-h Nov 23, 2021
95631be
Strongly type and refactor geomEach meta function
baparham Nov 22, 2021
6494415
simplify geomEach
lukas-h Nov 23, 2021
0360b08
Add coverage reporting to pull requests tests
baparham Nov 23, 2021
3a21086
Allow PR coverage comment to fail
baparham Nov 24, 2021
736342d
Refactor coverage reporting into its own job
baparham Nov 24, 2021
d35c4ce
Move coverage reporting into separate workflow
baparham Nov 25, 2021
b5935d4
geomEach: nullable fields #36
lukas-h Nov 24, 2021
dee647e
fix types in tests
lukas-h Nov 24, 2021
272a778
Update to latest romeovs/lcov-reporter-action
baparham Nov 28, 2021
13ff21d
raise version for release 0.0.3
lukas-h Nov 28, 2021
bb33084
[meta] add implementation and test for featureEach and propEach (#24)
tobrun Dec 7, 2021
bcc7cfb
Assemble different types, refactor GeoJSON serialization, general imp…
lukas-h Dec 14, 2021
0b02608
bump version for release
lukas-h Dec 19, 2021
d427d05
Add basic benchmarking framework (#51)
baparham Jan 15, 2022
fde7642
Add pub version badge
lukas-h Jan 15, 2022
2aff26e
[meta] add coordeach implementation (#50)
tobrun Feb 20, 2022
f3b6b0a
Add implementation for getCoord & getCoords // invariant package (#53)
lukas-h Mar 16, 2022
0c4522c
Add flattenEach function and tests (#48)
baparham Mar 16, 2022
ad7b2ad
refactor coordEach with geomEach, change type in geomEach callback (#68)
lukas-h Mar 19, 2022
5c0d02a
Port coordAll function and test, also: refactor coordEach callback (…
armantorkzaban Mar 21, 2022
4f49a28
Update README.md
lukas-h Mar 24, 2022
16ade7a
Feature reducers (#49)
baparham Mar 25, 2022
03d1839
Port cluster functions and tests (#69)
lukas-h Apr 1, 2022
b3b0ae2
Port meta segment functions & lineSegment (#70)
lukas-h Apr 4, 2022
f8f95eb
split up meta into separate files (#72)
lukas-h Apr 4, 2022
4fdcb58
Meta functions extension methods (#73)
lukas-h Apr 4, 2022
a35adb1
Update functions and packages in README.md (#67)
armantorkzaban Apr 12, 2022
6d6d786
Raise version to 0.0.5
lukas-h Apr 12, 2022
2ecfc4f
Documentation (#75)
armantorkzaban Apr 15, 2022
4cb1ca7
raise to version 0.0.6
lukas-h Apr 19, 2022
9135395
Improve pub score & raise to version 0.0.6+2 (#82)
lukas-h Apr 19, 2022
a940904
Improve pub score (rename example file, raise to 0.0.6+3) (#84)
lukas-h Apr 19, 2022
57c3616
Implement `nearestPointOn(Multi)Line` and `internal` intersects helpe…
lukas-h Apr 20, 2022
560d2a8
Port explode function and test (#93)
lukas-h Jun 15, 2022
25c99d2
Merge bbox-polygon and bbox, center, polyline decode (#99)
armantorkzaban Jun 19, 2022
1e83297
Added missing alt1, alt2 in BBox constructor, BBox put in README (#100)
armantorkzaban Jun 20, 2022
ea56d89
Implement rhumbBearing function and test (#109)
lukas-h Jul 4, 2022
b17d3fd
Ports lineToPolygon, polygonToLine, and their tests (#104)
armantorkzaban Jul 4, 2022
358a43e
Adds proper documentation to feature-conversion Part I (#115)
armantorkzaban Jul 7, 2022
885bd6d
Update impl status of feature conversion package
lukas-h Jul 7, 2022
f2cfcc6
Ports truncate package and its test (#111)
armantorkzaban Jul 7, 2022
2ffce92
add truncate reference
lukas-h Jul 7, 2022
037b03c
Ports clean_coords and its test (#112)
armantorkzaban Jul 7, 2022
0895750
Debugs GeometryCollection condition in truncate (#121)
armantorkzaban Jul 7, 2022
01029fa
close #116 - add src path to README
lukas-h Jul 7, 2022
78f68e9
update changelog, bump version for release
lukas-h Jul 7, 2022
ed64635
Merge branch 'releases' into prepare-for-0.0.7
lukas-h Jul 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,7 @@ build/
# Directory created by dartdoc
doc/api/

coverage/
coverage/

.idea/

13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
## 0.0.7

- Implements `nearestPointOn(Multi)Line` [#87](https://github.com/dartclub/turf_dart/pull/87)
- Implements `explode` function [#93](https://github.com/dartclub/turf_dart/pull/93)
- Implements `bbox-polygon` and `bbox`, `center`, polyline functions [#99](https://github.com/dartclub/turf_dart/pull/99)
- Updates the `BBox`-class constructor [#100](https://github.com/dartclub/turf_dart/pull/100)
- Implements `rhumbBearing` function [#109](https://github.com/dartclub/turf_dart/pull/109)
- Implements `lineToPolygon` and `polygonToLine` functions [#104](https://github.com/dartclub/turf_dart/pull/104)
- Implements `truncate` function [#111](https://github.com/dartclub/turf_dart/pull/111)
- Implements `cleanCoord` function [#112](https://github.com/dartclub/turf_dart/pull/112)
- Some documentation & README improvements

## 0.0.6+3

- Rename examples file

## 0.0.6+2

- Added code examples
Expand Down
31 changes: 16 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,32 +75,32 @@ Any new benchmarks must be named `*_benchmark.dart` and reside in the
### Measurement
- [ ] along
- [ ] area
- [ ] bbox
- [ ] bboxPolygon
- [x] [bearing](https://github.com/dartclub/turf_dart/blob/main/lib/bearing.dart)
- [ ] center
- [x] [bbox](https://github.com/dartclub/turf_dart/blob/main/lib/src/bbox.dart)
- [x] [bboxPolygon](https://github.com/dartclub/turf_dart/blob/main/lib/src/bbox_polygon.dart)
- [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] [destination](https://github.com/dartclub/turf_dart/blob/main/lib/destination.dart)
- [x] [distance](https://github.com/dartclub/turf_dart/blob/main/lib/distance.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
- [ ] length
- [x] [midpoint](https://github.com/dartclub/turf_dart/blob/main/lib/midpoint.dart)
- [x] [midpoint](https://github.com/dartclub/turf_dart/blob/main/lib/src/midpoint.dart)
- [ ] pointOnFeature
- [ ] polygonTangents
- [ ] pointToLineDistance
- [ ] rhumbBearing
- [x] [rhumbBearing](https://github.com/dartclub/turf_dart/blob/main/lib/src/rhumb_bearing.dart)
- [ ] rhumbDestination
- [ ] rhumbDistance
- [ ] square
- [ ] greatCircle

### Coordinate Mutation
- [ ] cleanCoords
- [x] [cleanCoords](https://github.com/dartclub/turf_dart/blob/main/lib/src/clean_coords.dart)
- [ ] flip
- [ ] rewind
- [ ] round
- [ ] truncate
- [x] [truncate](https://github.com/dartclub/turf_dart/blob/main/lib/src/truncate.dart)

### Transformation
- [ ] bboxClip
Expand All @@ -122,14 +122,15 @@ Any new benchmarks must be named `*_benchmark.dart` and reside in the
- [ ] transformScale
- [ ] union
- [ ] voronoi
- [x] [polyLineDecode](https://github.com/Dennis-Mwea/turf_dart/blob/main/lib/src/polyline.dart)

### Feature Conversion
- [ ] combine
- [ ] explode
- [x] [explode](https://github.com/dartclub/turf_dart/blob/main/lib/src/explode.dart)
- [ ] flatten
- [ ] lineToPolygon
- [x] [lineToPolygon](https://github.com/dartclub/turf_dart/blob/main/lib/src/line_to_polygon.dart)
- [ ] polygonize
- [ ] polygonToLine
- [x] [polygonToLine](https://github.com/dartclub/turf_dart/blob/main/lib/src/polygon_to_line.dart)

### MISC
- [ ] ellipse
Expand All @@ -143,7 +144,7 @@ Any new benchmarks must be named `*_benchmark.dart` and reside in the
- [ ] lineSliceAlong
- [ ] lineSplit
- [ ] mask
- [ ] nearestPointOnLine
- [x] [nearestPointOnLine](https://github.com/dartclub/turf_dart/blob/main/lib/src/nearest_point_on_line.dart)
- [ ] sector
- [ ] shortestPath
- [ ] unkinkPolygon
Expand Down Expand Up @@ -175,7 +176,7 @@ Any new benchmarks must be named `*_benchmark.dart` and reside in the
- [ ] triangleGrid

### Classification
- [x] [nearestPoint](https://github.com/dartclub/turf_dart/blob/main/lib/nearest_point.dart)
- [x] [nearestPoint](https://github.com/dartclub/turf_dart/blob/main/lib/src/nearest_point.dart)

### Aggregation
- [ ] collect
Expand Down
21 changes: 21 additions & 0 deletions benchmark/explode_benchmark.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:benchmark/benchmark.dart';
import 'package:turf/src/explode.dart';
import 'package:turf/turf.dart';

var poly = Polygon(coordinates: [
[
Position.of([0, 0]),
Position.of([0, 10]),
Position.of([10, 10]),
Position.of([10, 0]),
Position.of([0, 0]),
],
]);

main() {
group('explode', () {
benchmark('simple', () {
explode(poly);
});
});
}
3 changes: 3 additions & 0 deletions lib/bbox.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library turf_bbox;

export "src/bbox.dart";
3 changes: 3 additions & 0 deletions lib/bbox_polygon.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library turf_bbox_polygon.dart;

export 'src/bbox_polygon.dart';
1 change: 1 addition & 0 deletions lib/bearing.dart
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
library turf_bearing;

export 'src/bearing.dart';
export 'src/rhumb_bearing.dart';
3 changes: 3 additions & 0 deletions lib/center.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library turf_center;

export 'src/center.dart';
3 changes: 3 additions & 0 deletions lib/clean_coords.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library clean_coords.dart;

export 'src/clean_coords.dart';
3 changes: 3 additions & 0 deletions lib/explode.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library explode;

export 'src/explode.dart';
3 changes: 3 additions & 0 deletions lib/line_to_polygon.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library turf_line_to_polygon.dart;

export 'src/line_to_polygon.dart';
3 changes: 3 additions & 0 deletions lib/nearest_point_on_line.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library turf_nearest_point_on_line;

export 'src/nearest_point_on_line.dart';
3 changes: 3 additions & 0 deletions lib/polygon_to_line.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library turf_polygon_to_line;

export 'src/polygon_to_line.dart';
3 changes: 3 additions & 0 deletions lib/polyline.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
library turf_polyline;

export 'src/polyline.dart';
39 changes: 39 additions & 0 deletions lib/src/bbox.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
import 'package:turf/helpers.dart';
import 'package:turf/meta.dart';

/// Calculates the bounding box for any [geoJson] object, including [FeatureCollection].
/// If [recompute] is not set and the [bbox] is not null, the function uses the [bbox] of the given [GeoJSONObject].
BBox bbox(GeoJSONObject geoJson, {bool recompute = false}) {
if (geoJson.bbox != null && !recompute) {
return geoJson.bbox!;
}

var result = BBox.named(
lat1: double.infinity,
lng1: double.infinity,
lat2: double.negativeInfinity,
lng2: double.negativeInfinity,
);

coordEach(
geoJson,
(Position? currentCoord, _, __, ___, ____) {
if (currentCoord != null) {
if (result.lng1 > currentCoord.lng) {
result = result.copyWith(lng1: currentCoord.lng);
}
if (result.lat1 > currentCoord.lat) {
result = result.copyWith(lat1: currentCoord.lat);
}
if (result.lng2 < currentCoord.lng) {
result = result.copyWith(lng2: currentCoord.lng);
}
if (result.lat2 < currentCoord.lat) {
result = result.copyWith(lat2: currentCoord.lat);
}
}
},
);

return result;
}
42 changes: 42 additions & 0 deletions lib/src/bbox_polygon.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import 'package:turf/helpers.dart';

/// Takes a [Bbox] and returns an equivalent [Feature<Polygon>].
/// ```dart
/// var bbox = Bbox(0, 0, 10, 10);
/// var poly = bboxPolygon(bbox);
/// //addToMap
/// var addToMap = [poly]
/// ```
Feature<Polygon> bboxPolygon(BBox bbox,
{Map<String, dynamic> properties = const {}, dynamic id}) {
var west = bbox[0]!;
var south = bbox[1]!;
var east = bbox[2]!;
var north = bbox[3]!;

if (bbox.length == 6) {
throw Exception("turf/bbox-polygon does not support BBox with 6 positions");
}

var lowLeft = [west, south];
var topLeft = [west, north];
var topRight = [east, north];
var lowRight = [east, south];

return Feature(
bbox: bbox.clone(),
properties: properties,
id: id,
geometry: Polygon(
coordinates: [
[
Position.of(lowLeft),
Position.of(lowRight),
Position.of(topRight),
Position.of(topLeft),
Position.of(lowLeft)
]
],
),
);
}
21 changes: 21 additions & 0 deletions lib/src/center.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import 'package:turf/bbox.dart' as t;
import 'package:turf/helpers.dart';

/// Takes a [Feature] or a [FeatureCollection] and returns the absolute center point of all feature(s).
Feature<Point> center(
GeoJSONObject geoJSON, {
dynamic id,
BBox? bbox,
Map<String, dynamic>? properties,
}) {
final BBox ext = t.bbox(geoJSON);
final num x = (ext[0]! + ext[2]!) / 2;
final num y = (ext[1]! + ext[3]!) / 2;

return Feature<Point>(
id: id,
bbox: bbox,
properties: properties,
geometry: Point(coordinates: Position.named(lat: y, lng: x)),
);
}
Loading