Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
D
django
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
Batuhan Osman TASKAYA
django
Commits
ccc8f67b
Kaydet (Commit)
ccc8f67b
authored
Kas 20, 2015
tarafından
Sergey Fedoseev
Kaydeden (comit)
Tim Graham
Kas 20, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25722 -- Added the GEOSGeometry.covers() method.
üst
73a6ab63
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
6 deletions
+45
-6
geometry.py
django/contrib/gis/geos/geometry.py
+8
-0
__init__.py
django/contrib/gis/geos/prototypes/__init__.py
+4
-3
predicates.py
django/contrib/gis/geos/prototypes/predicates.py
+1
-0
geos.txt
docs/ref/contrib/gis/geos.txt
+22
-0
1.10.txt
docs/releases/1.10.txt
+3
-0
test_geos.py
tests/gis_tests/geos_tests/test_geos.py
+7
-3
No files found.
django/contrib/gis/geos/geometry.py
Dosyayı görüntüle @
ccc8f67b
...
...
@@ -294,6 +294,14 @@ class GEOSGeometry(GEOSBase, ListMixin):
"Returns true if other.within(this) returns true."
return
capi
.
geos_contains
(
self
.
ptr
,
other
.
ptr
)
def
covers
(
self
,
other
):
"""
Return True if the DE-9IM Intersection Matrix for the two geometries is
T*****FF*, *T****FF*, ***T**FF*, or ****T*FF*. If either geometry is
empty, return False.
"""
return
capi
.
geos_covers
(
self
.
ptr
,
other
.
ptr
)
def
crosses
(
self
,
other
):
"""
Returns true if the DE-9IM intersection matrix for the two Geometries
...
...
django/contrib/gis/geos/prototypes/__init__.py
Dosyayı görüntüle @
ccc8f67b
...
...
@@ -17,8 +17,9 @@ from django.contrib.gis.geos.prototypes.geom import ( # NOQA
)
from
django.contrib.gis.geos.prototypes.misc
import
*
# NOQA
from
django.contrib.gis.geos.prototypes.predicates
import
(
# NOQA
geos_contains
,
geos_crosses
,
geos_disjoint
,
geos_equals
,
geos_equalsexact
,
geos_hasz
,
geos_intersects
,
geos_isempty
,
geos_isring
,
geos_issimple
,
geos_isvalid
,
geos_overlaps
,
geos_relatepattern
,
geos_touches
,
geos_within
,
geos_contains
,
geos_covers
,
geos_crosses
,
geos_disjoint
,
geos_equals
,
geos_equalsexact
,
geos_hasz
,
geos_intersects
,
geos_isempty
,
geos_isring
,
geos_issimple
,
geos_isvalid
,
geos_overlaps
,
geos_relatepattern
,
geos_touches
,
geos_within
,
)
from
django.contrib.gis.geos.prototypes.topology
import
*
# NOQA
django/contrib/gis/geos/prototypes/predicates.py
Dosyayı görüntüle @
ccc8f67b
...
...
@@ -30,6 +30,7 @@ geos_isvalid = UnaryPredicate('GEOSisValid')
# ## Binary Predicates ##
geos_contains
=
BinaryPredicate
(
'GEOSContains'
)
geos_covers
=
BinaryPredicate
(
'GEOSCovers'
)
geos_crosses
=
BinaryPredicate
(
'GEOSCrosses'
)
geos_disjoint
=
BinaryPredicate
(
'GEOSDisjoint'
)
geos_equals
=
BinaryPredicate
(
'GEOSEquals'
)
...
...
docs/ref/contrib/gis/geos.txt
Dosyayı görüntüle @
ccc8f67b
...
...
@@ -349,6 +349,28 @@ return a boolean.
Returns ``True`` if :meth:`other.within(this) <GEOSGeometry.within>` returns
``True``.
.. method:: GEOSGeometry.covers(other)
.. versionadded:: 1.10
Returns ``True`` if this geometry covers the specified geometry.
The ``covers`` predicate has the following equivalent definitions:
* Every point of the other geometry is a point of this geometry.
* The DE-9IM Intersection Matrix for the two geometries is
``T*****FF*``, ``*T****FF*``, ``***T**FF*``, or ``****T*FF*``.
If either geometry is empty, returns ``False``.
This predicate is similar to :meth:`GEOSGeometry.contains`, but is more
inclusive (i.e. returns ``True`` for more cases). In particular, unlike
:meth:`~GEOSGeometry.contains` it does not distinguish between points in the
boundary and in the interior of geometries. For most situations, ``covers()``
should be preferred to :meth:`~GEOSGeometry.contains`. As an added benefit,
``covers()`` is more amenable to optimization and hence should outperform
:meth:`~GEOSGeometry.contains`.
.. method:: GEOSGeometry.crosses(other)
Returns ``True`` if the DE-9IM intersection matrix for the two Geometries
...
...
docs/releases/1.10.txt
Dosyayı görüntüle @
ccc8f67b
...
...
@@ -71,6 +71,9 @@ Minor features
<django.contrib.gis.geos.GEOSGeometry.unary_union>` property computes the
union of all the elements of this geometry.
* Added the :meth:`GEOSGeometry.covers()
<django.contrib.gis.geos.GEOSGeometry.covers>` binary predicate.
:mod:`django.contrib.messages`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
...
tests/gis_tests/geos_tests/test_geos.py
Dosyayı görüntüle @
ccc8f67b
...
...
@@ -643,6 +643,11 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
self
.
assertAlmostEqual
(
exp_ring
[
k
][
0
],
buf_ring
[
k
][
0
],
9
)
self
.
assertAlmostEqual
(
exp_ring
[
k
][
1
],
buf_ring
[
k
][
1
],
9
)
def
test_covers
(
self
):
poly
=
Polygon
(((
0
,
0
),
(
0
,
10
),
(
10
,
10
),
(
10
,
0
),
(
0
,
0
)))
self
.
assertTrue
(
poly
.
covers
(
Point
(
5
,
5
)))
self
.
assertFalse
(
poly
.
covers
(
Point
(
100
,
100
)))
def
test_srid
(
self
):
"Testing the SRID property and keyword."
# Testing SRID keyword on Point
...
...
@@ -1084,12 +1089,11 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
# A set of test points.
pnts
=
[
Point
(
5
,
5
),
Point
(
7.5
,
7.5
),
Point
(
2.5
,
7.5
)]
covers
=
[
True
,
True
,
False
]
# No `covers` op for regular GEOS geoms.
for
pnt
,
c
in
zip
(
pnts
,
covers
):
for
pnt
in
pnts
:
# Results should be the same (but faster)
self
.
assertEqual
(
mpoly
.
contains
(
pnt
),
prep
.
contains
(
pnt
))
self
.
assertEqual
(
mpoly
.
intersects
(
pnt
),
prep
.
intersects
(
pnt
))
self
.
assertEqual
(
c
,
prep
.
covers
(
pnt
))
self
.
assertEqual
(
mpoly
.
covers
(
pnt
)
,
prep
.
covers
(
pnt
))
self
.
assertTrue
(
prep
.
crosses
(
fromstr
(
'LINESTRING(1 1, 15 15)'
)))
self
.
assertTrue
(
prep
.
disjoint
(
Point
(
-
5
,
-
5
)))
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment