# Path: prosoar/waypoints/list.py
# class WaypointList:
# 
#     def __init__(self):
#         self.__list = []
# 
#     def __len__(self):
#         return len(self.__list)
# 
#     def __getitem__(self, i):
#         if i < 0 or i > len(self):
#             return None
#         return self.__list[i]
# 
#     def __iter__(self):
#         return iter(self.__list)
# 
#     def append(self, wp):
#         if not isinstance(wp, Waypoint):
#             raise TypeError("Waypoint expected")
# 
#         self.__list.append(wp)
# 
#     def extend(self, wp_list):
#         if not isinstance(wp_list, WaypointList):
#             raise TypeError("WaypointList expected")
# 
#         self.__list.extend(wp_list)
# 
#     def get_bounds(self, offset_distance=15.):
#         rc = GeoRect(180, -180, -90, 90)
#         for wp in self.__list:
#             rc.left = min(rc.left, wp.lon)
#             rc.right = max(rc.right, wp.lon)
#             rc.top = max(rc.top, wp.lat)
#             rc.bottom = min(rc.bottom, wp.lat)
# 
#         rc.expand(offset_distance)
#         return rc


from prosoar.waypoints.list import WaypointList


def __compose_line(waypoint):
    # "Aachen Merzbruc",AACHE,DE,5049.383N,00611.183E,189.0m,5,80,530.0m,"122.875",
    str = '"' + waypoint.name + '",'
    str += waypoint.short_name + ','
    str += waypoint.country_code + ','

    lat = abs(waypoint.lat)
    str += "{0:02d}".format(int(lat))
    lat = round((lat - int(lat)) * 60, 3)
    str += "{0:06.3f}".format(lat)
    if waypoint.lat > 0:
        str += 'N,'
    else:
        str += 'S,'

    lon = abs(waypoint.lon)
    str += "{0:03d}".format(int(lon))
    lon = round((lon - int(lon)) * 60, 3)

# Path: prosoar/waypoints/list.py
# class WaypointList:
# 
#     def __init__(self):
#         self.__list = []
# 
#     def __len__(self):
#         return len(self.__list)
# 
#     def __getitem__(self, i):
#         if i < 0 or i > len(self):
#             return None
#         return self.__list[i]
# 
#     def __iter__(self):
#         return iter(self.__list)
# 
#     def append(self, wp):
#         if not isinstance(wp, Waypoint):
#             raise TypeError("Waypoint expected")
# 
#         self.__list.append(wp)
# 
#     def extend(self, wp_list):
#         if not isinstance(wp_list, WaypointList):
#             raise TypeError("WaypointList expected")
# 
#         self.__list.extend(wp_list)
# 
#     def get_bounds(self, offset_distance=15.):
#         rc = GeoRect(180, -180, -90, 90)
#         for wp in self.__list:
#             rc.left = min(rc.left, wp.lon)
#             rc.right = max(rc.right, wp.lon)
#             rc.top = max(rc.top, wp.lat)
#             rc.bottom = min(rc.bottom, wp.lat)
# 
#         rc.expand(offset_distance)
#         return rc


# Path: prosoar/waypoints/seeyou_writer.py
from prosoar.waypoints.list import WaypointList



def __compose_line(waypoint):
    # "Aachen Merzbruc",AACHE,DE,5049.383N,00611.183E,189.0m,5,80,530.0m,"122.875",
    str = '"' + waypoint.name + '",'
    str += waypoint.short_name + ','
    str += waypoint.country_code + ','

    lat = abs(waypoint.lat)
    str += "{0:02d}".format(int(lat))
    lat = round((lat - int(lat)) * 60, 3)
    str += "{0:06.3f}".format(lat)
    if waypoint.lat > 0:
        str += 'N,'
    else:
        str += 'S,'

    lon = abs(waypoint.lon)
    str += "{0:03d}".format(int(lon))
    lon = round((lon - int(lon)) * 60, 3)

    str += "{0:06.3f}".format(lon)