本文整理汇总了Python中django.contrib.gis.geos.libgeos.GEOM_PTR属性的典型用法代码示例。如果您正苦于以下问题:Python libgeos.GEOM_PTR属性的具体用法?Python libgeos.GEOM_PTR怎么用?Python libgeos.GEOM_PTR使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类django.contrib.gis.geos.libgeos
的用法示例。
在下文中一共展示了libgeos.GEOM_PTR属性的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _create_polygon
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [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: _clone
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def _clone(self, g):
if isinstance(g, GEOM_PTR):
return capi.geom_clone(g)
else:
return capi.geom_clone(g.ptr)
示例3: get_func
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def get_func(self, num_geom=1):
argtypes = [GEOM_PTR for i in range(num_geom)]
argtypes += [POINTER(c_double)]
self.argtypes = argtypes
return super(DblFromGeom, self).get_func()
# ### ctypes prototypes ###
# Area, distance, and length prototypes.
示例4: _create_polygon
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [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))
示例5: binary_predicate
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def binary_predicate(func, *args):
"For GEOS binary predicate functions."
argtypes = [GEOM_PTR, GEOM_PTR]
if args:
argtypes += args
func.argtypes = argtypes
func.restype = c_char
func.errcheck = check_predicate
return func
示例6: unary_predicate
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def unary_predicate(func):
"For GEOS unary predicate functions."
func.argtypes = [GEOM_PTR]
func.restype = c_char
func.errcheck = check_predicate
return func
# ## Unary Predicates ##
示例7: bin_output
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def bin_output(func):
"Generates a prototype for the routines that return a sized string."
func.argtypes = [GEOM_PTR, POINTER(c_size_t)]
func.errcheck = check_sized_string
func.restype = c_uchar_p
return func
示例8: geom_output
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def geom_output(func, argtypes):
"For GEOS routines that return a geometry."
if argtypes:
func.argtypes = argtypes
func.restype = GEOM_PTR
func.errcheck = check_geom
return func
示例9: geom_index
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def geom_index(func):
"For GEOS routines that return geometries from an index."
return geom_output(func, [GEOM_PTR, c_int])
示例10: int_from_geom
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def int_from_geom(func, zero=False):
"Argument is a geometry, return type is an integer."
func.argtypes = [GEOM_PTR]
func.restype = c_int
if zero:
func.errcheck = check_zero
else:
func.errcheck = check_minus_one
return func
示例11: string_from_geom
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def string_from_geom(func):
"Argument is a Geometry, return type is a string."
func.argtypes = [GEOM_PTR]
func.restype = geos_char_p
func.errcheck = check_string
return func
# ### ctypes prototypes ###
# Deprecated creation routines from WKB, HEX, WKT
示例12: wkb_write_func
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def wkb_write_func(func):
func.argtypes = [WKB_WRITE_PTR, GEOM_PTR, POINTER(c_size_t)]
func.restype = c_uchar_p
func.errcheck = check_sized_string
return func
示例13: topology
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def topology(func, *args, **kwargs):
"For GEOS unary topology functions."
argtypes = [GEOM_PTR]
if args:
argtypes += args
func.argtypes = argtypes
func.restype = kwargs.get('restype', GEOM_PTR)
func.errcheck = kwargs.get('errcheck', check_geom)
return func
# Topology Routines
示例14: dbl_from_geom
# 需要导入模块: from django.contrib.gis.geos import libgeos [as 别名]
# 或者: from django.contrib.gis.geos.libgeos import GEOM_PTR [as 别名]
def dbl_from_geom(func, num_geom=1):
"""
Argument is a Geometry, return type is double that is passed
in by reference as the last argument.
"""
argtypes = [GEOM_PTR for i in range(num_geom)]
argtypes += [POINTER(c_double)]
func.argtypes = argtypes
func.restype = c_int # Status code returned
func.errcheck = check_dbl
return func
# ### ctypes prototypes ###
# Area, distance, and length prototypes.