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
5d348bba
Kaydet (Commit)
5d348bba
authored
Ara 18, 2015
tarafından
Sergey Fedoseev
Kaydeden (comit)
Tim Graham
Ara 22, 2015
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
Fixed #25950 -- Added support for GEOSisClosed.
üst
64ba7d82
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
60 additions
and
24 deletions
+60
-24
collections.py
django/contrib/gis/geos/collections.py
+8
-11
geometry.py
django/contrib/gis/geos/geometry.py
+15
-1
linestring.py
django/contrib/gis/geos/linestring.py
+2
-9
__init__.py
django/contrib/gis/geos/prototypes/__init__.py
+3
-3
predicates.py
django/contrib/gis/geos/prototypes/predicates.py
+1
-0
geos.txt
docs/ref/contrib/gis/geos.txt
+11
-0
1.10.txt
docs/releases/1.10.txt
+5
-0
test_geos.py
tests/gis_tests/geos_tests/test_geos.py
+15
-0
No files found.
django/contrib/gis/geos/collections.py
Dosyayı görüntüle @
5d348bba
...
@@ -7,10 +7,9 @@ import warnings
...
@@ -7,10 +7,9 @@ import warnings
from
ctypes
import
byref
,
c_int
,
c_uint
from
ctypes
import
byref
,
c_int
,
c_uint
from
django.contrib.gis.geos
import
prototypes
as
capi
from
django.contrib.gis.geos
import
prototypes
as
capi
from
django.contrib.gis.geos.geometry
import
(
from
django.contrib.gis.geos.error
import
GEOSException
GEOSGeometry
,
ProjectInterpolateMixin
,
from
django.contrib.gis.geos.geometry
import
GEOSGeometry
,
LinearGeometryMixin
)
from
django.contrib.gis.geos.libgeos
import
geos_version_info
,
get_pointer_arr
from
django.contrib.gis.geos.libgeos
import
get_pointer_arr
from
django.contrib.gis.geos.linestring
import
LinearRing
,
LineString
from
django.contrib.gis.geos.linestring
import
LinearRing
,
LineString
from
django.contrib.gis.geos.point
import
Point
from
django.contrib.gis.geos.point
import
Point
from
django.contrib.gis.geos.polygon
import
Polygon
from
django.contrib.gis.geos.polygon
import
Polygon
...
@@ -114,17 +113,15 @@ class MultiPoint(GeometryCollection):
...
@@ -114,17 +113,15 @@ class MultiPoint(GeometryCollection):
_typeid
=
4
_typeid
=
4
class
MultiLineString
(
ProjectInterpolate
Mixin
,
GeometryCollection
):
class
MultiLineString
(
LinearGeometry
Mixin
,
GeometryCollection
):
_allowed
=
(
LineString
,
LinearRing
)
_allowed
=
(
LineString
,
LinearRing
)
_typeid
=
5
_typeid
=
5
@property
@property
def
merged
(
self
):
def
closed
(
self
):
"""
if
geos_version_info
()[
'version'
]
<
'3.5'
:
Returns a LineString representing the line merge of this
raise
GEOSException
(
"MultiLineString.closed requires GEOS >= 3.5.0."
)
MultiLineString.
return
super
(
MultiLineString
,
self
)
.
closed
"""
return
self
.
_topology
(
capi
.
geos_linemerge
(
self
.
ptr
))
class
MultiPolygon
(
GeometryCollection
):
class
MultiPolygon
(
GeometryCollection
):
...
...
django/contrib/gis/geos/geometry.py
Dosyayı görüntüle @
5d348bba
...
@@ -685,7 +685,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
...
@@ -685,7 +685,7 @@ class GEOSGeometry(GEOSBase, ListMixin):
return
GEOSGeometry
(
capi
.
geom_clone
(
self
.
ptr
),
srid
=
self
.
srid
)
return
GEOSGeometry
(
capi
.
geom_clone
(
self
.
ptr
),
srid
=
self
.
srid
)
class
ProjectInterpolate
Mixin
(
object
):
class
LinearGeometry
Mixin
(
object
):
"""
"""
Used for LineString and MultiLineString.
Used for LineString and MultiLineString.
"""
"""
...
@@ -706,3 +706,17 @@ class ProjectInterpolateMixin(object):
...
@@ -706,3 +706,17 @@ class ProjectInterpolateMixin(object):
if
not
isinstance
(
point
,
Point
):
if
not
isinstance
(
point
,
Point
):
raise
TypeError
(
'locate_point argument must be a Point'
)
raise
TypeError
(
'locate_point argument must be a Point'
)
return
capi
.
geos_project_normalized
(
self
.
ptr
,
point
.
ptr
)
return
capi
.
geos_project_normalized
(
self
.
ptr
,
point
.
ptr
)
@property
def
merged
(
self
):
"""
Return the line merge of this Geometry.
"""
return
self
.
_topology
(
capi
.
geos_linemerge
(
self
.
ptr
))
@property
def
closed
(
self
):
"""
Return whether or not this Geometry is closed.
"""
return
capi
.
geos_isclosed
(
self
.
ptr
)
django/contrib/gis/geos/linestring.py
Dosyayı görüntüle @
5d348bba
from
django.contrib.gis.geos
import
prototypes
as
capi
from
django.contrib.gis.geos
import
prototypes
as
capi
from
django.contrib.gis.geos.coordseq
import
GEOSCoordSeq
from
django.contrib.gis.geos.coordseq
import
GEOSCoordSeq
from
django.contrib.gis.geos.error
import
GEOSException
from
django.contrib.gis.geos.error
import
GEOSException
from
django.contrib.gis.geos.geometry
import
(
from
django.contrib.gis.geos.geometry
import
GEOSGeometry
,
LinearGeometryMixin
GEOSGeometry
,
ProjectInterpolateMixin
,
)
from
django.contrib.gis.geos.point
import
Point
from
django.contrib.gis.geos.point
import
Point
from
django.contrib.gis.shortcuts
import
numpy
from
django.contrib.gis.shortcuts
import
numpy
from
django.utils.six.moves
import
range
from
django.utils.six.moves
import
range
class
LineString
(
ProjectInterpolate
Mixin
,
GEOSGeometry
):
class
LineString
(
LinearGeometry
Mixin
,
GEOSGeometry
):
_init_func
=
capi
.
create_linestring
_init_func
=
capi
.
create_linestring
_minlength
=
2
_minlength
=
2
has_cs
=
True
has_cs
=
True
...
@@ -154,11 +152,6 @@ class LineString(ProjectInterpolateMixin, GEOSGeometry):
...
@@ -154,11 +152,6 @@ class LineString(ProjectInterpolateMixin, GEOSGeometry):
"Returns a numpy array for the LineString."
"Returns a numpy array for the LineString."
return
self
.
_listarr
(
self
.
_cs
.
__getitem__
)
return
self
.
_listarr
(
self
.
_cs
.
__getitem__
)
@property
def
merged
(
self
):
"Returns the line merge of this LineString."
return
self
.
_topology
(
capi
.
geos_linemerge
(
self
.
ptr
))
@property
@property
def
x
(
self
):
def
x
(
self
):
"Returns a list or numpy array of the X variable."
"Returns a list or numpy array of the X variable."
...
...
django/contrib/gis/geos/prototypes/__init__.py
Dosyayı görüntüle @
5d348bba
...
@@ -19,8 +19,8 @@ from django.contrib.gis.geos.prototypes.geom import ( # NOQA
...
@@ -19,8 +19,8 @@ from django.contrib.gis.geos.prototypes.geom import ( # NOQA
from
django.contrib.gis.geos.prototypes.misc
import
*
# NOQA
from
django.contrib.gis.geos.prototypes.misc
import
*
# NOQA
from
django.contrib.gis.geos.prototypes.predicates
import
(
# NOQA
from
django.contrib.gis.geos.prototypes.predicates
import
(
# NOQA
geos_contains
,
geos_covers
,
geos_crosses
,
geos_disjoint
,
geos_equals
,
geos_contains
,
geos_covers
,
geos_crosses
,
geos_disjoint
,
geos_equals
,
geos_equalsexact
,
geos_hasz
,
geos_intersects
,
geos_is
empty
,
geos_isring
,
geos_equalsexact
,
geos_hasz
,
geos_intersects
,
geos_is
closed
,
geos_isempty
,
geos_is
simple
,
geos_isvalid
,
geos_overlaps
,
geos_relatepattern
,
geos_is
ring
,
geos_issimple
,
geos_isvalid
,
geos_overlaps
,
geos_touches
,
geos_within
,
geos_
relatepattern
,
geos_
touches
,
geos_within
,
)
)
from
django.contrib.gis.geos.prototypes.topology
import
*
# NOQA
from
django.contrib.gis.geos.prototypes.topology
import
*
# NOQA
django/contrib/gis/geos/prototypes/predicates.py
Dosyayı görüntüle @
5d348bba
...
@@ -23,6 +23,7 @@ class BinaryPredicate(UnaryPredicate):
...
@@ -23,6 +23,7 @@ class BinaryPredicate(UnaryPredicate):
# ## Unary Predicates ##
# ## Unary Predicates ##
geos_hasz
=
UnaryPredicate
(
'GEOSHasZ'
)
geos_hasz
=
UnaryPredicate
(
'GEOSHasZ'
)
geos_isclosed
=
UnaryPredicate
(
'GEOSisClosed'
)
geos_isempty
=
UnaryPredicate
(
'GEOSisEmpty'
)
geos_isempty
=
UnaryPredicate
(
'GEOSisEmpty'
)
geos_isring
=
UnaryPredicate
(
'GEOSisRing'
)
geos_isring
=
UnaryPredicate
(
'GEOSisRing'
)
geos_issimple
=
UnaryPredicate
(
'GEOSisSimple'
)
geos_issimple
=
UnaryPredicate
(
'GEOSisSimple'
)
...
...
docs/ref/contrib/gis/geos.txt
Dosyayı görüntüle @
5d348bba
...
@@ -694,6 +694,12 @@ is returned instead.
...
@@ -694,6 +694,12 @@ is returned instead.
In previous versions, an empty ``LineString`` couldn't be instantiated.
In previous versions, an empty ``LineString`` couldn't be instantiated.
.. attribute:: closed
.. versionadded:: 1.10
Returns whether or not this ``LineString`` is closed.
``LinearRing``
``LinearRing``
--------------
--------------
...
@@ -790,6 +796,11 @@ Geometry Collections
...
@@ -790,6 +796,11 @@ Geometry Collections
Returns a :class:`LineString` representing the line merge of
Returns a :class:`LineString` representing the line merge of
all the components in this ``MultiLineString``.
all the components in this ``MultiLineString``.
.. attribute:: closed
.. versionadded:: 1.10
Returns ``True`` if and only if all elements are closed. Requires GEOS 3.5.
``MultiPolygon``
``MultiPolygon``
----------------
----------------
...
...
docs/releases/1.10.txt
Dosyayı görüntüle @
5d348bba
...
@@ -104,6 +104,11 @@ Minor features
...
@@ -104,6 +104,11 @@ Minor features
of :class:`~django.contrib.gis.geos.WKTWriter` allow controlling
of :class:`~django.contrib.gis.geos.WKTWriter` allow controlling
output of the fractional part of the coordinates in WKT.
output of the fractional part of the coordinates in WKT.
* Added the :attr:`LineString.closed
<django.contrib.gis.geos.LineString.closed>` and
:attr:`MultiLineString.closed
<django.contrib.gis.geos.MultiLineString.closed>` properties.
:mod:`django.contrib.messages`
:mod:`django.contrib.messages`
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
...
...
tests/gis_tests/geos_tests/test_geos.py
Dosyayı görüntüle @
5d348bba
...
@@ -15,6 +15,7 @@ from django.contrib.gis.geos import (
...
@@ -15,6 +15,7 @@ from django.contrib.gis.geos import (
fromfile
,
fromstr
,
fromfile
,
fromstr
,
)
)
from
django.contrib.gis.geos.base
import
GEOSBase
from
django.contrib.gis.geos.base
import
GEOSBase
from
django.contrib.gis.geos.libgeos
import
geos_version_info
from
django.contrib.gis.shortcuts
import
numpy
from
django.contrib.gis.shortcuts
import
numpy
from
django.template
import
Context
from
django.template
import
Context
from
django.template.engine
import
Engine
from
django.template.engine
import
Engine
...
@@ -660,6 +661,20 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
...
@@ -660,6 +661,20 @@ class GEOSTest(SimpleTestCase, TestDataMixin):
self
.
assertTrue
(
poly
.
covers
(
Point
(
5
,
5
)))
self
.
assertTrue
(
poly
.
covers
(
Point
(
5
,
5
)))
self
.
assertFalse
(
poly
.
covers
(
Point
(
100
,
100
)))
self
.
assertFalse
(
poly
.
covers
(
Point
(
100
,
100
)))
def
test_closed
(
self
):
ls_closed
=
LineString
((
0
,
0
),
(
1
,
1
),
(
0
,
0
))
ls_not_closed
=
LineString
((
0
,
0
),
(
1
,
1
))
self
.
assertFalse
(
ls_not_closed
.
closed
)
self
.
assertTrue
(
ls_closed
.
closed
)
if
geos_version_info
()[
'version'
]
>=
'3.5'
:
self
.
assertFalse
(
MultiLineString
(
ls_closed
,
ls_not_closed
)
.
closed
)
self
.
assertTrue
(
MultiLineString
(
ls_closed
,
ls_closed
)
.
closed
)
with
mock
.
patch
(
'django.contrib.gis.geos.collections.geos_version_info'
,
lambda
:
{
'version'
:
'3.4.9'
}):
with
self
.
assertRaisesMessage
(
GEOSException
,
"MultiLineString.closed requires GEOS >= 3.5.0."
):
MultiLineString
()
.
closed
def
test_srid
(
self
):
def
test_srid
(
self
):
"Testing the SRID property and keyword."
"Testing the SRID property and keyword."
# Testing SRID keyword on Point
# Testing SRID keyword on Point
...
...
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