func (this *Geos) Polygon(exterior *Geom, interiors []*Geom) *Geom { if len(interiors) == 0 { geom := C.GEOSGeom_createPolygon_r(this.v, exterior.v, nil, C.uint(0)) if geom == nil { return nil } err := C.GEOSNormalize_r(this.v, geom) if err != 0 { C.GEOSGeom_destroy(geom) return nil } return &Geom{geom} } interiorPtr := make([]*C.GEOSGeometry, len(interiors)) for i, geom := range interiors { interiorPtr[i] = geom.v } geom := C.GEOSGeom_createPolygon_r(this.v, exterior.v, &interiorPtr[0], C.uint(len(interiors))) if geom == nil { return nil } err := C.GEOSNormalize_r(this.v, geom) if err != 0 { C.GEOSGeom_destroy(geom) return nil } return &Geom{geom} }
func destroyGeom(geom *Geom) { C.GEOSGeom_destroy(geom.v) }
func DestroyPt(p Point) { C.GEOSGeom_destroy(p.pointptr) }
func GeosDestroy(geom Geom) { C.GEOSPreparedGeom_destroy(geom.preped) C.GEOSGeom_destroy(geom.geom) }