-
Notifications
You must be signed in to change notification settings - Fork 305
Expand file tree
/
Copy pathFormAnimation.cs
More file actions
89 lines (65 loc) · 2.56 KB
/
FormAnimation.cs
File metadata and controls
89 lines (65 loc) · 2.56 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using GeoAPI.Geometries;
using SharpMap.Layers;
using SharpMap.Data;
using SharpMap.Styles;
using SharpMap.Rendering.Thematics;
using BruTile.Web;
using System.IO;
using System.Drawing.Drawing2D;
using SharpMap.Data.Providers;
using System.Threading;
namespace WinFormSamples
{
public partial class FormAnimation : Form
{
public FormAnimation()
{
InitializeComponent();
this.SetStyle(ControlStyles.DoubleBuffer | ControlStyles.UserPaint | ControlStyles.AllPaintingInWmPaint, true);
this.UpdateStyles();
}
private void FormAnimation_Load(object sender, EventArgs e)
{
//Set up the countries layer
VectorLayer layCountries = new VectorLayer("Countries");
//Set the datasource to a shapefile in the App_data folder
layCountries.DataSource = new ShapeFile("GeoData/World/countries.shp", true);
//Set fill-style to green
layCountries.Style.Fill = new SolidBrush(Color.Green);
//Set the polygons to have a black outline
layCountries.Style.Outline = Pens.Black;
layCountries.Style.EnableOutline = true;
layCountries.SRID = 4326;
this.mapBox1.Map.Layers.Add(layCountries);
this.mapBox1.Map.ZoomToExtents();
this.mapBox1.Refresh();
}
private void Form2_SizeChanged(object sender, EventArgs e)
{
this.mapBox1.Refresh();
}
private void button1_Click(object sender, EventArgs e)
{
if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
{
var bb = this.mapBox1.Map.Envelope;
for (int i = 0; i < 50; i=i+5)
{
this.mapBox1.Map.ZoomToBox(new Envelope(bb.MinX - i, bb.MaxX + i, bb.MinY - i, bb.MaxY+ i));
this.mapBox1.Refresh();
Image image = mapBox1.Image;
image.Save(Path.Combine(this.folderBrowserDialog1.SelectedPath, "SaveSharpMapImage_" + i.ToString() + ".png"), System.Drawing.Imaging.ImageFormat.Png);
}
this.mapBox1.Map.ZoomToExtents();
this.mapBox1.Refresh();
}
}
}
}