Skip to content

Commit

Permalink
refactor(geobase): deprecate PositionArray, PositionCoords and BoxCoo…
Browse files Browse the repository at this point in the history
…rds and related extensions #201
  • Loading branch information
navispatial committed Sep 8, 2023
1 parent 1916d1c commit 3043a8a
Show file tree
Hide file tree
Showing 8 changed files with 31 additions and 1 deletion.
4 changes: 3 additions & 1 deletion dart/geobase/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ NOTE: Version 0.6.0 currently [under development](https://github.com/navibyte/ge
* [Simplify Feature and FeatureCollection types #195](https://github.com/navibyte/geospatial/issues/195)
* [Remove deprecated types in geobase version 0.6.0 #194](https://github.com/navibyte/geospatial/issues/194)
* [Consistent crs and trs references in meta classes #196](https://github.com/navibyte/geospatial/issues/196)
* [Deprecate PositionArray, PositionCoords and BoxCoords #201](https://github.com/navibyte/geospatial/issues/201)

🛠 Refactoring:
* isEmptyByGeometry on Bounded (and feature objects too, not only geometries)

🛠 Maintenance:
* PositionArray, PositionCoords and BoxCoords moved from vector_data to vector.
* PositionArray, PositionCoords and BoxCoords moved from vector_data to vector
(and later deprecated by #201).

## 0.5.1

Expand Down
1 change: 1 addition & 0 deletions dart/geobase/lib/src/coordinates/data/position_data.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import '/src/utils/tolerance.dart';
/// A fixed-length and random-access view to positions with coordinate values.
///
/// See [Position] for description about supported coordinate values.
@Deprecated('Use PositionSeries instead')
mixin PositionData<E extends Position> implements Positionable {
/// The number of positions in this view.
int get length;
Expand Down
8 changes: 8 additions & 0 deletions dart/geobase/lib/src/vector/array/box_coords.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//
// Docs: https://github.com/navibyte/geospatial

// ignore_for_file: deprecated_member_use_from_same_package

part of 'coordinates.dart';

/// A geospatial bounding box as an iterable collection of coordinate values.
Expand All @@ -16,6 +18,7 @@ part of 'coordinates.dart';
/// * `asGeographic`: returned as a `Geographic` bounding box
///
/// See [Box] for description about supported coordinate values.
@Deprecated('Use Box instead')
abstract class BoxCoords extends Box with _CoordinatesMixin {
@override
final Iterable<double> _data;
Expand All @@ -24,6 +27,7 @@ abstract class BoxCoords extends Box with _CoordinatesMixin {
final Coords _type;

/// A bounding box with coordinate values of [type] from [source].
@Deprecated('Use Box.view instead')
const BoxCoords(Iterable<double> source, {Coords type = Coords.xy})
: _data = source,
_type = type;
Expand Down Expand Up @@ -51,6 +55,7 @@ abstract class BoxCoords extends Box with _CoordinatesMixin {
/// xyz | west, south, minElev, east, north, maxElev
/// xym | west, south, minM, east, north, maxM
/// xyzm | west, south, minElev, minM, east, north, maxElev, maxM
@Deprecated('Use Box.view instead')
factory BoxCoords.view(Iterable<double> source, {Coords type = Coords.xy}) {
if (source.length != 2 * type.coordinateDimension) {
throw invalidCoordinates;
Expand All @@ -61,6 +66,7 @@ abstract class BoxCoords extends Box with _CoordinatesMixin {
/// A bounding box as an iterable collection of coordinate values.
///
/// This factory is compatible with `CreateBox` function type.
@Deprecated('Use Box.create instead')
factory BoxCoords.create({
required double minX,
required double minY,
Expand Down Expand Up @@ -98,6 +104,7 @@ abstract class BoxCoords extends Box with _CoordinatesMixin {
/// A minimum bounding box calculated from [positions].
///
/// Throws FormatException if cannot create (ie. [positions] is empty).
@Deprecated('Use Box.from instead')
factory BoxCoords.from(Iterable<Position> positions) =>
Box.createBoxFrom(positions, BoxCoords.create);

Expand All @@ -109,6 +116,7 @@ abstract class BoxCoords extends Box with _CoordinatesMixin {
/// coordinate [type].
///
/// Throws FormatException if coordinates are invalid.
@Deprecated('Use Box.parse instead')
factory BoxCoords.parse(
String text, {
Pattern? delimiter = ',',
Expand Down
1 change: 1 addition & 0 deletions dart/geobase/lib/src/vector/array/coordinates.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,5 @@ part 'position_coords.dart';
/// * [PositionArray]: coordinate values of 0 to N positions in a flat structure
/// * [PositionCoords]: coordinate values of a single position
/// * [BoxCoords]: coordinate values of a single bounding box
@Deprecated('Use Position, PositionSeries or Box instead')
abstract class Coordinates extends Iterable<double> implements Positionable {}
4 changes: 4 additions & 0 deletions dart/geobase/lib/src/vector/array/coordinates_extensions.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ List<double> _requireLen(List<double> list, int len) {
/// A helper extension on `List<double>` to handle coordinate values.
///
/// See [Coordinates] for more information.
@Deprecated('Deprecated as Coordinates is deprecated')
extension ListCoordinateExtension on List<double> {
/// A bounding box with coordinate values as a view backed by `this`.
///
Expand Down Expand Up @@ -103,6 +104,7 @@ extension ListCoordinateExtension on List<double> {

/// A helper extension on `Iterable<Position>` to convert data as
/// [PositionArray].
@Deprecated('Deprecated as PositionArray is deprecated')
extension PositionIterableCoordinatesExtension on Iterable<Position> {
/// Returns positions of this `Position` iterable as `PositionArray`
/// structuring coordinates a flat structure of `double` iterable.
Expand Down Expand Up @@ -133,6 +135,7 @@ extension PositionIterableCoordinatesExtension on Iterable<Position> {

/// A helper extension on [Position] to convert position objects between
/// subtypes like [Projected], [Geographic] and [PositionCoords].
@Deprecated('Deprecated as PositionCoords is deprecated')
extension PositionCoordinatesExtension on Position {
/// Returns this position as an instance of [PositionCoords].
///
Expand Down Expand Up @@ -170,6 +173,7 @@ extension PositionCoordinatesExtension on Position {

/// A helper extension on [Box] to convert position objects between
/// subtypes like [ProjBox], [GeoBox] and [BoxCoords].
@Deprecated('Deprecated as BoxCoords is deprecated')
extension BoxCoordinatesExtension on Box {
/// Returns this bounding box as an instance of [BoxCoords].
///
Expand Down
1 change: 1 addition & 0 deletions dart/geobase/lib/src/vector/array/coordinates_mixin.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

part of 'coordinates.dart';

@Deprecated('Deprecated as Coordinates is too')
mixin _CoordinatesMixin implements Coordinates {
Iterable<double> get _data;
Coords get _type;
Expand Down
6 changes: 6 additions & 0 deletions dart/geobase/lib/src/vector/array/position_array.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//
// Docs: https://github.com/navibyte/geospatial

// ignore_for_file: deprecated_member_use_from_same_package

part of 'coordinates.dart';

/// Coordinate values of geospatial positions as an iterable collection.
Expand All @@ -15,6 +17,7 @@ part of 'coordinates.dart';
/// also use [dataTo] to map coordinate values to custom position types.
///
/// See [Position] for description about supported coordinate values.
@Deprecated('Use PositionSeries instead')
abstract class PositionArray with _CoordinatesMixin {
@override
final Iterable<double> _data;
Expand All @@ -23,6 +26,7 @@ abstract class PositionArray with _CoordinatesMixin {
final Coords _type;

/// Positions with coordinate values of [type] from [source].
@Deprecated('Use PositionSeries.view instead')
const PositionArray(Iterable<double> source, {Coords type = Coords.xy})
: _data = source,
_type = type;
Expand All @@ -47,6 +51,7 @@ abstract class PositionArray with _CoordinatesMixin {
/// performance.
///
/// See [Position] for description about supported coordinate values.
@Deprecated('Use PositionSeries.view instead')
factory PositionArray.view(Iterable<double> source, {Coords type}) =
_PositionArrayImpl.view;

Expand All @@ -55,6 +60,7 @@ abstract class PositionArray with _CoordinatesMixin {
/// Coordinate values in [text] are separated by [delimiter].
///
/// Throws FormatException if coordinates are invalid.
@Deprecated('Use PositionSeries.parse instead')
factory PositionArray.parse(
String text, {
Pattern? delimiter = ',',
Expand Down
7 changes: 7 additions & 0 deletions dart/geobase/lib/src/vector/array/position_coords.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
//
// Docs: https://github.com/navibyte/geospatial

// ignore_for_file: deprecated_member_use_from_same_package

part of 'coordinates.dart';

/// A position as an iterable collection of coordinate values.
Expand Down Expand Up @@ -36,6 +38,7 @@ part of 'coordinates.dart';
/// `.xyz` | 3D | 3 | `double` | + | + | + |
/// `.xym` | 2D | 3 | `double` | + | + | | +
/// `.xyzm` | 3D | 4 | `double` | + | + | + | +
@Deprecated('Use Position instead')
abstract class PositionCoords extends Position with _CoordinatesMixin {
@override
final Iterable<double> _data;
Expand All @@ -44,6 +47,7 @@ abstract class PositionCoords extends Position with _CoordinatesMixin {
final Coords _type;

/// A geospatial position with coordinate values of [type] from [source].
@Deprecated('Use Position.view instead')
const PositionCoords(Iterable<double> source, {Coords type = Coords.xy})
: _data = source,
_type = type;
Expand Down Expand Up @@ -71,13 +75,15 @@ abstract class PositionCoords extends Position with _CoordinatesMixin {
/// xyz | lon, lat, elev
/// xym | lon, lat, m
/// xyzm | lon, lat, elev, m
@Deprecated('Use Position.view instead')
factory PositionCoords.view(Iterable<double> source, {Coords type}) =
_PositionCoordsImpl.view;

/// A position as an iterable collection of [x], [y], and optional
/// [z] and [m] values.
///
/// This factory is compatible with `CreatePosition` function type.
@Deprecated('Use Position.create instead')
factory PositionCoords.create({
required double x,
required double y,
Expand All @@ -103,6 +109,7 @@ abstract class PositionCoords extends Position with _CoordinatesMixin {
/// provided and [text] has 3 items, then xyz coordinates are assumed.
///
/// Throws FormatException if coordinates are invalid.
@Deprecated('Use Position.parse instead')
factory PositionCoords.parse(
String text, {
Pattern? delimiter = ',',
Expand Down

0 comments on commit 3043a8a

Please sign in to comment.