コード例 #1
0
ファイル: collections.py プロジェクト: AloneRoad/Inforlearn
 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)
コード例 #3
0
 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
ファイル: collections.py プロジェクト: AloneRoad/Inforlearn
 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)
コード例 #6
0
"""
コード例 #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
ファイル: collections.py プロジェクト: faridani/Mturk-Tracker
 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)