summaryrefslogtreecommitdiff
path: root/django
diff options
context:
space:
mode:
authorStanislav Karpov <stkrp@yandex.ru>2018-01-09 19:15:04 +0300
committerTim Graham <timograham@gmail.com>2018-02-10 19:45:58 -0500
commit6d794fb76212bb8a62fe2cd97cff173054e1c626 (patch)
treea947f691b5c831f64b2759a46100c7e046df88dd /django
parent2162f0983de0dfe2178531638ce7ea56f54dd4e7 (diff)
Fixed #28960 -- Added GEOSGeometry.buffer_with_style().
Diffstat (limited to 'django')
-rw-r--r--django/contrib/gis/geos/geometry.py12
-rw-r--r--django/contrib/gis/geos/prototypes/topology.py1
2 files changed, 13 insertions, 0 deletions
diff --git a/django/contrib/gis/geos/geometry.py b/django/contrib/gis/geos/geometry.py
index 1ebecc864b..80770dfa6b 100644
--- a/django/contrib/gis/geos/geometry.py
+++ b/django/contrib/gis/geos/geometry.py
@@ -499,6 +499,18 @@ class GEOSGeometryBase(GEOSBase):
"""
return self._topology(capi.geos_buffer(self.ptr, width, quadsegs))
+ def buffer_with_style(self, width, quadsegs=8, end_cap_style=1, join_style=1, mitre_limit=5.0):
+ """
+ Same as buffer() but allows customizing the style of the buffer.
+
+ End cap style can be round (1), flat (2), or square (3).
+ Join style can be round (1), mitre (2), or bevel (3).
+ Mitre ratio limit only affects mitered join style.
+ """
+ return self._topology(
+ capi.geos_bufferwithstyle(self.ptr, width, quadsegs, end_cap_style, join_style, mitre_limit),
+ )
+
@property
def centroid(self):
"""
diff --git a/django/contrib/gis/geos/prototypes/topology.py b/django/contrib/gis/geos/prototypes/topology.py
index f8c36bc6f5..9ca0dce695 100644
--- a/django/contrib/gis/geos/prototypes/topology.py
+++ b/django/contrib/gis/geos/prototypes/topology.py
@@ -21,6 +21,7 @@ class Topology(GEOSFuncFactory):
# Topology Routines
geos_boundary = Topology('GEOSBoundary')
geos_buffer = Topology('GEOSBuffer', argtypes=[GEOM_PTR, c_double, c_int])
+geos_bufferwithstyle = Topology('GEOSBufferWithStyle', argtypes=[GEOM_PTR, c_double, c_int, c_int, c_int, c_double])
geos_centroid = Topology('GEOSGetCentroid')
geos_convexhull = Topology('GEOSConvexHull')
geos_difference = Topology('GEOSDifference', argtypes=[GEOM_PTR, GEOM_PTR])