本文整理匯總了Python中django.contrib.gis.geos.libgeos.get_pointer_arr方法的典型用法代碼示例。如果您正苦於以下問題:Python libgeos.get_pointer_arr方法的具體用法?Python libgeos.get_pointer_arr怎麽用?Python libgeos.get_pointer_arr使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類django.contrib.gis.geos.libgeos
的用法示例。
在下文中一共展示了libgeos.get_pointer_arr方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: _create_polygon
# 需要導入模塊: from django.contrib.gis.geos import libgeos [as 別名]
# 或者: from django.contrib.gis.geos.libgeos import get_pointer_arr [as 別名]
def _create_polygon(self, length, items):
# Instantiate LinearRing objects if necessary, but don't clone them yet
# _construct_ring will throw a TypeError if a parameter isn't a valid ring
# If we cloned the pointers here, we wouldn't be able to clean up
# in case of error.
rings = []
for r in items:
if isinstance(r, GEOM_PTR):
rings.append(r)
else:
rings.append(self._construct_ring(r))
shell = self._clone(rings.pop(0))
n_holes = length - 1
if n_holes:
holes = get_pointer_arr(n_holes)
for i, r in enumerate(rings):
holes[i] = self._clone(r)
holes_param = byref(holes)
else:
holes_param = None
return capi.create_polygon(shell, holes_param, c_uint(n_holes))
示例2: _create_collection
# 需要導入模塊: from django.contrib.gis.geos import libgeos [as 別名]
# 或者: from django.contrib.gis.geos.libgeos import get_pointer_arr [as 別名]
def _create_collection(self, length, items):
# Creating the geometry pointer array.
geoms = get_pointer_arr(length)
for i, g in enumerate(items):
# this is a little sloppy, but makes life easier
# allow GEOSGeometry types (python wrappers) or pointer types
geoms[i] = capi.geom_clone(getattr(g, 'ptr', g))
return capi.create_collection(c_int(self._typeid), byref(geoms), c_uint(length))
示例3: _create_polygon
# 需要導入模塊: from django.contrib.gis.geos import libgeos [as 別名]
# 或者: from django.contrib.gis.geos.libgeos import get_pointer_arr [as 別名]
def _create_polygon(self, length, items):
# Instantiate LinearRing objects if necessary, but don't clone them yet
# _construct_ring will throw a TypeError if a parameter isn't a valid ring
# If we cloned the pointers here, we wouldn't be able to clean up
# in case of error.
if not length:
return capi.create_empty_polygon()
rings = []
for r in items:
if isinstance(r, GEOM_PTR):
rings.append(r)
else:
rings.append(self._construct_ring(r))
shell = self._clone(rings.pop(0))
n_holes = length - 1
if n_holes:
holes = get_pointer_arr(n_holes)
for i, r in enumerate(rings):
holes[i] = self._clone(r)
holes_param = byref(holes)
else:
holes_param = None
return capi.create_polygon(shell, holes_param, c_uint(n_holes))