Exemple #1
0
    def test_discard(self):
        first_quadrangle = self.first_quadrangle
        fourth_quadrangle = self.fourth_quadrangle

        index = RTreeConvexQuadrangleIndex(
            (first_quadrangle, self.second_quadrangle))
        index.discard(self.second_quadrangle)

        self.assertEqual(1, len(index))
        self.assertEqual({first_quadrangle}, set(index.quadrangles))
        self.assertEqual(
            {
                first_quadrangle:
                first_quadrangle.area / fourth_quadrangle.area,
            },
            index.jaccard_indexes(fourth_quadrangle),
        )
Exemple #2
0
    def test_discard_duplicate(self):
        first_quadrangle = self.first_quadrangle
        second_quadrangle = self.second_quadrangle
        fourth_quadrangle = self.fourth_quadrangle

        index = RTreeConvexQuadrangleIndex(
            (first_quadrangle, second_quadrangle))
        index.discard(
            GEOSConvexQuadrangle(
                top_left=second_quadrangle.top_left,
                top_right=second_quadrangle.top_right,
                bottom_left=second_quadrangle.bottom_left,
                bottom_right=second_quadrangle.bottom_right,
            ))

        self.assertEqual(1, len(index))
        self.assertEqual({first_quadrangle}, set(index.quadrangles))
        self.assertEqual(
            {
                first_quadrangle:
                first_quadrangle.area / fourth_quadrangle.area,
            },
            index.jaccard_indexes(fourth_quadrangle),
        )