mirror of https://github.com/django/django.git
Refs #25773 -- Removed deprecated geos.MultiPolygon.cascaded_union property.
This commit is contained in:
parent
997c9f7099
commit
7e63e84572
|
@ -3,7 +3,6 @@
|
|||
GeometryCollection, MultiPoint, MultiLineString, and MultiPolygon
|
||||
"""
|
||||
import json
|
||||
import warnings
|
||||
from ctypes import byref, c_int, c_uint
|
||||
|
||||
from django.contrib.gis.geos import prototypes as capi
|
||||
|
@ -13,7 +12,6 @@ from django.contrib.gis.geos.libgeos import geos_version_info, get_pointer_arr
|
|||
from django.contrib.gis.geos.linestring import LinearRing, LineString
|
||||
from django.contrib.gis.geos.point import Point
|
||||
from django.contrib.gis.geos.polygon import Polygon
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.six.moves import range
|
||||
|
||||
|
||||
|
@ -128,15 +126,6 @@ class MultiPolygon(GeometryCollection):
|
|||
_allowed = Polygon
|
||||
_typeid = 6
|
||||
|
||||
@property
|
||||
def cascaded_union(self):
|
||||
"Returns a cascaded union of this MultiPolygon."
|
||||
warnings.warn(
|
||||
"`cascaded_union` is deprecated, use the `unary_union` property instead.",
|
||||
RemovedInDjango20Warning, 2
|
||||
)
|
||||
return GEOSGeometry(capi.geos_cascaded_union(self.ptr), self.srid)
|
||||
|
||||
|
||||
# Setting the allowed types here since GeometryCollection is defined before
|
||||
# its subclasses.
|
||||
|
|
|
@ -33,7 +33,6 @@ geos_simplify = Topology('GEOSSimplify', argtypes=[GEOM_PTR, c_double])
|
|||
geos_symdifference = Topology('GEOSSymDifference', argtypes=[GEOM_PTR, GEOM_PTR])
|
||||
geos_union = Topology('GEOSUnion', argtypes=[GEOM_PTR, GEOM_PTR])
|
||||
|
||||
geos_cascaded_union = GEOSFuncFactory('GEOSUnionCascaded', argtypes=[GEOM_PTR], restype=GEOM_PTR)
|
||||
geos_unary_union = GEOSFuncFactory('GEOSUnaryUnion', argtypes=[GEOM_PTR], restype=GEOM_PTR)
|
||||
|
||||
# GEOSRelate returns a string, not a geometry.
|
||||
|
|
|
@ -839,17 +839,6 @@ Geometry Collections
|
|||
In previous versions, an empty ``MultiPolygon`` couldn't be
|
||||
instantiated.
|
||||
|
||||
.. attribute:: cascaded_union
|
||||
|
||||
.. deprecated:: 1.10
|
||||
|
||||
Use the :attr:`GEOSGeometry.unary_union` property instead.
|
||||
|
||||
Returns a :class:`Polygon` that is the union of all of the component
|
||||
polygons in this collection. The algorithm employed is significantly
|
||||
more efficient (faster) than trying to union the geometries together
|
||||
individually. [#fncascadedunion]_
|
||||
|
||||
``GeometryCollection``
|
||||
----------------------
|
||||
|
||||
|
@ -1142,7 +1131,6 @@ include the SRID value (in other words, EWKB).
|
|||
|
||||
.. rubric:: Footnotes
|
||||
.. [#fnogc] *See* `PostGIS EWKB, EWKT and Canonical Forms <http://postgis.net/docs/using_postgis_dbmanagement.html#EWKB_EWKT>`_, PostGIS documentation at Ch. 4.1.2.
|
||||
.. [#fncascadedunion] For more information, read Paul Ramsey's blog post about `(Much) Faster Unions in PostGIS 1.4 <http://blog.cleverelephant.ca/2009/01/must-faster-unions-in-postgis-14.html>`_ and Martin Davis' blog post on `Fast polygon merging in JTS using Cascaded Union <http://lin-ear-th-inking.blogspot.com/2007/11/fast-polygon-merging-in-jts-using.html>`_.
|
||||
|
||||
Settings
|
||||
========
|
||||
|
|
|
@ -333,3 +333,6 @@ these features.
|
|||
|
||||
* The ``get_coords()`` and ``set_coords()`` methods of
|
||||
``django.contrib.gis.geos.Point`` are removed.
|
||||
|
||||
* The ``cascaded_union`` property of ``django.contrib.gis.geos.MultiPolygon``
|
||||
is removed.
|
||||
|
|
|
@ -18,9 +18,8 @@ from django.contrib.gis.geos.libgeos import geos_version_info
|
|||
from django.contrib.gis.shortcuts import numpy
|
||||
from django.template import Context
|
||||
from django.template.engine import Engine
|
||||
from django.test import SimpleTestCase, ignore_warnings, mock
|
||||
from django.test import SimpleTestCase, mock
|
||||
from django.utils import six
|
||||
from django.utils.deprecation import RemovedInDjango20Warning
|
||||
from django.utils.encoding import force_bytes
|
||||
from django.utils.six.moves import range
|
||||
|
||||
|
@ -1315,9 +1314,3 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
|
|||
self.assertEqual(p.transform(2774, clone=True), Point(srid=2774))
|
||||
p.transform(2774)
|
||||
self.assertEqual(p, Point(srid=2774))
|
||||
|
||||
@ignore_warnings(category=RemovedInDjango20Warning)
|
||||
def test_deprecated_cascaded_union(self):
|
||||
for geom in self.geometries.multipolygons:
|
||||
mpoly = GEOSGeometry(geom.wkt)
|
||||
self.assertEqual(mpoly.cascaded_union, mpoly.unary_union)
|
||||
|
|
Loading…
Reference in New Issue