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"))
def test_foreground_poly(output_dir): """ test drawing polygons to the background """ 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"))
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"))
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"))