示例#1
0
 def __setitem__(self, index, geom):
     "Sets the Geometry at the specified index."
     self._checkindex(index)
     if not isinstance(geom, self._allowed):
         raise TypeError('Incompatible Geometry for collection.')
     
     ngeoms = len(self)
     geoms = get_pointer_arr(ngeoms)
     for i in xrange(ngeoms):
         if i == index:
             geoms[i] = geom_clone(geom.ptr)
         else:
             geoms[i] = geom_clone(get_geomn(self.ptr, i))
     
     # Creating a new collection, and destroying the contents of the previous poiner.
     prev_ptr = self.ptr
     srid = self.srid
     self._ptr = create_collection(c_int(self._typeid), byref(geoms), c_uint(ngeoms))
     if srid: self.srid = srid
     destroy_geom(prev_ptr)
示例#2
0
    def __setitem__(self, index, geom):
        "Sets the Geometry at the specified index."
        self._checkindex(index)
        if not isinstance(geom, self._allowed):
            raise TypeError('Incompatible Geometry for collection.')

        ngeoms = len(self)
        geoms = get_pointer_arr(ngeoms)
        for i in xrange(ngeoms):
            if i == index:
                geoms[i] = geom_clone(geom.ptr)
            else:
                geoms[i] = geom_clone(get_geomn(self.ptr, i))

        # Creating a new collection, and destroying the contents of the previous poiner.
        prev_ptr = self.ptr
        srid = self.srid
        self._ptr = create_collection(c_int(self._typeid), byref(geoms),
                                      c_uint(ngeoms))
        if srid: self.srid = srid
        destroy_geom(prev_ptr)
 def _get_single_internal(self, index):
     return capi.get_geomn(self.ptr, index)
示例#4
0
 def _get_single_internal(self, index):
     return capi.get_geomn(self.ptr, index)
示例#5
0
 def __getitem__(self, index):
     "Returns the Geometry from this Collection at the given index (0-based)."
     # Checking the index and returning the corresponding GEOS geometry.
     self._checkindex(index)
     return GEOSGeometry(geom_clone(get_geomn(self.ptr, index)), srid=self.srid)
"""
示例#7
0
 def __getitem__(self, index):
     "Returns the Geometry from this Collection at the given index (0-based)."
     # Checking the index and returning the corresponding GEOS geometry.
     self._checkindex(index)
     return GEOSGeometry(geom_clone(get_geomn(self.ptr, index)),
                         srid=self.srid)
示例#8
0
 def _getitem_internal(self, index):
     return capi.get_geomn(self.ptr, index)
示例#9
0
 def _getitem_internal(self, index):
     return capi.get_geomn(self.ptr, index)