Loading django/contrib/gis/geos/collections.py +8 −11 Original line number Diff line number Diff line Loading @@ -7,10 +7,9 @@ import warnings from ctypes import byref, c_int, c_uint from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.geometry import ( GEOSGeometry, ProjectInterpolateMixin, ) from django.contrib.gis.geos.libgeos import get_pointer_arr from django.contrib.gis.geos.error import GEOSException 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.linestring import LinearRing, LineString from django.contrib.gis.geos.point import Point from django.contrib.gis.geos.polygon import Polygon Loading Loading @@ -114,17 +113,15 @@ class MultiPoint(GeometryCollection): _typeid = 4 class MultiLineString(ProjectInterpolateMixin, GeometryCollection): class MultiLineString(LinearGeometryMixin, GeometryCollection): _allowed = (LineString, LinearRing) _typeid = 5 @property def merged(self): """ Returns a LineString representing the line merge of this MultiLineString. """ return self._topology(capi.geos_linemerge(self.ptr)) def closed(self): if geos_version_info()['version'] < '3.5': raise GEOSException("MultiLineString.closed requires GEOS >= 3.5.0.") return super(MultiLineString, self).closed class MultiPolygon(GeometryCollection): Loading django/contrib/gis/geos/geometry.py +15 −1 Original line number Diff line number Diff line Loading @@ -685,7 +685,7 @@ class GEOSGeometry(GEOSBase, ListMixin): return GEOSGeometry(capi.geom_clone(self.ptr), srid=self.srid) class ProjectInterpolateMixin(object): class LinearGeometryMixin(object): """ Used for LineString and MultiLineString. """ Loading @@ -706,3 +706,17 @@ class ProjectInterpolateMixin(object): if not isinstance(point, Point): raise TypeError('locate_point argument must be a Point') 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 +2 −9 Original line number Diff line number Diff line from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.coordseq import GEOSCoordSeq from django.contrib.gis.geos.error import GEOSException from django.contrib.gis.geos.geometry import ( GEOSGeometry, ProjectInterpolateMixin, ) from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin from django.contrib.gis.geos.point import Point from django.contrib.gis.shortcuts import numpy from django.utils.six.moves import range class LineString(ProjectInterpolateMixin, GEOSGeometry): class LineString(LinearGeometryMixin, GEOSGeometry): _init_func = capi.create_linestring _minlength = 2 has_cs = True Loading Loading @@ -154,11 +152,6 @@ class LineString(ProjectInterpolateMixin, GEOSGeometry): "Returns a numpy array for the LineString." 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 def x(self): "Returns a list or numpy array of the X variable." Loading django/contrib/gis/geos/prototypes/__init__.py +3 −3 Original line number Diff line number Diff line Loading @@ -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.predicates import ( # NOQA 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, geos_equalsexact, geos_hasz, geos_intersects, geos_isclosed, 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 +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ class BinaryPredicate(UnaryPredicate): # ## Unary Predicates ## geos_hasz = UnaryPredicate('GEOSHasZ') geos_isclosed = UnaryPredicate('GEOSisClosed') geos_isempty = UnaryPredicate('GEOSisEmpty') geos_isring = UnaryPredicate('GEOSisRing') geos_issimple = UnaryPredicate('GEOSisSimple') Loading Loading
django/contrib/gis/geos/collections.py +8 −11 Original line number Diff line number Diff line Loading @@ -7,10 +7,9 @@ import warnings from ctypes import byref, c_int, c_uint from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.geometry import ( GEOSGeometry, ProjectInterpolateMixin, ) from django.contrib.gis.geos.libgeos import get_pointer_arr from django.contrib.gis.geos.error import GEOSException 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.linestring import LinearRing, LineString from django.contrib.gis.geos.point import Point from django.contrib.gis.geos.polygon import Polygon Loading Loading @@ -114,17 +113,15 @@ class MultiPoint(GeometryCollection): _typeid = 4 class MultiLineString(ProjectInterpolateMixin, GeometryCollection): class MultiLineString(LinearGeometryMixin, GeometryCollection): _allowed = (LineString, LinearRing) _typeid = 5 @property def merged(self): """ Returns a LineString representing the line merge of this MultiLineString. """ return self._topology(capi.geos_linemerge(self.ptr)) def closed(self): if geos_version_info()['version'] < '3.5': raise GEOSException("MultiLineString.closed requires GEOS >= 3.5.0.") return super(MultiLineString, self).closed class MultiPolygon(GeometryCollection): Loading
django/contrib/gis/geos/geometry.py +15 −1 Original line number Diff line number Diff line Loading @@ -685,7 +685,7 @@ class GEOSGeometry(GEOSBase, ListMixin): return GEOSGeometry(capi.geom_clone(self.ptr), srid=self.srid) class ProjectInterpolateMixin(object): class LinearGeometryMixin(object): """ Used for LineString and MultiLineString. """ Loading @@ -706,3 +706,17 @@ class ProjectInterpolateMixin(object): if not isinstance(point, Point): raise TypeError('locate_point argument must be a Point') 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 +2 −9 Original line number Diff line number Diff line from django.contrib.gis.geos import prototypes as capi from django.contrib.gis.geos.coordseq import GEOSCoordSeq from django.contrib.gis.geos.error import GEOSException from django.contrib.gis.geos.geometry import ( GEOSGeometry, ProjectInterpolateMixin, ) from django.contrib.gis.geos.geometry import GEOSGeometry, LinearGeometryMixin from django.contrib.gis.geos.point import Point from django.contrib.gis.shortcuts import numpy from django.utils.six.moves import range class LineString(ProjectInterpolateMixin, GEOSGeometry): class LineString(LinearGeometryMixin, GEOSGeometry): _init_func = capi.create_linestring _minlength = 2 has_cs = True Loading Loading @@ -154,11 +152,6 @@ class LineString(ProjectInterpolateMixin, GEOSGeometry): "Returns a numpy array for the LineString." 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 def x(self): "Returns a list or numpy array of the X variable." Loading
django/contrib/gis/geos/prototypes/__init__.py +3 −3 Original line number Diff line number Diff line Loading @@ -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.predicates import ( # NOQA 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, geos_equalsexact, geos_hasz, geos_intersects, geos_isclosed, 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 +1 −0 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ class BinaryPredicate(UnaryPredicate): # ## Unary Predicates ## geos_hasz = UnaryPredicate('GEOSHasZ') geos_isclosed = UnaryPredicate('GEOSisClosed') geos_isempty = UnaryPredicate('GEOSisEmpty') geos_isring = UnaryPredicate('GEOSisRing') geos_issimple = UnaryPredicate('GEOSisSimple') Loading