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

remove all deprecated features from geo-types #772

Closed
wants to merge 2 commits into from

Conversation

nyurik
Copy link
Member

@nyurik nyurik commented Mar 15, 2022

This PR includes #798, which should be merged before this one


  • BREAKING: Remove deprecated functions on the Geometry<T>:
      * into_point - Switch to std::convert::TryInto<Point>
      * into_line_string - Switch to std::convert::TryInto<LineString>
      * into_line - Switch to std::convert::TryInto<Line>
      * into_polygon - Switch to std::convert::TryInto<Polygon>
      * into_multi_point - Switch to std::convert::TryInto<MultiPoint>
      * into_multi_line_string - Switch to std::convert::TryInto<MultiLineString>
      * into_multi_polygon - Switch to std::convert::TryInto<MultiPolygon>
  • BREAKING: Remove deprecated CoordinateType trait. Use CoordFloat or CoordNum instead.
  • BREAKING: Remove deprecated functions from LineString<T>
      * Remove points_iter() -- use points() instead.
      * Remove num_coords() -- use geo::algorithm::coords_iter::CoordsIter::coords_count instead.
  • BREAKING: Remove deprecated functions from Point<T>
      * Remove lng() -- use x() instead.
      * Remove set_lng() -- use set_x() instead.
      * Remove lat() -- use y() instead.
      * Remove set_lat() -- use set_y() instead.
  • BREAKING: Remove deprecated Polygon<T>::is_convex() -- use geo::is_convex on poly.exterior() instead.
  • BREAKING: Remove deprecated Rect<T>::try_new() -- use Rect::new instead, since Rect::try_new will never Error. Also removes corresponding InvalidRectCoordinatesError.

  • I agree to follow the project's code of conduct.
  • I added an entry to CHANGES.md if knowledge of this change could be valuable to users.

@nyurik nyurik requested a review from michaelkirk March 15, 2022 21:39
@nyurik nyurik mentioned this pull request Mar 15, 2022
1 task
@michaelkirk
Copy link
Member

As I said in discord where this conversation was also happening:

There is a cost associated with maintaining two branches. I think it would make sense to do something like this once an 0.8 release is in sight, but we don't yet have a single compelling reason to break geo-types, so I'd prefer to hold off for now.

Other people can feel free to weigh in on this though.

@nyurik
Copy link
Member Author

nyurik commented Mar 15, 2022

There is a cost associated with maintaining two branches. I think it would make sense to do something like this once an 0.8 release is in sight, but we don't yet have a single compelling reason to break geo-types, so I'd prefer to hold off for now.

sounds good, I will maintain this PR until more breaking features have accumulated. BTW, note that there is already one breaking change merged to main with the winding order, and another breaking one that we now use Rust 2021 -- https://github.com/georust/geo/blob/master/geo-types/CHANGES.md

@nyurik nyurik mentioned this pull request Mar 16, 2022
2 tasks
@lnicola
Copy link
Member

lnicola commented Mar 16, 2022

I don't think we're really in a position to maintain a separate maintenance release branch. It has its own costs, and looking at the recent changes, most of them have been new features and breaking changes in themselves, as opposed to bug fixes.

@urschrei
Copy link
Member

I don't think we're really in a position to maintain a separate maintenance release branch.

Agreed: we do not have the resources to maintain a separate maintenance branch. We can revisit this when 0.8 is in sight – I would personally be fine with removing these features, but others may have a more conservative view.

Copy link
Member

@frewsxcv frewsxcv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Considering we already have a breaking change in geo-types on main, we are already on course for a 0.8.0 release. So this looks good to merge to me. If we're hesitant on merging breaking changes, we should undo the breaking change on main so we can aren't blocking ourselves from releasing a new version of geo-types. @michaelkirk @urschrei I wanna make sure I have approval from you both before merging.

@michaelkirk
Copy link
Member

michaelkirk commented Apr 5, 2022

Considering we already have a breaking change in geo-types on main

My understanding is that we don't yet have any changes merged that warrant a breaking bump to geo-types yet.

1

note that there is already one breaking change merged to main with the winding order

Please see the earlier discussion about why I didn't think this was a breaking change: #757 (comment)

The summary that made sense to me was:

I think this falls in the "Possibly-breaking change" per cargo book and in unstable packages, it's OK to bump just the patch version for these changes. The order of returned lines isn't part of an explicit contract, so someone depending on that order to not conform to the winding order is unlikely.

2

another breaking one that we now use Rust 2021 --

Is upgrading to Rust 2021 a breaking change? To me that seems like taking advantage of any other new feature from an MSRV bump, and like with much of the rust community, we wouldn't consider it a breaking change.

@urschrei
Copy link
Member

urschrei commented Apr 5, 2022

I'm OK with the change.

@frewsxcv
Copy link
Member

frewsxcv commented Apr 5, 2022

@michaelkirk Gotcha, thanks for explaining. In that case, do you (or anyone) have any hesitations about a 0.7.4 release for geo-types?

@michaelkirk
Copy link
Member

do you (or anyone) have any hesitations about a 0.7.4 release for geo-types?

SGTM!

@frewsxcv frewsxcv mentioned this pull request Apr 6, 2022
2 tasks
bors bot added a commit that referenced this pull request Apr 6, 2022
796: Prepare for geo-types 0.7.4 release. r=nyruik,michaelkirk a=frewsxcv

- [x] I agree to follow the project's [code of conduct](https://github.com/georust/geo/blob/main/CODE_OF_CONDUCT.md).
- [x] I added an entry to `CHANGES.md` if knowledge of this change could be valuable to users.
---

As per #772 (comment)

Co-authored-by: Corey Farwell <coreyf@rwell.org>
@nyurik nyurik force-pushed the deprecate branch 3 times, most recently from a087498 to 8d1251a Compare April 6, 2022 05:01
Remove `geo-types` patches in `Cargo.toml` files, so that `geo-types` is now completelly separated from the rest of the code.

This should be reverted once geo-types 0.8+ is released.
* BREAKING: Remove deprecated functions on the `Geometry<T>`:
  * `into_point` - Switch to `std::convert::TryInto<Point>`
  * `into_line_string` - Switch to `std::convert::TryInto<LineString>`
  * `into_line` - Switch to `std::convert::TryInto<Line>`
  * `into_polygon` - Switch to `std::convert::TryInto<Polygon>`
  * `into_multi_point` - Switch to `std::convert::TryInto<MultiPoint>`
  * `into_multi_line_string` - Switch to `std::convert::TryInto<MultiLineString>`
  * `into_multi_polygon` - Switch to `std::convert::TryInto<MultiPolygon>`
* BREAKING: Remove deprecated `CoordinateType` trait. Use `CoordFloat` or `CoordNum` instead.
* BREAKING: Remove deprecated functions from `LineString<T>`
  * Remove `points_iter()` -- use `points()` instead.
  * Remove `num_coords()` -- use `geo::algorithm::coords_iter::CoordsIter::coords_count` instead.
* BREAKING: Remove deprecated functions from `Point<T>`
  * Remove `lng()` -- use `x()` instead.
  * Remove `set_lng()` -- use `set_x()` instead.
  * Remove `lat()` -- use `y()` instead.
  * Remove `set_lat()` -- use `set_y()` instead.
* BREAKING: Remove deprecated `Polygon<T>::is_convex()` -- use `geo::is_convex` on `poly.exterior()` instead.
* BREAKING: Remove deprecated `Rect<T>::try_new()` -- use `Rect::new` instead, since `Rect::try_new` will never Error. Also removes corresponding `InvalidRectCoordinatesError`.
@nyurik nyurik changed the title BREAKING: remove all deprecated features remove all deprecated features from geo-types Apr 6, 2022
nyurik added a commit to nyurik/geo that referenced this pull request Apr 21, 2022
This PR includes georust#772 and georust#812

---

This PR focuses on `geo-types` only. This is a part of georust#742.

This PR changes the underlying geo-type data structures to support 3D data and measurement values (M and Z values). The PR attempts to cause relatively minor disruptions to the existing users (see breaking changes below). My knowledge of the actual geo algorithms is limited, so please ping me for any specific algo change.

## geo-types restructuring
All geo type structs have been renamed from `Foo<T>(...)` to `Foo<T, Z=NoValue, M=NoValue>(...)`, and several type aliases were added:

```rust
// old
pub struct LineString<T: CoordNum>(pub Vec<Coordinate<T>>);

// new
pub struct LineString<T: CoordNum, Z: ZCoord=NoValue, M: Measure=NoValue>(pub Vec<Coordinate<T, Z, M>>);

pub type LineStringM<T, M=T> = LineString<T, NoValue, M>;
pub type LineString3D<T> = LineString<T, T, NoValue>;
pub type LineString3DM<T, M=T> = LineString<T, T, M>;
```

## NoValue magic
`NoValue` is an empty struct that behaves just like a number. It supports all math and comparison operations. This means that a `Z` or `M` value can be manipulated without checking if it is actually there.  This code works for Z and M being either a number or a NoValue:

```rust
pub struct NoValue;

impl<T: CoordNum, Z: ZCoord, M: Measure> Sub for Coordinate<T, Z, M> {
    type Output = Self;

    fn sub(self, rhs: Self) -> Self {
        coord! {
            x: self.x - rhs.x,
            y: self.y - rhs.y,
            z: self.z - rhs.z,
            m: self.m - rhs.m,
        }
    }
}
```

## Variant algorithm implementations
Function implementations can keep just the original 2D `<T>` variant, or add support for 3D `<Z>` and/or the Measure `<M>`. The above example works for all combinations of objects. This function only works for 2D objects with and without the Measure.

```rust
impl<T: CoordNum, M: Measure> Line<T, NoValue, M> {
    /// Calculate the slope (Δy/Δx).
    pub fn slope(&self) -> T {
        self.dy() / self.dx()
    }
}
```

## Breaking changes
* It is no longer possible to create Coordinate with just `x` and `y` values using implicit tuple constructor. Use `coord!` instead.
nyurik added a commit to nyurik/geo that referenced this pull request Apr 21, 2022
This PR includes georust#772 and georust#812

---

This PR focuses on `geo-types` only. This is a part of georust#742.

This PR changes the underlying geo-type data structures to support 3D data and measurement values (M and Z values). The PR attempts to cause relatively minor disruptions to the existing users (see breaking changes below). My knowledge of the actual geo algorithms is limited, so please ping me for any specific algo change.

## geo-types restructuring
All geo type structs have been renamed from `Foo<T>(...)` to `Foo<T, Z=NoValue, M=NoValue>(...)`, and several type aliases were added:

```rust
// old
pub struct LineString<T: CoordNum>(pub Vec<Coordinate<T>>);

// new
pub struct LineString<T: CoordNum, Z: ZCoord=NoValue, M: Measure=NoValue>(pub Vec<Coordinate<T, Z, M>>);

pub type LineStringM<T, M=T> = LineString<T, NoValue, M>;
pub type LineString3D<T> = LineString<T, T, NoValue>;
pub type LineString3DM<T, M=T> = LineString<T, T, M>;
```

## NoValue magic
`NoValue` is an empty struct that behaves just like a number. It supports all math and comparison operations. This means that a `Z` or `M` value can be manipulated without checking if it is actually there.  This code works for Z and M being either a number or a NoValue:

```rust
pub struct NoValue;

impl<T: CoordNum, Z: ZCoord, M: Measure> Sub for Coordinate<T, Z, M> {
    type Output = Self;

    fn sub(self, rhs: Self) -> Self {
        coord! {
            x: self.x - rhs.x,
            y: self.y - rhs.y,
            z: self.z - rhs.z,
            m: self.m - rhs.m,
        }
    }
}
```

## Variant algorithm implementations
Function implementations can keep just the original 2D `<T>` variant, or add support for 3D `<Z>` and/or the Measure `<M>`. The above example works for all combinations of objects. This function only works for 2D objects with and without the Measure.

```rust
impl<T: CoordNum, M: Measure> Line<T, NoValue, M> {
    /// Calculate the slope (Δy/Δx).
    pub fn slope(&self) -> T {
        self.dy() / self.dx()
    }
}
```

## Breaking changes
* It is no longer possible to create Coordinate with just `x` and `y` values using implicit tuple constructor. Use `coord!` instead.
urschrei pushed a commit that referenced this pull request Aug 29, 2022
This PR includes #772

---

This PR focuses on `geo-types` only. This is a part of #742.

This PR changes the underlying geo-type data structures to support 3D data and measurement values (M and Z values). The PR attempts to cause relatively minor disruptions to the existing users (see breaking changes below). My knowledge of the actual geo algorithms is limited, so please ping me for any specific algo change.

All geo type structs have been renamed from `Foo<T>(...)` to `Foo<T, Z=NoValue, M=NoValue>(...)`, and several type aliases were added:

```rust
// old
pub struct LineString<T: CoordNum>(pub Vec<Coordinate<T>>);

// new
pub struct LineString<T: CoordNum, Z: ZCoord=NoValue, M: Measure=NoValue>(pub Vec<Coordinate<T, Z, M>>);

pub type LineStringM<T, M=T> = LineString<T, NoValue, M>;
pub type LineString3D<T> = LineString<T, T, NoValue>;
pub type LineString3DM<T, M=T> = LineString<T, T, M>;
```

`NoValue` is an empty struct that behaves just like a number. It supports all math and comparison operations. This means that a `Z` or `M` value can be manipulated without checking if it is actually there.  This code works for Z and M being either a number or a NoValue:

```rust
pub struct NoValue;

impl<T: CoordNum, Z: ZCoord, M: Measure> Sub for Coordinate<T, Z, M> {
    type Output = Self;

    fn sub(self, rhs: Self) -> Self {
        coord! {
            x: self.x - rhs.x,
            y: self.y - rhs.y,
            z: self.z - rhs.z,
            m: self.m - rhs.m,
        }
    }
}
```

Function implementations can keep just the original 2D `<T>` variant, or add support for 3D `<Z>` and/or the Measure `<M>`. The above example works for all combinations of objects. This function only works for 2D objects with and without the Measure.

```rust
impl<T: CoordNum, M: Measure> Line<T, NoValue, M> {
    /// Calculate the slope (Δy/Δx).
    pub fn slope(&self) -> T {
        self.dy() / self.dx()
    }
}
```

* It is no longer possible to create Coordinate with just `x` and `y` values using implicit tuple constructor. Use `coord!` instead.
urschrei pushed a commit that referenced this pull request Aug 29, 2022
This PR includes #772

---

This PR focuses on `geo-types` only. This is a part of #742.

This PR changes the underlying geo-type data structures to support 3D data and measurement values (M and Z values). The PR attempts to cause relatively minor disruptions to the existing users (see breaking changes below). My knowledge of the actual geo algorithms is limited, so please ping me for any specific algo change.

All geo type structs have been renamed from `Foo<T>(...)` to `Foo<T, Z=NoValue, M=NoValue>(...)`, and several type aliases were added:

```rust
// old
pub struct LineString<T: CoordNum>(pub Vec<Coordinate<T>>);

// new
pub struct LineString<T: CoordNum, Z: ZCoord=NoValue, M: Measure=NoValue>(pub Vec<Coordinate<T, Z, M>>);

pub type LineStringM<T, M=T> = LineString<T, NoValue, M>;
pub type LineString3D<T> = LineString<T, T, NoValue>;
pub type LineString3DM<T, M=T> = LineString<T, T, M>;
```

`NoValue` is an empty struct that behaves just like a number. It supports all math and comparison operations. This means that a `Z` or `M` value can be manipulated without checking if it is actually there.  This code works for Z and M being either a number or a NoValue:

```rust
pub struct NoValue;

impl<T: CoordNum, Z: ZCoord, M: Measure> Sub for Coordinate<T, Z, M> {
    type Output = Self;

    fn sub(self, rhs: Self) -> Self {
        coord! {
            x: self.x - rhs.x,
            y: self.y - rhs.y,
            z: self.z - rhs.z,
            m: self.m - rhs.m,
        }
    }
}
```

Function implementations can keep just the original 2D `<T>` variant, or add support for 3D `<Z>` and/or the Measure `<M>`. The above example works for all combinations of objects. This function only works for 2D objects with and without the Measure.

```rust
impl<T: CoordNum, M: Measure> Line<T, NoValue, M> {
    /// Calculate the slope (Δy/Δx).
    pub fn slope(&self) -> T {
        self.dy() / self.dx()
    }
}
```

* It is no longer possible to create Coordinate with just `x` and `y` values using implicit tuple constructor. Use `coord!` instead.
@frewsxcv
Copy link
Member

Closing for inactivity. Feel free to reopen if you resume work on this.

@frewsxcv frewsxcv closed this Jul 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants