Esempio n. 1
0
    def get_coordinate_pointers(self, coordinates):

        try:
            iter(coordinates)
        except TypeError:
            raise TypeError('Bounds must be a sequence')
        dimension = self.properties.dimension

        mins = ctypes.c_double * dimension
        maxs = ctypes.c_double * dimension

        if not self.interleaved:
            coordinates = Index.interleave(coordinates)

        # it's a point make it into a bbox. [x, y] => [x, y, x, y]
        if len(coordinates) == dimension:
            coordinates += coordinates

        if len(coordinates) != dimension * 2:
            raise core.RTreeError("Coordinates must be in the form "
                                    "(minx, miny, maxx, maxy) or (x, y) for 2D indexes")

        # so here all coords are in the form:
        # [xmin, ymin, zmin, xmax, ymax, zmax]
        for i in range(dimension):
            if not coordinates[i] <= coordinates[i + dimension]:
                raise core.RTreeError("Coordinates must not have minimums more than maximums")

        p_mins = mins(*[ctypes.c_double(\
                            coordinates[i]) for i in range(dimension)])
        p_maxs = maxs(*[ctypes.c_double(\
                        coordinates[i + dimension]) for i in range(dimension)])

        return (p_mins, p_maxs)
Esempio n. 2
0
 def set_near_minimum_overlap_factor(self, value):
     if (value <= 0):
         raise core.RTreeError("near_minimum_overlap_factor must be > 0")
     return core.rt.IndexProperty_SetNearMinimumOverlapFactor(
         self.handle, value)
Esempio n. 3
0
 def set_buffering_capacity(self, value):
     if (value <= 0):
         raise core.RTreeError("buffering_capacity must be > 0")
     return core.rt.IndexProperty_SetBufferingCapacity(self.handle, value)
Esempio n. 4
0
 def set_region_pool_capacity(self, value):
     if (value <= 0):
         raise core.RTreeError("region_pool_capacity must be > 0")
     return core.rt.IndexProperty_SetRegionPoolCapacity(self.handle, value)
Esempio n. 5
0
 def set_leaf_capacity(self, value):
     if (value <= 0):
         raise core.RTreeError("leaf_capacity must be > 0")
     return core.rt.IndexProperty_SetLeafCapacity(self.handle, value)
Esempio n. 6
0
 def set_pagesize(self, value):
     if (value <= 0):
         raise core.RTreeError("Pagesize must be > 0")
     return core.rt.IndexProperty_SetPagesize(self.handle, value)
Esempio n. 7
0
 def set_dimension(self, value):
     if (value <= 0):
         raise core.RTreeError(
             "Negative or 0 dimensional indexes are not allowed")
     return core.rt.IndexProperty_SetDimension(self.handle, value)