Ejemplo n.º 1
0
 def test_multiple_points_multiple_lines(self):
     points = [
         Point(0, 1.5),
         Point(1, -1.5),
         Point(0.5, -2),  # checking interior points
         Point(2.5, 0.5),
         Point(0, -4),
         Point(0, -4),  # checking duplicates
     ]
     lines = [
         LineString([(0, 0), (0, 2)]),
         LineString([(1, -1), (1, 2)]),
         LineString([(0, 0), (0, -2), (0, -4)]),
         LineString([(1, 0), (2, 0)]),
     ]
     result = geometry_line.join_points_to_lines(points, lines)
     self.LinesEquivalent(
         result,
         [
             LineString([(0, 1.5), (0, 2)]),
             LineString([(1, -1.5), (1, -1)]),
             LineString([(0.5, -2),
                         (1, -1)]),  # interior points aren't used
             LineString([(2.5, 0.5), (2, 0)]),
             LineString([(0, -4), (0, -4)]),
             LineString([(0, -4), (0, -4)]),  # duplicates are fine
         ])
Ejemplo n.º 2
0
 def test_no_points_one_line(self):
     points = []
     lines = [LineString([(0, 0), (0, 1)])]
     result = geometry_line.join_points_to_lines(points, lines)
     self.PointsEqual(result, [])
Ejemplo n.º 3
0
 def test_one_point_two_lines_prioritizes_points(self):
     points = [Point(1, 0.5)]
     lines = [LineString([(0, 0), (0, 2)]), LineString([(1, -1), (1, 2)])]
     result = geometry_line.join_points_to_lines(points, lines)
     self.LinesEquivalent(result, [LineString([(1, 0.5), (0, 0)])])
Ejemplo n.º 4
0
 def test_no_points_no_lines(self):
     points = []
     lines = []
     result = geometry_line.join_points_to_lines(points, lines)
     self.PointsEqual(result, [])