Exemplo n.º 1
0
    def test_water_body_info(self):
        cleaner = SiteNodeGeometryCleaner(self.mainsite)

        cleaner.process_level_curves()
        cleaner.process_material_areas()

        water_shape, water_info = cleaner['{Water body}']
        self.assertEqual(water_info["altitude"], self.altitude_water)
Exemplo n.º 2
0
 def test_sorting_material_problems(self):
     # Build a material area which touches another one.
     grass_area_coords = [(0, 9), (12, 9), (12, 10), (0, 10)]
     other_grass = MaterialArea(grass_area_coords,
                                material=self.grass,
                                parent_site=self.mainsite,
                                id="{Other grass area}")
     self.mainsite.add_child(other_grass)
     cleaner = SiteNodeGeometryCleaner(self.mainsite)
     cleaner.process_material_areas()
     problems = cleaner.check_issues_with_material_area_order()
     self.assertEqual(problems, [('{Grass area}', '{Other grass area}')])
Exemplo n.º 3
0
    def test_add_and_clean_material_area(self):
        overlap_area = MaterialArea(rect(5, 7, 7, 9),
                                    material=self.grass,
                                    parent_site=self.mainsite,
                                    id="{Overlap area}")
        in_hole_scope_area = MaterialArea(rect(6, 6, 7, 7),
                                          material=self.grass,
                                          parent_site=self.mainsite,
                                          id="{In hole area}")
        cleaner = SiteNodeGeometryCleaner(self.mainsite)

        cleaner.process_material_areas()

        self.assertIn("{Overlap area}", cleaner.erroneous_overlap)
        self.assertIn("{In hole area}", cleaner.ignored_features)
        self.assertTrue(cleaner.geom["{Grass area}"].equals(
            self.grass_area.shape))
Exemplo n.º 4
0
    def test_sorting_material_area_two_branches(self):
        site = SiteNode(rect(0, 0, 12, 12), id='{Main site}')
        cleaner = SiteNodeGeometryCleaner(self.mainsite)

        cleaner.process_material_areas()
        self.assertEqual(cleaner.check_issues_with_material_area_order(), [])