pub struct tg_geom { /* private fields */ }Expand description
A geometry is the common generic type that can represent a Point, LineString, Polygon, MultiPoint, MultiLineString, MultiPolygon, or GeometryCollection.
For geometries that are derived from GeoJSON, they may have addtional attributes such as being a Feature or a FeatureCollection; or include extra json fields.
Creating
To create a new geometry use one of the GeometryConstructors or
GeometryParsing functions.
struct tg_geom *geom = tg_geom_new_point(point);
struct tg_geom *geom = tg_geom_new_polygon(poly);
struct tg_geom *geom = tg_parse_geojson(geojson);Upcasting
Other types, specifically tg_line, tg_ring, and tg_poly, can be safely
upcasted to a tg_geom; allowing them to use any tg_geom_*()
function.
struct tg_geom *geom1 = (struct tg_geom*)line; // Cast to a LineString
struct tg_geom *geom2 = (struct tg_geom*)ring; // Cast to a Polygon
struct tg_geom *geom3 = (struct tg_geom*)poly; // Cast to a Polygon- See
GeometryConstructors - See
GeometryAccessors - See
GeometryPredicates - See
GeometryParsing - See
GeometryWriting
Auto Trait Implementations§
impl Freeze for tg_geom
impl RefUnwindSafe for tg_geom
impl Send for tg_geom
impl Sync for tg_geom
impl Unpin for tg_geom
impl UnwindSafe for tg_geom
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
Mutably borrows from an owned value. Read more