Beispiel #1
0
            RTreePage.objects(name=self.name, page=page).delete(safe=True)
        except:
            returnError.contents.value = self.InvalidPageError

    hasData = property( lambda self: RTreePage.objects(name=self.name).first() is not None )

if __name__=='__main__':
    settings = Property()
    settings.writethrough= True
    settings.buffering_capacity=1

    storage = MongoStorage('test')
    storage.clear()
    r = Rtree( storage, properties=settings)

    r.add(123,(0,0,1,1))
    
    print "test 1 should be true"
    item = list(r.nearest((0,0), 1, objects=True))[0]
    print item.id
    print r.valid()

    print "test 2 should be true"
    r.delete(123, (0,0,1,1))
    print r.valid()

    print "test 3 should be true"
    r.clearBuffer()
    print r.valid()

    del r
Beispiel #2
0
            returnError.contents.value = self.InvalidPageError

    hasData = property(
        lambda self: RTreePage.objects(name=self.name).first() is not None)


if __name__ == '__main__':
    settings = Property()
    settings.writethrough = True
    settings.buffering_capacity = 1

    storage = MongoStorage('test')
    storage.clear()
    r = Rtree(storage, properties=settings)

    r.add(123, (0, 0, 1, 1))

    print "test 1 should be true"
    item = list(r.nearest((0, 0), 1, objects=True))[0]
    print item.id
    print r.valid()

    print "test 2 should be true"
    r.delete(123, (0, 0, 1, 1))
    print r.valid()

    print "test 3 should be true"
    r.clearBuffer()
    print r.valid()

    del r