Skip to content

Commit

Permalink
remove unused imports
Browse files Browse the repository at this point in the history
  • Loading branch information
jsiedentop committed Feb 29, 2024
1 parent 025aadc commit 25a1bbb
Show file tree
Hide file tree
Showing 32 changed files with 40 additions and 55 deletions.
1 change: 0 additions & 1 deletion benchmark/explode_benchmark.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:benchmark/benchmark.dart';
import 'package:turf/src/explode.dart';
import 'package:turf/turf.dart';

var poly = Polygon(coordinates: [
Expand Down
1 change: 0 additions & 1 deletion benchmark/line_segment_benchmark.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:benchmark/benchmark.dart';
import 'package:turf/line_segment.dart';
import 'package:turf/helpers.dart';

void main() {
LineString lineString = LineString(
Expand Down
4 changes: 0 additions & 4 deletions lib/intersection.dart

This file was deleted.

16 changes: 8 additions & 8 deletions lib/src/along.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:turf/bearing.dart';
import 'package:turf/destination.dart';
import 'package:turf/helpers.dart';
import 'package:turf/length.dart';
import 'package:turf/src/distance.dart' as measure_distance;
import 'package:turf/src/invariant.dart';
import 'distance.dart' as measure_distance;
import 'invariant.dart';

/// Takes a [line] and returns a [Point] at a specified [distance] along the line.
///
Expand All @@ -24,16 +24,16 @@ Feature<Point> along(Feature<LineString> line, num distance,
if (distance < 0) {
distance = max(0, length(line, unit) + distance);
}
num travelled = 0;
num traveled = 0;
for (int i = 0; i < coords.length; i++) {
if (distance >= travelled && i == coords.length - 1) {
if (distance >= traveled && i == coords.length - 1) {
break;
}
if (travelled == distance) {
if (traveled == distance) {
return Feature<Point>(geometry: Point(coordinates: coords[i]));
}
if (travelled > distance) {
final overshot = distance - travelled;
if (traveled > distance) {
final overshot = distance - traveled;
final direction = bearing(Point(coordinates: coords[i]),
Point(coordinates: coords[i - 1])) -
180;
Expand All @@ -45,7 +45,7 @@ Feature<Point> along(Feature<LineString> line, num distance,
);
return Feature<Point>(geometry: interpolated);
} else {
travelled += measure_distance.distance(Point(coordinates: coords[i]),
traveled += measure_distance.distance(Point(coordinates: coords[i]),
Point(coordinates: coords[i + 1]), unit);
}
}
Expand Down
1 change: 0 additions & 1 deletion lib/src/bbox.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:turf/helpers.dart';
import 'package:turf/meta.dart';

/// Calculates the bounding box for any [geoJson] object, including [FeatureCollection].
Expand Down
3 changes: 1 addition & 2 deletions lib/src/bearing.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'dart:math';

import 'geojson.dart';
import 'helpers.dart';
import 'package:geotypes/geotypes.dart';

// http://en.wikipedia.org/wiki/Haversine_formula
// http://www.movable-type.co.uk/scripts/latlong.html
Expand Down
1 change: 0 additions & 1 deletion lib/src/booleans/boolean_contains.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:turf/src/invariant.dart';
import 'package:turf/turf.dart';
import 'boolean_helper.dart';

Expand Down
1 change: 0 additions & 1 deletion lib/src/booleans/boolean_intersects.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import '../../helpers.dart';
import '../../meta.dart';
import 'boolean_disjoint.dart';

Expand Down
1 change: 0 additions & 1 deletion lib/src/booleans/boolean_overlap.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import 'package:turf/helpers.dart';
import 'package:turf/line_overlap.dart';
import 'package:turf/line_segment.dart';
import 'package:turf/src/invariant.dart';
Expand Down
1 change: 0 additions & 1 deletion lib/src/booleans/boolean_valid.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import 'package:turf/src/booleans/boolean_point_on_line.dart';
import 'package:turf/src/invariant.dart';
import 'package:turf/src/meta/extensions.dart';

import '../../helpers.dart';
import '../line_intersect.dart';
import 'boolean_crosses.dart';

Expand Down
4 changes: 2 additions & 2 deletions lib/src/centroid.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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.
/// Takes a [Feature] or a [FeatureCollection] and computes the centroid as
/// the mean of all vertices within the object.
///
/// example:
/// ```dart
Expand Down
3 changes: 1 addition & 2 deletions lib/src/destination.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'dart:math';

import 'geojson.dart';
import 'package:geotypes/geotypes.dart';
import 'helpers.dart';

Position destinationRaw(Position origin, num distance, num bearing,
Expand Down
2 changes: 1 addition & 1 deletion lib/src/distance.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:math';

import 'geojson.dart';
import 'package:geotypes/geotypes.dart';
import 'helpers.dart';

//http://en.wikipedia.org/wiki/Haversine_formula
Expand Down
3 changes: 1 addition & 2 deletions lib/src/explode.dart
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import 'package:turf/helpers.dart';
import 'package:turf/meta.dart';

/// Takes a feature or set of features and returns all positions as [Point]s.
/// Takes [GeoJSONObhect] input.
/// Takes [GeoJSONObject] input.
/// Returns [FeatureCollection<point>] representing the exploded input features
/// Throws [Exception] if it encounters an unknown geometry type
/// ```dart
Expand Down
1 change: 0 additions & 1 deletion lib/src/geojson.dart

This file was deleted.

3 changes: 2 additions & 1 deletion lib/src/intersection.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'geojson.dart';
// internal functions, not meant to be exposed
import 'package:geotypes/geotypes.dart';

Point? intersects(LineString line1, LineString line2) {
if (line1.coordinates.length != 2) {
Expand Down
5 changes: 4 additions & 1 deletion lib/src/line_overlap.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import 'package:rbush/rbush.dart';
import 'package:turf/boolean.dart';
import 'package:turf/line_segment.dart';
import 'package:turf/meta.dart';
import 'package:turf/src/booleans/boolean_helper.dart';
import 'package:turf/turf.dart';
import '../helpers.dart';
import 'destination.dart';
import 'invariant.dart';
import 'nearest_point_on_line.dart';

/// Takes any [LineString], [MultiLineString], [Polygon] or [MultiPolygon] and
/// returns the overlapping lines between both features.
Expand Down
7 changes: 3 additions & 4 deletions lib/src/line_segment.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import 'package:turf/src/meta/coord.dart';
import 'package:turf/src/meta/flatten.dart';

import 'geojson.dart';
import 'meta/coord.dart';
import 'meta/flatten.dart';
import 'package:geotypes/geotypes.dart';

/// Creates a [FeatureCollection] of 2-vertex [LineString] segments from a
/// [LineString] or [MultiLineString] or [Polygon] and [MultiPolygon]
Expand Down
7 changes: 4 additions & 3 deletions lib/src/line_slice.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import 'package:turf/helpers.dart';
import 'package:turf/nearest_point_on_line.dart';
import 'package:turf/src/invariant.dart';
import 'package:geotypes/geotypes.dart';

import 'nearest_point_on_line.dart';
import 'invariant.dart';

/// Takes a [line], at a start point [startPt], and a stop point [stopPt]
/// and returns a subsection of the line in-between those points.
Expand Down
5 changes: 3 additions & 2 deletions lib/src/midpoint.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'bearing.dart';
import 'destination.dart';
import 'distance.dart';
import 'geojson.dart';
import 'package:geotypes/geotypes.dart';

Position midpointRaw(Position point1, Position point2) {
var dist = distanceRaw(point1, point2);
Expand All @@ -12,7 +12,8 @@ Position midpointRaw(Position point1, Position point2) {
}

/// Takes two [Point]s and returns a point midway between them.
/// The midpoint is calculated geodesically, meaning the curvature of the earth is taken into account.
/// The midpoint is calculated geodesically, meaning the curvature of the
/// earth is taken into account.
/// For example:
///
/// ```
Expand Down
2 changes: 1 addition & 1 deletion lib/src/nearest_point.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'distance.dart';
import 'geojson.dart';
import 'package:geotypes/geotypes.dart';

/// Takes a reference [Point] and a FeatureCollection of Features
/// with Point geometries and returns the
Expand Down
2 changes: 1 addition & 1 deletion lib/src/nearest_point_on_line.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'dart:math';

import 'package:geotypes/geotypes.dart';
import 'bearing.dart';
import 'destination.dart';
import 'distance.dart';
import 'geojson.dart';
import 'helpers.dart';
import 'intersection.dart';

Expand Down
8 changes: 4 additions & 4 deletions lib/src/rhumb_destination.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import 'package:turf/helpers.dart';
import 'package:turf/src/invariant.dart';

///
/// Returns the destination [Point] having travelled the given distance along a Rhumb line from the
/// origin Point with the (varant) given bearing.
/// Returns the destination [Point] having traveled the given distance along a Rhumb line from the
/// origin Point with the (variant) given bearing.
///
/// example:
/// ```dart
Expand Down Expand Up @@ -62,7 +62,7 @@ Position calculateRhumbDestination(Position origin, num distance, num bearing,
final dPhi = delta * math.cos(theta);
var phi2 = phi1 + dPhi;

// check for some daft bugger going past the pole, normalise latitude if so
// check for some daft bugger going past the pole, normalize latitude if so
if (phi2.abs() > math.pi / 2) {
phi2 = phi2 > 0 ? math.pi - phi2 : -math.pi - phi2;
}
Expand All @@ -75,7 +75,7 @@ Position calculateRhumbDestination(Position origin, num distance, num bearing,
final dLambda = (delta * math.sin(theta)) / q;
final lambda2 = lambda1 + dLambda;

// normalise to −180..+180°
// normalize to −180..+180°
final lng = (((lambda2 * 180) / math.pi + 540) % 360) - 180;
final lat = (phi2 * 180) / math.pi;

Expand Down
1 change: 0 additions & 1 deletion lib/turf.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ export 'distance.dart';
export 'explode.dart';
export 'extensions.dart';
export 'helpers.dart';
export 'intersection.dart';
export 'invariant.dart';
export 'length.dart';
export 'line_intersect.dart';
Expand Down
2 changes: 1 addition & 1 deletion test/booleans/overlap_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'package:geotypes/geotypes.dart';
import 'package:test/test.dart';
import 'package:turf/src/booleans/boolean_helper.dart';
import 'package:turf/src/booleans/boolean_overlap.dart';
import 'package:turf/src/geojson.dart';

import '../context/helper.dart';
import '../context/load_test_cases.dart';
Expand Down
3 changes: 2 additions & 1 deletion test/components/center_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@ import 'dart:convert';
import 'dart:io';

import 'package:test/test.dart';
import 'package:turf/bbox.dart';
import 'package:turf/center.dart';
import 'package:turf/meta.dart';
import 'package:turf/src/bbox_polygon.dart';
import 'package:turf/turf.dart';

void main() {
group(
Expand Down
1 change: 0 additions & 1 deletion test/components/centroid_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:convert';
import 'dart:io';

import 'package:test/test.dart';
import 'package:turf/src/meta/feature.dart';
import 'package:turf/turf.dart';
import 'package:turf_equality/turf_equality.dart';

Expand Down
2 changes: 1 addition & 1 deletion test/components/explode_test.dart
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import 'dart:convert';
import 'dart:io';

import 'package:geotypes/geotypes.dart';
import 'package:test/test.dart';
import 'package:turf/src/explode.dart';
import 'package:turf/turf.dart';

void main() {
group(
Expand Down
1 change: 0 additions & 1 deletion test/components/polyline.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import 'package:test/test.dart';
import 'package:turf/helpers.dart';
import 'package:turf/polyline.dart';

void main() {
Expand Down
1 change: 0 additions & 1 deletion test/components/transform_rotate_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:convert';
import 'dart:io';

import 'package:test/test.dart';
import 'package:turf/helpers.dart';
import 'package:turf/src/centroid.dart';
import 'package:turf/src/invariant.dart';
import 'package:turf/src/transform_rotate.dart';
Expand Down
1 change: 0 additions & 1 deletion test/components/truncate_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import 'dart:convert';
import 'dart:io';

import 'package:test/test.dart';
import 'package:turf/helpers.dart';
import 'package:turf/truncate.dart';
import 'package:turf_equality/turf_equality.dart';

Expand Down
1 change: 0 additions & 1 deletion test/context/matcher.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import 'package:test/test.dart';
import 'package:turf/helpers.dart';
import 'package:turf/src/geojson.dart';
import 'package:turf_equality/turf_equality.dart';

Matcher equals<T extends GeoJSONObject>(T? expected) => _Equals<T>(expected);
Expand Down

0 comments on commit 25a1bbb

Please sign in to comment.