コード例 #1
0
ファイル: seeyou_writer.py プロジェクト: GliderGeek/proSoar
def write_seeyou_task(fp, task, taskname=''):
    writer = Writer(fp)

    turnpoints = []

    for i, turnpoint in enumerate(task):
        if turnpoint.name == 'Free turnpoint':
            name = '{0:0=2d} '.format(i + 1) + turnpoint.name
        else:
            name = turnpoint.name

        writer.write_waypoint(
            name, '', '', float(turnpoint.lat), float(turnpoint.lon),
            turnpoint.altitude,
        )

        if i == 0 or i == len(task) - 1:
            turnpoints.append(name)

        turnpoints.append(name)

    writer.write_task(taskname, turnpoints)
    writer.write_task_options(
        task_time=datetime.timedelta(seconds=task.aat_min_time),
        waypoint_distance=(task.type != 'aat'),
        min_distance=True,
        random_order=False,
        max_points=task.max_points,
    )

    num_turnpoints = len(task)
    for i, turnpoint in enumerate(task):
        params = get_observation_zone_params(
            turnpoint.sector, i, num_turnpoints)
        writer.write_observation_zone(i, **params)
コード例 #2
0
ファイル: seeyou_writer.py プロジェクト: matejuh/proSoar
def write_seeyou_task(fp, task, taskname=''):
    writer = Writer(fp)

    turnpoints = []

    for i, turnpoint in enumerate(task):
        if turnpoint.name == 'Free turnpoint':
            name = '{0:0=2d} '.format(i + 1) + turnpoint.name
        else:
            name = turnpoint.name

        writer.write_waypoint(
            name,
            '',
            '',
            float(turnpoint.lat),
            float(turnpoint.lon),
            turnpoint.altitude,
        )

        if i == 0 or i == len(task) - 1:
            turnpoints.append(name)

        turnpoints.append(name)

    writer.write_task(taskname, turnpoints)
    writer.write_task_options(
        task_time=datetime.timedelta(seconds=task.aat_min_time),
        waypoint_distance=(task.type != 'aat'),
        min_distance=True,
        random_order=False,
        max_points=task.max_points,
    )

    num_turnpoints = len(task)
    for i, turnpoint in enumerate(task):
        params = get_observation_zone_params(turnpoint.sector, i,
                                             num_turnpoints)
        writer.write_observation_zone(i, **params)
コード例 #3
0
def test_write_line_with_latin1(output):
    writer = Writer(output, 'latin1')
    writer.fp = BytesIO()
    writer.write_line(u'Köln')
    assert writer.fp.getvalue() == b'K\xf6ln\r\n'
コード例 #4
0
def writer(output):
    return Writer(output)