Ejemplo n.º 1
0
 def add_point_test(self):
     """Test adding regular points to a Way."""
     first = (0.0, 0.0, 0.0)
     second = (1.0, 1.0, 100.0)
     third = (2.0, 2.0, 200.0)
     lle_list = [first, second, third]
     way = Way(points=lle_list)
     way.add_point(Point(lat=50.0, lon=50.0, elevation=300.0))
     self.assertEqual(way.point_count, 4)
     self.assertListEqual(way.points_lle,
                          [first, second, third, (50.0, 50.0, 300.0)])
     way.add_point_lle(100.0, 100.0, 600.0)
     self.assertEqual(way.point_count, 5)
     self.assertListEqual(
         way.points_lle,
         [first, second, third, (50.0, 50.0, 300.0), (100.0, 100.0, 600.0)])
     self.assertEqual(
         way.get_point_by_index(-1).getLLE(), (100.0, 100.0, 600.0))
Ejemplo n.º 2
0
 def radians_test(self):
     """Test that radians values for Way points are correct."""
     # create way with some regular points
     first = (0.0, 0.0, 0.0)
     second = (1.0, 1.0, 100.0)
     lle_list = [first, second]
     way = Way(points=lle_list)
     # check the radian output
     radians_list = [(0.0, 0.0, 0.0),
                     (0.017453292519943295, 0.017453292519943295, 100.0)]
     self.assertListEqual(way.points_radians_lle, radians_list)
     self.assertListEqual(way.points_radians_ll,
                          list(map(lambda x: (x[0], x[1]), radians_list)))
     # add some more points
     way.add_point(Point(lat=3.0, lon=3.0, elevation=200.0))
     way.add_point_lle(5.0, 5.0, 300.0)
     radians_list.extend([(0.05235987755982989, 0.05235987755982989, 200.0),
                          (0.08726646259971647, 0.08726646259971647, 300.0)
                          ])
     # check again
     self.assertListEqual(way.points_radians_lle, radians_list)
     self.assertListEqual(way.points_radians_ll,
                          list(map(lambda x: (x[0], x[1]), radians_list)))