示例#1
0
def test_copy_back_to_fore(output_dir):

    mc = MapCanvas((400, 300), preset_colors='web')

    mc.background_color = 'white'
    mc.clear_background()
    mc.clear_foreground()

    mc.draw_polyline(((-30, 30),
                      (30, 30),
                      (30, -20),
                      (-30, -20)),
                     line_color='red',
                     line_width=5,
                     background=True)

    mc.copy_back_to_fore()
    mc.draw_polyline(((-20, 20),
                      (20, 20),
                      (20, -10),
                      (-20, -10)),
                     line_color='blue',
                     line_width=5,
                     background=False)

    mc.save_foreground(os.path.join(output_dir, "copy_back_to_fore.png"))
示例#2
0
def test_foreground_polyline(output_dir):
    """
    test drawing polygons to the background
    """
    mc = MapCanvas((400, 300), preset_colors='web')

    mc.background_color = 'transparent'
    mc.clear_background()

    mc.draw_polyline(((-30, 30), (30, 30), (30, -20), (-30, -20)),
                     line_color='red',
                     line_width=5,
                     background=False)

    mc.save_foreground(os.path.join(output_dir, "foreground_polyline.png"))
示例#3
0
def test_foreground_poly(output_dir):
    """
    test drawing polygons to the foreground
    """
    mc = MapCanvas((400, 300), preset_colors='web')

    mc.background_color = 'transparent'
    mc.clear_background()

    mc.draw_polygon(((-30, 30), (30, 30), (30, -20), (-30, -20)),
                    fill_color='white',
                    line_color='black',
                    background=False)

    mc.save_foreground(os.path.join(output_dir, "foreground.png"))
示例#4
0
def test_foreground_polyline(output_dir):
    """
    test drawing polygons to the background
    """
    mc = MapCanvas((400, 300), preset_colors='web')

    mc.background_color = 'transparent'
    mc.clear_background()

    mc.draw_polyline(((-30, 30),
                      (30, 30),
                      (30, -20),
                      (-30, -20)),
                     line_color='red',
                     line_width=5,
                     background=False)

    mc.save_foreground(os.path.join(output_dir, "foreground_polyline.png"))
示例#5
0
def test_foreground_poly(output_dir):
    """
    test drawing polygons to the foreground
    """
    mc = MapCanvas((400, 300), preset_colors='web')

    mc.background_color = 'transparent'
    mc.clear_background()

    mc.draw_polygon(((-30, 30),
                     (30, 30),
                     (30, -20),
                     (-30, -20)),
                    fill_color='white',
                    line_color='black',
                    background=False)

    mc.save_foreground(os.path.join(output_dir, "foreground.png"))
示例#6
0
def test_copy_back_to_fore(output_dir):

    mc = MapCanvas((400, 300), preset_colors='web')

    mc.background_color = 'white'
    mc.clear_background()
    mc.clear_foreground()

    mc.draw_polyline(((-30, 30), (30, 30), (30, -20), (-30, -20)),
                     line_color='red',
                     line_width=5,
                     background=True)

    mc.copy_back_to_fore()
    mc.draw_polyline(((-20, 20), (20, 20), (20, -10), (-20, -10)),
                     line_color='blue',
                     line_width=5,
                     background=False)

    mc.save_foreground(os.path.join(output_dir, "copy_back_to_fore.png"))
示例#7
0
def test_projection(output_dir):
    """
    draw the "same sized" rectangle at three latitudes to see how the look
    """
    mc = MapCanvas((400, 400), preset_colors='web')

    mc.viewport = ((-20, 25), (20, 65))
    mc.draw_polygon(((-15, 60), (15, 60), (15, 30), (-15, 30)),
                    fill_color='maroon',
                    line_color='black')

    mc.save_foreground(os.path.join(output_dir, "image_projection_north.png"))

    mc.viewport = ((-20, -20), (20, 20))
    mc.draw_polygon(((-15, 15), (15, 15), (15, -15), (-15, -15)),
                    fill_color='maroon',
                    line_color='black')

    mc.save_foreground(os.path.join(output_dir,
                                    "image_projection_equator.png"))

    mc.viewport = ((-20, -45), (20, -90))
    mc.draw_polygon(((-15, -80), (15, -80), (15, -50), (-15, -50)),
                    fill_color='maroon',
                    line_color='black')

    mc.save_foreground(os.path.join(output_dir, "image_projection_south.png"))
示例#8
0
def test_projection(output_dir):
    """
    draw the "same sized" rectangle at three latitudes to see how the look
    """
    mc = MapCanvas((400, 400), preset_colors='web')

    mc.viewport = ((-20, 25), (20, 65))
    mc.draw_polygon(((-15, 60),
                     (15, 60),
                     (15, 30),
                     (-15, 30)),
                    fill_color='maroon',
                    line_color='black')

    mc.save_foreground(os.path.join(output_dir, "image_projection_north.png"))

    mc.viewport = ((-20, -20), (20, 20))
    mc.draw_polygon(((-15, 15),
                     (15, 15),
                     (15, -15),
                     (-15, -15)
                     ),
                    fill_color='maroon',
                    line_color='black')

    mc.save_foreground(os.path.join(output_dir,
                                    "image_projection_equator.png"))

    mc.viewport = ((-20, -45), (20, -90))
    mc.draw_polygon(((-15, -80),
                     (15, -80),
                     (15, -50),
                     (-15, -50)),
                    fill_color='maroon',
                    line_color='black')

    mc.save_foreground(os.path.join(output_dir, "image_projection_south.png"))