You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
(Sorry if I'm getting annoying with these feature requests)
I needed to do a 'difference' on two polygon features and realized it wasn't implemented. The following is my helper trait to work around it, but in this case, because of private fields, I couldn't just copy the code in union, so I'm unsure if this is safe. (That's related to #306 )
pub(crate)traitGeometryFix:Sized{fndifference(&self,other:&Self) -> Option<Self>;}implGeometryFixforGeometry{fndifference(&self,other:&Self) -> Option<Self>{if !self.has_gdal_ptr(){returnNone;}if !other.has_gdal_ptr(){returnNone;}unsafe{let ogr_geom = gdal_sys::OGR_G_Difference(self.c_geometry(), other.c_geometry());if ogr_geom.is_null(){returnNone;}// TODO: Unfortunately, with_c_geometry is private, so I can't use it.let geometry = Self::lazy_feature_geometry();
geometry.set_c_geometry(ogr_geom);// TODO: DANGER!: I can't set owned = true on the thing, there's no way.// However, I *think* cloning will take care of that. Because the original// value won't dereference the API handle, as it's not owned, but clone// will set it to owned.Some(geometry.clone())}}}
The text was updated successfully, but these errors were encountered:
(Sorry if I'm getting annoying with these feature requests)
I needed to do a 'difference' on two polygon features and realized it wasn't implemented. The following is my helper trait to work around it, but in this case, because of private fields, I couldn't just copy the code in
union
, so I'm unsure if this is safe. (That's related to #306 )The text was updated successfully, but these errors were encountered: