Struct sfcgal::SFCGeometry
source · #[repr(C)]pub struct SFCGeometry { /* private fields */ }
Expand description
Object representing a SFCGAL Geometry.
Implementations§
source§impl SFCGeometry
impl SFCGeometry
pub fn new_from_coordinates<T>(coords: &CoordSeq<T>) -> Result<SFCGeometry>where
T: ToSFCGALGeom + CoordType,
sourcepub fn to_wkt(&self) -> Result<String>
pub fn to_wkt(&self) -> Result<String>
Returns a WKT representation of the given SFCGeometry
using CGAL
exact integer fractions as coordinate values.
sourcepub fn to_wkt_decim(&self, nb_decim: i32) -> Result<String>
pub fn to_wkt_decim(&self, nb_decim: i32) -> Result<String>
Returns a WKT representation of the given SFCGeometry
using
floating point coordinate values with the desired number of
decimals.
sourcepub fn to_wkb_in_memory(&self) -> Result<Vec<u8>>
pub fn to_wkb_in_memory(&self) -> Result<Vec<u8>>
Creates a Wkb string of the given geometry. In memory version.
sourcepub unsafe fn to_ewkt_in_memory(
prepared: *const sfcgal_prepared_geometry_t,
num_decimals: i32,
) -> Result<Vec<u8>>
pub unsafe fn to_ewkt_in_memory( prepared: *const sfcgal_prepared_geometry_t, num_decimals: i32, ) -> Result<Vec<u8>>
§Safety
Returns an EWKT representation of the given PreparedGeometry
sourcepub fn to_hexwkb_in_memory(&self) -> Result<Vec<u8>>
pub fn to_hexwkb_in_memory(&self) -> Result<Vec<u8>>
Creates a Hexwkb string of the given geometry. In memory version.
sourcepub fn io_read_binary_prepared(
data: &[u8],
) -> Result<*mut sfcgal_prepared_geometry_t>
pub fn io_read_binary_prepared( data: &[u8], ) -> Result<*mut sfcgal_prepared_geometry_t>
Read the binary prepared geometry
sourcepub fn io_read_wkb(data: &[u8]) -> Result<*mut sfcgal_prepared_geometry_t>
pub fn io_read_wkb(data: &[u8]) -> Result<*mut sfcgal_prepared_geometry_t>
Read the binary prepared geometry
sourcepub fn io_read_ewkt(data: &[u8]) -> Result<*mut sfcgal_prepared_geometry_t>
pub fn io_read_ewkt(data: &[u8]) -> Result<*mut sfcgal_prepared_geometry_t>
Read the binary prepared geometry
sourcepub unsafe fn io_write_binary_prepared(
prepared_geometry: *mut sfcgal_prepared_geometry_t,
) -> Result<Vec<u8>>
pub unsafe fn io_write_binary_prepared( prepared_geometry: *mut sfcgal_prepared_geometry_t, ) -> Result<Vec<u8>>
§Safety
Read the binary prepared geometry in memory
sourcepub fn to_obj_file(&self, filename: &str) -> Result<()>
pub fn to_obj_file(&self, filename: &str) -> Result<()>
Creates a OBJ file of the given geometry
sourcepub fn to_obj_in_memory(&self) -> Result<Vec<u8>>
pub fn to_obj_in_memory(&self) -> Result<Vec<u8>>
Creates a OBJ string of the given geometry. In memory version.
sourcepub fn to_vtk_file(&self, filename: &str) -> Result<()>
pub fn to_vtk_file(&self, filename: &str) -> Result<()>
Creates a VTK file of the given geometry
sourcepub fn to_vtk_in_memory(&self) -> Result<Vec<u8>>
pub fn to_vtk_in_memory(&self) -> Result<Vec<u8>>
Creates a VTK string of the given geometry. In memory version.
sourcepub fn is_measured(&self) -> Result<bool>
pub fn is_measured(&self) -> Result<bool>
Test if the given SFCGeometry
is measured (has an ‘m’ coordinates)
sourcepub fn validity_detail(&self) -> Result<Option<String>>
pub fn validity_detail(&self) -> Result<Option<String>>
Returns reason for the invalidity or None in case of validity.
sourcepub fn distance(&self, other: &SFCGeometry) -> Result<f64>
pub fn distance(&self, other: &SFCGeometry) -> Result<f64>
Computes the distance to an other SFCGeometry
.
sourcepub fn distance_3d(&self, other: &SFCGeometry) -> Result<f64>
pub fn distance_3d(&self, other: &SFCGeometry) -> Result<f64>
Computes the 3d distance to an other SFCGeometry
.
sourcepub fn volume(&self) -> Result<f64>
pub fn volume(&self) -> Result<f64>
Computes the volume of the given SFCGeometry
(must be a volume).
sourcepub fn orientation(&self) -> Result<Orientation>
pub fn orientation(&self) -> Result<Orientation>
Computes the orientation of the given SFCGeometry
(must be a
Polygon)
sourcepub fn intersects(&self, other: &SFCGeometry) -> Result<bool>
pub fn intersects(&self, other: &SFCGeometry) -> Result<bool>
Test the intersection with an other SFCGeometry
.
sourcepub fn intersects_3d(&self, other: &SFCGeometry) -> Result<bool>
pub fn intersects_3d(&self, other: &SFCGeometry) -> Result<bool>
Test the 3d intersection with an other SFCGeometry
.
sourcepub fn intersection(&self, other: &SFCGeometry) -> Result<SFCGeometry>
pub fn intersection(&self, other: &SFCGeometry) -> Result<SFCGeometry>
Returns the intersection of the given SFCGeometry
to an other
SFCGeometry
.
sourcepub fn intersection_3d(&self, other: &SFCGeometry) -> Result<SFCGeometry>
pub fn intersection_3d(&self, other: &SFCGeometry) -> Result<SFCGeometry>
Returns the 3d intersection of the given SFCGeometry
to an other
SFCGeometry
.
sourcepub fn covers(&self, other: &SFCGeometry) -> Result<bool>
pub fn covers(&self, other: &SFCGeometry) -> Result<bool>
Test if the geometry covers an other SFCGeometry
.
sourcepub fn covers_3d(&self, other: &SFCGeometry) -> Result<bool>
pub fn covers_3d(&self, other: &SFCGeometry) -> Result<bool>
Test if the geometry covers an other SFCGeometry
in 3D.
sourcepub fn difference(&self, other: &SFCGeometry) -> Result<SFCGeometry>
pub fn difference(&self, other: &SFCGeometry) -> Result<SFCGeometry>
Returns the difference of the given SFCGeometry
to an other
SFCGeometry
.
sourcepub fn difference_3d(&self, other: &SFCGeometry) -> Result<SFCGeometry>
pub fn difference_3d(&self, other: &SFCGeometry) -> Result<SFCGeometry>
Returns the 3d difference of the given SFCGeometry
to an other
SFCGeometry
.
sourcepub fn union(&self, other: &SFCGeometry) -> Result<SFCGeometry>
pub fn union(&self, other: &SFCGeometry) -> Result<SFCGeometry>
Returns the union of the given SFCGeometry
to an other
SFCGeometry
.
sourcepub fn union_3d(&self, other: &SFCGeometry) -> Result<SFCGeometry>
pub fn union_3d(&self, other: &SFCGeometry) -> Result<SFCGeometry>
Returns the 3d union of the given SFCGeometry
to an other
SFCGeometry
.
sourcepub fn minkowski_sum(&self, other: &SFCGeometry) -> Result<SFCGeometry>
pub fn minkowski_sum(&self, other: &SFCGeometry) -> Result<SFCGeometry>
Returns the minkowski sum of the given SFCGeometry
and an other
SFCGEOMETRY
.
sourcepub fn straight_skeleton(&self) -> Result<SFCGeometry>
pub fn straight_skeleton(&self) -> Result<SFCGeometry>
Returns the straight skeleton of the given SFCGeometry
.
sourcepub fn straight_skeleton_distance_in_m(&self) -> Result<SFCGeometry>
pub fn straight_skeleton_distance_in_m(&self) -> Result<SFCGeometry>
Returns the straight skeleton of the given SFCGeometry
with the
distance to the border as M coordinate.
sourcepub fn extrude_straight_skeleton(&self, height: f64) -> Result<SFCGeometry>
pub fn extrude_straight_skeleton(&self, height: f64) -> Result<SFCGeometry>
Returns the extrude straight skeleton of the given Polygon.
sourcepub fn extrude_polygon_straight_skeleton(
&self,
building_height: f64,
roof_height: f64,
) -> Result<SFCGeometry>
pub fn extrude_polygon_straight_skeleton( &self, building_height: f64, roof_height: f64, ) -> Result<SFCGeometry>
Returns the union of the polygon z-extrusion (with respect to building_height) and the extrude straight skeleton (with respect to roof_height) of the given Polygon.
sourcepub fn approximate_medial_axis(&self) -> Result<SFCGeometry>
pub fn approximate_medial_axis(&self) -> Result<SFCGeometry>
Returns the approximate medial axis for the given SFCGeometry
Polygon.
sourcepub fn offset_polygon(&self, radius: f64) -> Result<SFCGeometry>
pub fn offset_polygon(&self, radius: f64) -> Result<SFCGeometry>
Returns the offset polygon of the given SFCGeometry
.
sourcepub fn extrude(&self, ex: f64, ey: f64, ez: f64) -> Result<SFCGeometry>
pub fn extrude(&self, ex: f64, ey: f64, ez: f64) -> Result<SFCGeometry>
Returns the extrusion of the given SFCGeometry
(not supported on
Solid and Multisolid).
sourcepub fn tesselate(&self) -> Result<SFCGeometry>
pub fn tesselate(&self) -> Result<SFCGeometry>
Returns a tesselation of the given SFCGeometry
.
sourcepub fn triangulate_2dz(&self) -> Result<SFCGeometry>
pub fn triangulate_2dz(&self) -> Result<SFCGeometry>
Returns a triangulation of the given SFCGeometry
.
sourcepub fn convexhull(&self) -> Result<SFCGeometry>
pub fn convexhull(&self) -> Result<SFCGeometry>
Returns the convex hull of the given SFCGeometry
.
sourcepub fn convexhull_3d(&self) -> Result<SFCGeometry>
pub fn convexhull_3d(&self) -> Result<SFCGeometry>
Returns the 3d convex hull of the given SFCGeometry
.
sourcepub fn line_substring(&self, start: f64, end: f64) -> Result<SFCGeometry>
pub fn line_substring(&self, start: f64, end: f64) -> Result<SFCGeometry>
Returns the substring of the given SFCGeometry
LineString between
fractional distances.
sourcepub fn alpha_shapes(&self, alpha: f64, allow_holes: bool) -> Result<SFCGeometry>
pub fn alpha_shapes(&self, alpha: f64, allow_holes: bool) -> Result<SFCGeometry>
Returns the alpha shape of the given SFCGeometry
Point set.
sourcepub fn optimal_alpha_shapes(
&self,
allow_holes: bool,
nb_components: usize,
) -> Result<SFCGeometry>
pub fn optimal_alpha_shapes( &self, allow_holes: bool, nb_components: usize, ) -> Result<SFCGeometry>
Return the optimal alpha shape of the given SFCGeometry
Point set.
sourcepub fn create_collection(geoms: &mut [SFCGeometry]) -> Result<SFCGeometry>
pub fn create_collection(geoms: &mut [SFCGeometry]) -> Result<SFCGeometry>
Create a SFCGeometry collection type (MultiPoint, MultiLineString,
MultiPolygon, MultiSolid or GeometryCollection) given a
mutable slice of SFCGeometry
’s (this is a destructive
operation).
use sfcgal::SFCGeometry;
let a = SFCGeometry::new("POINT (1.0 1.0)").unwrap();
let b = SFCGeometry::new("POINT (2.0 2.0)").unwrap();
let g = SFCGeometry::create_collection(&mut[a, b]).unwrap();
assert_eq!(
g.to_wkt_decim(1).unwrap(),
"MULTIPOINT ((1.0 1.0),(2.0 2.0))",
);
sourcepub fn get_collection_members(self) -> Result<Vec<SFCGeometry>>
pub fn get_collection_members(self) -> Result<Vec<SFCGeometry>>
Get the members of a SFCGeometry. Returns Err if the SFCGeometry if not a collection (i.e. if it’s type is not in { MultiPoint, MultiLineString, MultiPolygon, MultiSolid, GeometryCollection }). The original geometry stay untouched.
use sfcgal::SFCGeometry;
let g = SFCGeometry::new("MULTIPOINT ((1.0 1.0),(2.0
2.0))").unwrap(); let members =
g.get_collection_members().unwrap(); assert_eq!(
members[0].to_wkt_decim(1).unwrap(),
"POINT (1.0 1.0)",
);
assert_eq!(
members[1].to_wkt_decim(1).unwrap(),
"POINT (2.0 2.0)",
);
sourcepub fn point_create() -> Result<SFCGeometry>
pub fn point_create() -> Result<SFCGeometry>
Creates an empty point
sourcepub fn point_create_from_xy(x: f64, y: f64) -> Result<SFCGeometry>
pub fn point_create_from_xy(x: f64, y: f64) -> Result<SFCGeometry>
Creates a point from two X and Y coordinates
sourcepub fn point_create_from_xym(x: f64, y: f64, m: f64) -> Result<SFCGeometry>
pub fn point_create_from_xym(x: f64, y: f64, m: f64) -> Result<SFCGeometry>
Creates a point from three X, Y and M coordinates
sourcepub fn point_create_from_xyz(x: f64, y: f64, z: f64) -> Result<SFCGeometry>
pub fn point_create_from_xyz(x: f64, y: f64, z: f64) -> Result<SFCGeometry>
Creates a point from three X, Y and Z coordinates
sourcepub fn point_create_from_xyzm(
&self,
x: f64,
y: f64,
z: f64,
m: f64,
) -> Result<SFCGeometry>
pub fn point_create_from_xyzm( &self, x: f64, y: f64, z: f64, m: f64, ) -> Result<SFCGeometry>
Create a point from x, y, z, m components.
sourcepub fn triangle_set_vertex(
&self,
index: i32,
vertex: &SFCGeometry,
) -> Result<()>
pub fn triangle_set_vertex( &self, index: i32, vertex: &SFCGeometry, ) -> Result<()>
Sets one vertex of a Triangle
sourcepub fn triangle_set_vertex_from_xy(
&self,
index: i32,
x: f64,
y: f64,
) -> Result<()>
pub fn triangle_set_vertex_from_xy( &self, index: i32, x: f64, y: f64, ) -> Result<()>
Sets one vertex of a Triangle from two coordinates
sourcepub fn triangle_set_vertex_from_xyz(
&self,
index: i32,
x: f64,
y: f64,
z: f64,
) -> Result<()>
pub fn triangle_set_vertex_from_xyz( &self, index: i32, x: f64, y: f64, z: f64, ) -> Result<()>
Sets one vertex of a Triangle from three coordinates
sourcepub fn straight_skeleton_partition(
&self,
auto_orientation: bool,
) -> Result<SFCGeometry>
pub fn straight_skeleton_partition( &self, auto_orientation: bool, ) -> Result<SFCGeometry>
Returns the straight skeleton partition for the given Polygon
sourcepub fn visibility_point(&self, point: &SFCGeometry) -> Result<SFCGeometry>
pub fn visibility_point(&self, point: &SFCGeometry) -> Result<SFCGeometry>
Returns the visibility polygon of a Point inside a Polygon
sourcepub fn rotate(&self, angle: f64) -> Result<SFCGeometry>
pub fn rotate(&self, angle: f64) -> Result<SFCGeometry>
Rotates a geometry around the origin (0,0,0) by a given angle
sourcepub fn rotate_x(&self, angle: f64) -> Result<SFCGeometry>
pub fn rotate_x(&self, angle: f64) -> Result<SFCGeometry>
Rotates a geometry around the X axis by a given angle
sourcepub fn rotate_y(&self, angle: f64) -> Result<SFCGeometry>
pub fn rotate_y(&self, angle: f64) -> Result<SFCGeometry>
Rotates a geometry around the Y axis by a given angle
sourcepub fn rotate_z(&self, angle: f64) -> Result<SFCGeometry>
pub fn rotate_z(&self, angle: f64) -> Result<SFCGeometry>
Rotates a geometry around the Z axis by a given angle
sourcepub fn rotate_2d(
&self,
angle: f64,
origin_x: f64,
origin_y: f64,
) -> Result<SFCGeometry>
pub fn rotate_2d( &self, angle: f64, origin_x: f64, origin_y: f64, ) -> Result<SFCGeometry>
Rotates a geometry around a specified point by a given angle
sourcepub fn rotate_3d(
&self,
angle: f64,
axis_x_angle: f64,
axis_y_angle: f64,
axis_z_angle: f64,
) -> Result<SFCGeometry>
pub fn rotate_3d( &self, angle: f64, axis_x_angle: f64, axis_y_angle: f64, axis_z_angle: f64, ) -> Result<SFCGeometry>
Rotates a 3D geometry around a specified axis by a given angle
sourcepub fn rotate_3d_around_center(
&self,
angle: f64,
axis_x_angle: f64,
axis_y_angle: f64,
axis_z_angle: f64,
center_x: f64,
center_y: f64,
center_z: f64,
) -> Result<SFCGeometry>
pub fn rotate_3d_around_center( &self, angle: f64, axis_x_angle: f64, axis_y_angle: f64, axis_z_angle: f64, center_x: f64, center_y: f64, center_z: f64, ) -> Result<SFCGeometry>
Rotates a 3D geometry around a specified axis and center point by a given
sourcepub fn force_rhr(&self) -> Result<SFCGeometry>
pub fn force_rhr(&self) -> Result<SFCGeometry>
Force a Right Handed Rule on the given Geometry
sourcepub fn force_lhr(&self) -> Result<SFCGeometry>
pub fn force_lhr(&self) -> Result<SFCGeometry>
Force a Left Handed Rule on the given Geometry
sourcepub fn scale(&self, scale: f64) -> Result<SFCGeometry>
pub fn scale(&self, scale: f64) -> Result<SFCGeometry>
Scale a geometry by a given factor
sourcepub fn scale_3d(
&self,
scale_x: f64,
scale_y: f64,
scale_z: f64,
) -> Result<SFCGeometry>
pub fn scale_3d( &self, scale_x: f64, scale_y: f64, scale_z: f64, ) -> Result<SFCGeometry>
Scale a geometry by different factors for each dimension
sourcepub fn scale_3d_around_center(
&self,
factor_x: f64,
factor_y: f64,
factor_z: f64,
center_x: f64,
center_y: f64,
center_z: f64,
) -> Result<SFCGeometry>
pub fn scale_3d_around_center( &self, factor_x: f64, factor_y: f64, factor_z: f64, center_x: f64, center_y: f64, center_z: f64, ) -> Result<SFCGeometry>
Scale a geometry by different factors for each dimension around a center
sourcepub fn round(&self, value: i32) -> Result<SFCGeometry>
pub fn round(&self, value: i32) -> Result<SFCGeometry>
Round coordinates of the given Geometry
sourcepub fn buffer3d(
&self,
radius: f64,
segments: i32,
buffer_type: BufferType,
) -> Result<SFCGeometry>
pub fn buffer3d( &self, radius: f64, segments: i32, buffer_type: BufferType, ) -> Result<SFCGeometry>
Computes a 3D buffer around a geometry
sourcepub fn has_validity_flag(&self) -> i32
pub fn has_validity_flag(&self) -> i32
Gets the validity flag of the geometry
sourcepub fn visibility_segment(
&self,
point_a: &SFCGeometry,
point_b: &SFCGeometry,
) -> Result<SFCGeometry>
pub fn visibility_segment( &self, point_a: &SFCGeometry, point_b: &SFCGeometry, ) -> Result<SFCGeometry>
Build the visibility polygon of the segment [pointA ; pointB] on a Polygon
sourcepub fn make_solid(&self) -> Result<SFCGeometry>
pub fn make_solid(&self) -> Result<SFCGeometry>
Convert a PolyhedralSurface to a Solid
sourcepub fn translate_2d(&self, dx: f64, dy: f64) -> Result<SFCGeometry>
pub fn translate_2d(&self, dx: f64, dy: f64) -> Result<SFCGeometry>
Translate a geometry by a 2D vector
sourcepub fn translate_3d(
&self,
translation_x: f64,
translation_y: f64,
translation_z: f64,
) -> Result<SFCGeometry>
pub fn translate_3d( &self, translation_x: f64, translation_y: f64, translation_z: f64, ) -> Result<SFCGeometry>
Translate a geometry by a 3D vector
sourcepub fn force_valid(&self, validity: i32)
pub fn force_valid(&self, validity: i32)
Sets the validity flag of the geometry.
sourcepub fn set_geometry_validation(enabled: i32)
pub fn set_geometry_validation(enabled: i32)
Set the geometry validation mode
sourcepub fn triangle_create() -> Result<SFCGeometry>
pub fn triangle_create() -> Result<SFCGeometry>
Creates an empty Triangle
sourcepub fn triangle_vertex(&self, index: i32) -> Result<SFCGeometry>
pub fn triangle_vertex(&self, index: i32) -> Result<SFCGeometry>
Returns one the Triangle’s vertex as a Point
sourcepub fn triangle_create_from_points(
point_a: &SFCGeometry,
point_b: &SFCGeometry,
point_c: &SFCGeometry,
) -> Result<SFCGeometry>
pub fn triangle_create_from_points( point_a: &SFCGeometry, point_b: &SFCGeometry, point_c: &SFCGeometry, ) -> Result<SFCGeometry>
Creates a Triangle from three given Point
sourcepub fn triangulated_surface_create() -> Result<SFCGeometry>
pub fn triangulated_surface_create() -> Result<SFCGeometry>
Creates an empty TriangulatedSurface
sourcepub fn triangulated_surface_triangle_n(
&self,
index: usize,
) -> Result<SFCGeometry>
pub fn triangulated_surface_triangle_n( &self, index: usize, ) -> Result<SFCGeometry>
Returns the ith Triangle of a given TriangulatedSurface
sourcepub fn triangulated_surface_add_triangle(
&self,
triangle: &SFCGeometry,
) -> Result<()>
pub fn triangulated_surface_add_triangle( &self, triangle: &SFCGeometry, ) -> Result<()>
Adds a Triangle to a given TriangulatedSurface
sourcepub fn triangulated_surface_num_triangles(&self) -> Result<usize>
pub fn triangulated_surface_num_triangles(&self) -> Result<usize>
Returns the number of triangles of a given TriangulatedSurface
sourcepub fn optimal_convex_partition_2(&self) -> Result<SFCGeometry>
pub fn optimal_convex_partition_2(&self) -> Result<SFCGeometry>
Returns the optimal convex partition of a geometry (polygon without hole)
sourcepub fn approx_convex_partition_2(&self) -> Result<SFCGeometry>
pub fn approx_convex_partition_2(&self) -> Result<SFCGeometry>
Returns the approximal convex partition of a geometry (polygon without hole)
sourcepub fn greene_approx_convex_partition_2(&self) -> Result<SFCGeometry>
pub fn greene_approx_convex_partition_2(&self) -> Result<SFCGeometry>
Returns the greene approximal convex partition of a geometry (polygon without hole)
sourcepub fn y_monotone_partition_2(&self) -> Result<SFCGeometry>
pub fn y_monotone_partition_2(&self) -> Result<SFCGeometry>
Returns the y monotone partition of a geometry (polygon without hole)
sourcepub fn linestring_num_points(&self) -> Result<usize>
pub fn linestring_num_points(&self) -> Result<usize>
Returns the number of points of the given LineString
sourcepub fn linestring_add_point(&self, point: &SFCGeometry) -> Result<()>
pub fn linestring_add_point(&self, point: &SFCGeometry) -> Result<()>
Adds a point to a LineString
sourcepub fn linestring_point_n(&self, index: usize) -> Result<SFCGeometry>
pub fn linestring_point_n(&self, index: usize) -> Result<SFCGeometry>
Returns the ith point of a given LineString
sourcepub fn linestring_create() -> Result<SFCGeometry>
pub fn linestring_create() -> Result<SFCGeometry>
Creates an empty LineString
sourcepub fn polyhedral_surface_create() -> Result<SFCGeometry>
pub fn polyhedral_surface_create() -> Result<SFCGeometry>
Creates an empty PolyhedralSurface
sourcepub fn polyhedral_surface_num_polygons(&self) -> Result<usize>
pub fn polyhedral_surface_num_polygons(&self) -> Result<usize>
Returns the number of polygons of a given PolyhedralSurface
sourcepub fn polyhedral_surface_add_polygon(&self, other: &SFCGeometry) -> Result<()>
pub fn polyhedral_surface_add_polygon(&self, other: &SFCGeometry) -> Result<()>
Adds a Polygon to a given PolyhedralSurface
sourcepub fn polyhedral_surface_polygon_n(&self, index: usize) -> Result<SFCGeometry>
pub fn polyhedral_surface_polygon_n(&self, index: usize) -> Result<SFCGeometry>
Returns the ith polygon of a given PolyhedralSurface
sourcepub fn set_error_handlers(
warning_handler: sfcgal_error_handler_t,
error_handler: sfcgal_error_handler_t,
)
pub fn set_error_handlers( warning_handler: sfcgal_error_handler_t, error_handler: sfcgal_error_handler_t, )
Sets the error handlers. These callbacks are called on warning or error
sourcepub fn set_alloc_handlers(
alloc_handler: sfcgal_alloc_handler_t,
free_handler: sfcgal_free_handler_t,
)
pub fn set_alloc_handlers( alloc_handler: sfcgal_alloc_handler_t, free_handler: sfcgal_free_handler_t, )
Sets the error handlers. These callbacks are called on warning or error
sourcepub fn solid_create() -> Result<SFCGeometry>
pub fn solid_create() -> Result<SFCGeometry>
Creates an empty Solid
sourcepub fn solid_num_shells(&self) -> Result<usize>
pub fn solid_num_shells(&self) -> Result<usize>
Returns the number of shells of a given Solid
sourcepub fn solid_create_from_exterior_shell(
exterior_shell: &SFCGeometry,
) -> Result<SFCGeometry>
pub fn solid_create_from_exterior_shell( exterior_shell: &SFCGeometry, ) -> Result<SFCGeometry>
Creates a Solid from an exterior shell
sourcepub fn solid_shell_n(&self, index: usize) -> Result<SFCGeometry>
pub fn solid_shell_n(&self, index: usize) -> Result<SFCGeometry>
Returns the ith shell of a given Solid
sourcepub fn solid_add_interior_shell(&self, shell: &SFCGeometry) -> Result<()>
pub fn solid_add_interior_shell(&self, shell: &SFCGeometry) -> Result<()>
Adds a shell to a given Solid
sourcepub fn polygon_create() -> Result<SFCGeometry>
pub fn polygon_create() -> Result<SFCGeometry>
Creates an empty Polygon
sourcepub fn polygon_num_interior_rings(&self) -> Result<usize>
pub fn polygon_num_interior_rings(&self) -> Result<usize>
Returns the number of interior rings of a given Polygon
sourcepub fn polygon_exterior_ring(&self) -> Result<SFCGeometry>
pub fn polygon_exterior_ring(&self) -> Result<SFCGeometry>
Returns the exterior ring of a given Polygon
sourcepub fn polygon_create_from_exterior_ring(&self) -> Result<SFCGeometry>
pub fn polygon_create_from_exterior_ring(&self) -> Result<SFCGeometry>
Creates an empty Polygon from an extrior ring
sourcepub fn polygon_add_interior_ring(&self, ring: &SFCGeometry) -> Result<()>
pub fn polygon_add_interior_ring(&self, ring: &SFCGeometry) -> Result<()>
Adds an interior ring to a given Polygon
sourcepub fn polygon_interior_ring_n(&self, index: usize) -> Result<SFCGeometry>
pub fn polygon_interior_ring_n(&self, index: usize) -> Result<SFCGeometry>
Returns the ith interior ring of a given Polygon
sourcepub fn multi_solid_create() -> Result<SFCGeometry>
pub fn multi_solid_create() -> Result<SFCGeometry>
Creates an empty MultiSolid
sourcepub unsafe fn prepared_geometry_set_srid(
prepared_geometry: *mut sfcgal_prepared_geometry_t,
srid: srid_t,
)
pub unsafe fn prepared_geometry_set_srid( prepared_geometry: *mut sfcgal_prepared_geometry_t, srid: srid_t, )
§Safety
Sets SRID associated with a given PreparedGeometry
sourcepub unsafe fn prepared_geometry_delete(
prepared_geometry: *mut sfcgal_prepared_geometry_t,
)
pub unsafe fn prepared_geometry_delete( prepared_geometry: *mut sfcgal_prepared_geometry_t, )
§Safety
Deletes a given PreparedGeometry
sourcepub fn prepared_geometry_create_from_geometry(
&self,
srid: srid_t,
) -> Result<*mut sfcgal_prepared_geometry_t>
pub fn prepared_geometry_create_from_geometry( &self, srid: srid_t, ) -> Result<*mut sfcgal_prepared_geometry_t>
§Safety
Creates a PreparedGeometry from a Geometry and an SRID
sourcepub unsafe fn prepared_geometry_set_geometry(
&self,
prepared: *mut sfcgal_prepared_geometry_t,
)
pub unsafe fn prepared_geometry_set_geometry( &self, prepared: *mut sfcgal_prepared_geometry_t, )
§Safety
Sets the Geometry associated with the given PreparedGeometry
sourcepub unsafe fn prepared_geometry_srid(
prepared: *mut sfcgal_prepared_geometry_t,
) -> u32
pub unsafe fn prepared_geometry_srid( prepared: *mut sfcgal_prepared_geometry_t, ) -> u32
§Safety
Returns SRID associated with a given PreparedGeometry
sourcepub fn prepared_geometry_create() -> Result<*mut sfcgal_prepared_geometry_t>
pub fn prepared_geometry_create() -> Result<*mut sfcgal_prepared_geometry_t>
Creates an empty PreparedGeometry
sourcepub unsafe fn prepared_geometry_geometry(
prepared_geometry: *mut sfcgal_prepared_geometry_t,
) -> Result<SFCGeometry>
pub unsafe fn prepared_geometry_geometry( prepared_geometry: *mut sfcgal_prepared_geometry_t, ) -> Result<SFCGeometry>
§Safety
Returns the Geometry associated with a given PreparedGeometry
Trait Implementations§
source§impl Clone for SFCGeometry
impl Clone for SFCGeometry
source§fn clone(&self) -> SFCGeometry
fn clone(&self) -> SFCGeometry
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for SFCGeometry
impl Debug for SFCGeometry
source§impl Drop for SFCGeometry
impl Drop for SFCGeometry
source§impl FromGeoJSON for SFCGeometry
impl FromGeoJSON for SFCGeometry
Conversion from GeoJson to SFCGAL geometries.
Allows to choose if the constructed SFCGAL geometries will be 2d or 3d.
use sfcgal::{SFCGeometry, FromGeoJSON};
type Point2d = (f64, f64);
let geom = geojson::Geometry {
bbox: None,
value: geojson::Value::LineString(vec![vec![101.0, 0.0], vec![102.0, 1.0]]),
foreign_members: None,
};
let line_sfcgal = SFCGeometry::from_geojson::<Point2d>(&geom.value).unwrap();
type Err = Error
fn from_geojson<T: FromSlice + CoordType + ToSFCGALGeom>( geom: &GeometryValue, ) -> Result<SFCGeometry>
source§impl ToCoordinates for SFCGeometry
impl ToCoordinates for SFCGeometry
Convert a SFCGeometry
, given it’s internal GeomType
, to the corresponding CoordSeq
holding its coordinates (as tuple of 2 or 3 members).
fn to_coordinates<T>(&self) -> Result<CoordSeq<T>>where
T: FromSFCGALGeom + CoordType,
source§impl ToGeoJSON for SFCGeometry
impl ToGeoJSON for SFCGeometry
Conversion from SFCGAL Geometries to GeoJson.
Allows to choose if coordinates of constructed geojson have to be 2d or 3d.
use sfcgal::{SFCGeometry, ToGeoJSON};
type Point3d = (f64, f64, f64);
let input_wkt = "POINT (0.1 0.9 1.0)";
let pt_sfcgal = SFCGeometry::new(input_wkt).unwrap();
let pt_geojson = pt_sfcgal.to_geojson::<Point3d>().unwrap();
type Err = Error
fn to_geojson<T: FromSlice + CoordType + ToVec + FromSFCGALGeom>( &self, ) -> Result<GeometryValue>
source§impl TryInto<Geometry> for SFCGeometry
impl TryInto<Geometry> for SFCGeometry
Implements faillible conversion from SFCGeometry to geo_types::Geometry.
This is notably faillible because some types of SFCGeometry
like GeoTypes::Polyhedralsurface
don’t have equivalents in geo_types::Geometry.
Please note that geo_types Coordinate and Point primitives are 2d only, so
every information about z coordinate (if any) won’t be taken into account.
Auto Trait Implementations§
impl Freeze for SFCGeometry
impl RefUnwindSafe for SFCGeometry
impl !Send for SFCGeometry
impl !Sync for SFCGeometry
impl Unpin for SFCGeometry
impl UnwindSafe for SFCGeometry
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)