Skip to content

Commit

Permalink
Added missing alt1, alt2 in BBox constructor, BBox put in README (#100)
Browse files Browse the repository at this point in the history
* Added coordEach translation

* Added bBox translation

* Added center translation

* Added decode points from polyline

* Update read me

* Remove and exclude .idea from git indexing

* Convert double to Position

* Use existing coord each implementation

* Return bBox points in the correct order

* Add bbox unit test

* Change libraries namespaces

* Code refactor

* Add doc blocs and some more missing functions

* Add encode polyline feature

* Add tests for both encode and decode polylines

* Add bbox tests

* Add helper functions

* Convert array to Bbox

* Remove redundant helper functions

* Add documentation

* implementation

* tests init, documentation, addition of types and debug

* implemented, docs

* test initiation

* added it to /lib, updated readme, can close 97

* renamed the test file

* comments resolved

* typo

* unused lib removed

* merge bbox-polygon

* missing center_test.dart

* imported bbox_polygon to center_test

* test error fixes

* added alt 1,2 to Bbox

* added bbox to readme

* Fix typos

* bbox constructure changed to standard

* bbox optional positional param. set accordingly

* Documentation on limitation of optional prms. Bbox

* Update geojson.dart

* fix order of BBox default constructor in test

* update doc comment

* fix previously missed null exceptions

Co-authored-by: Dennis Mwea <[email protected]>
Co-authored-by: Lukas Himsel <[email protected]>
  • Loading branch information
3 people authored Jun 20, 2022
1 parent 25c99d2 commit 1e83297
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 9 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ Any new benchmarks must be named `*_benchmark.dart` and reside in the
### Measurement
- [ ] along
- [ ] area
- [ ] bbox
- [x] [bboxPolygon] (https://github.com/dartclub/turf_dart/blob/main/lib/bbox_polygon.dart)
- [x] [bbox](https://github.com/dartclub/turf_dart/blob/main/lib/bbox.dart)
- [x] [bboxPolygon](https://github.com/dartclub/turf_dart/blob/main/lib/bbox_polygon.dart)
- [x] [bearing](https://github.com/dartclub/turf_dart/blob/main/lib/bearing.dart)
- [ ] [center](https://github.com/Dennis-Mwea/turf_dart/blob/main/lib/src/center.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)
Expand Down
29 changes: 23 additions & 6 deletions lib/src/geojson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -278,13 +278,26 @@ class Position extends CoordinateType {
/// Please make sure, you arrange your parameters like this:
/// Longitude 1, Latitude 1, Altitude 1 (optional), Longitude 2, Latitude 2, Altitude 2 (optional)
/// You can either specify 4 or 6 parameters
/// If you are using the default constructor with two dimensional positions (lng + lat only), please use the constructor like this:
/// `BBox(lng1, lat1, lng2, lat2);`
class BBox extends CoordinateType {
BBox(
/// longitude 1
num lng1,

/// latitude 1
num lat1,

/// longitude 2 for 2 dim. positions; altitude 1 for 3 dim. positions
num alt1,

/// latitude 2 for 2 dim. positions; longitude 2 for 3 dim. positions
num lng2, [

/// latitude 2 for 3 dim. positions
num? lat2,

/// altitude 2 for 3 dim. positions
num? alt2,
]) : super([
lng1,
Expand Down Expand Up @@ -335,14 +348,18 @@ class BBox extends CoordinateType {
BBox copyWith({
num? lng1,
num? lat1,
num? lng2,
num? alt1,
num? lat2,
num? lng2,
num? alt2,
}) =>
BBox(
lng1 ?? this.lng1,
lat1 ?? this.lat1,
lng2 ?? this.lng2,
lat2 ?? this.lat2,
BBox.named(
lng1: lng1 ?? this.lng1,
lat1: lat1 ?? this.lat1,
alt1: alt1 ?? this.alt1,
lng2: lng2 ?? this.lng2,
lat2: lat2 ?? this.lat2,
alt2: alt2 ?? this.alt2,
);

@override
Expand Down

0 comments on commit 1e83297

Please sign in to comment.