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

Deprecate, don't remove, intersects_bbox #204

Merged
merged 2 commits into from
Oct 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 4 additions & 3 deletions RELEASING.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
4. Update the package's `Cargo.toml` file accordingly, and update the other packages' `Cargo.toml` if they depend on this package.
5. Scan the package's README for references to version numbers, and update any that are needed.
6. Update the package's CHANGELOG with a new section for the new version. Don't forget to update the links at the bottom, too.
7. Test the release with `cargo release -p {package name}`. By default, this does a dry-run, so it won't actually do anything.
8. Use the normal pull request workflow to merge your branch.
9. Once merged, run `cargo release --execute` to do the release. Use the same `-p` flags as you did during the dry run.
7. If it's a breaking release, search for any deprecated functions that should be removed.
8. Test the release with `cargo release -p {package name}`. By default, this does a dry-run, so it won't actually do anything.
9. Use the normal pull request workflow to merge your branch.
10. Once merged, run `cargo release --execute` to do the release. Use the same `-p` flags as you did during the dry run.

## After-the-fact releases

Expand Down
4 changes: 2 additions & 2 deletions stac/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
- `Item.intersects` ([#202](https://github.com/stac-utils/stac-rs/pull/202))
- Common metadata fields ([#203](https://github.com/stac-utils/stac-rs/pull/203))

### Removed
### Deprecated

- `Item.intersects_bbox` ([#202](https://github.com/stac-utils/stac-rs/pull/202))
- `Item.intersects_bbox` ([#204](https://github.com/stac-utils/stac-rs/pull/204))

## [0.5.1] - 2023-09-14

Expand Down
28 changes: 28 additions & 0 deletions stac/src/item.rs
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,34 @@ impl Item {
}
}

/// Returns true if this item's geometry intersects the provided bounding box.
///
/// DEPRECATED Use `intersects` instead.
///
/// # Examples
///
/// ```
/// use stac::Item;
/// use geojson::{Geometry, Value};
///
/// let mut item = Item::new("an-id");
/// item.set_geometry(Some(Geometry::new(Value::Point(vec![-105.1, 41.1]))));
/// let bbox = stac::geo::bbox(&vec![-106.0, 41.0, -105.0, 42.0]).unwrap();
/// assert!(item.intersects_bbox(bbox).unwrap());
/// ```
#[cfg(feature = "geo")]
#[deprecated(since = "0.5.2", note = "Use intersects instead")]
pub fn intersects_bbox(&self, bbox: geo::Rect) -> Result<bool> {
use geo::Intersects;

if let Some(geometry) = self.geometry.clone() {
let geometry: geo::Geometry = geometry.try_into()?;
Ok(geometry.intersects(&bbox))
} else {
Ok(false)
}
}

/// Returns true if this item's datetime (or start and end datetimes)
/// intersects the provided datetime.
///
Expand Down