35 lines
952 B
Rust
35 lines
952 B
Rust
use geo::{LineString, MultiLineString, MultiPolygon};
|
|
|
|
pub trait MergeExt {
|
|
/// merge Container object
|
|
fn merge(&mut self, other: &Self);
|
|
/// merge container object, empty the other object
|
|
fn merge_destructive(&mut self, other: &mut Self);
|
|
}
|
|
|
|
impl MergeExt for LineString<f64> {
|
|
fn merge(&mut self, other: &Self) {
|
|
self.0.append(&mut other.0.clone());
|
|
}
|
|
fn merge_destructive(&mut self, other: &mut Self) {
|
|
self.0.append(&mut other.0);
|
|
}
|
|
}
|
|
|
|
impl MergeExt for MultiLineString<f64> {
|
|
fn merge(&mut self, other: &Self) {
|
|
self.0.append(&mut other.0.clone());
|
|
}
|
|
fn merge_destructive(&mut self, other: &mut Self) {
|
|
self.0.append(&mut other.0);
|
|
}
|
|
}
|
|
|
|
impl MergeExt for MultiPolygon<f64> {
|
|
fn merge(&mut self, other: &Self) {
|
|
self.0.append(&mut other.0.clone());
|
|
}
|
|
fn merge_destructive(&mut self, other: &mut Self) {
|
|
self.0.append(&mut other.0);
|
|
}
|
|
}
|