-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSEMA.cs
190 lines (147 loc) · 5.48 KB
/
SEMA.cs
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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using GMap.NET;
using GMap.NET.WindowsForms;
using GMap.NET.WindowsForms.Markers;
using GMap.NET.MapProviders;
using System.Drawing.Drawing2D;
namespace SemaInterface
{
public partial class Sema : Form
{
public Sema()
{
InitializeComponent();
this.KeyPreview = true;
this.KeyPress += (ss, ee) =>
{
if (ee.KeyChar == 27) //= escape
{
Environment.Exit(1);
}
};
}
Point İlkkonum; // Bu değişkenler Global olarak tanımlanmalı.
bool durum = false;
private void tabL_MouseDown(object sender, MouseEventArgs e)
{
// Mouse a tıklandığı anda. Burada sol yada sağ tıklanması farketmeyecektir.
durum = true;
this.Cursor = Cursors.SizeAll; // Fareyi taşıma şeklinde seçim yapılmış ikon halini almasını sağladık.
İlkkonum = e.Location; /* İlk konum olarak fareye tam basıldığında e parametresinin Location özelliğini
* kullanarak konum aldık. X ve Y koordinatlarını almış olduk.*/
}
private void tabL_MouseUp(object sender, MouseEventArgs e)
{
// Mouse'u bıraktığımızda çalışacak kodlar.
durum = false;
this.Cursor = Cursors.Default; // Fare işaretçisi Default halini aldı.
}
private void tabL_MouseMove(object sender, MouseEventArgs e)
{
// Mouse'u hareket ettirdiğimizde çalışacak kodlar.
if (durum)
{
this.Left = e.X + this.Left - (İlkkonum.X);
this.Top = e.Y + this.Top - (İlkkonum.Y);
}
}
private Bitmap rotateImage90(int c,Bitmap b)
{
Bitmap returnBitmap = new Bitmap(b.Height, b.Width);
Graphics g = Graphics.FromImage(returnBitmap);
g.TranslateTransform((float)b.Width / 2, (float)b.Height / 2);
g.RotateTransform(c);
g.TranslateTransform(-(float)b.Width / 2, -(float)b.Height / 2);
g.DrawImage(b, new Point(0, 0));
return returnBitmap;
}
private void Sema_Load(object sender, EventArgs e)
{
trackBar1.Maximum = 91;
trackBar1.Minimum = -91;
map.MapProvider = GMap.NET.MapProviders.GMapProviders.GoogleHybridMap;
map.Position = new GMap.NET.PointLatLng(40.23, 27.34);
map.MinZoom = 5;
map.MaxZoom = 100;
map.Zoom = 10;
map.DragButton = MouseButtons.Left;
GMap.NET.PointLatLng point = new GMap.NET.PointLatLng(40.23, 27.34);
GMapOverlay markers = new GMapOverlay("markers");
Bitmap original = (Bitmap)Image.FromFile("C:/Users/aeker/source/repos/Interface/Resources/uav.png");
Bitmap resized = new Bitmap(original, new Size(original.Width / 10, original.Height / 10));
GMapMarker marker = new GMarkerGoogle(
new PointLatLng(40.23, 27.34),
resized);
markers.Markers.Add(marker);
map.Overlays.Add(markers);
resized = rotateImage90(0, resized);
}
private void tab_MouseDoubleClick(object sender, MouseEventArgs e)
{
WindowState = (WindowState == FormWindowState.Normal ? FormWindowState.Maximized : FormWindowState.Normal);
}
private void buttonFPV_Click(object sender, EventArgs e)
{
}
private void buttonPFD_Click(object sender, EventArgs e)
{
}
private void buttonSensors_Click(object sender, EventArgs e)
{
}
private void buttonPlaneData_Click(object sender, EventArgs e)
{
}
private void buttonMap_Click(object sender, EventArgs e)
{
}
private void elementHost1_ChildChanged(object sender, System.Windows.Forms.Integration.ChildChangedEventArgs e)
{
}
private void trackBar1_Scroll(object sender, EventArgs e)
{
roll1.Rotate();
height1.Translate();
yaw1.Rotate();
pitch1.Rotate();
speed1.Rotate();
pitch1.pointerValue = trackBar1.Value;
yaw1.pointerValue = trackBar1.Value;
height1.pointerValue = 90+trackBar1.Value;
roll1.pointerValue = trackBar1.Value;
speed1.pointerValue = trackBar1.Value;
}
private void panelPlaneData_Paint(object sender, PaintEventArgs e)
{
}
private void tableLayoutPanel2_Paint(object sender, PaintEventArgs e)
{
}
private void tableLayoutPanel3_Paint(object sender, PaintEventArgs e)
{
}
private void tableLayoutPanel1_Paint(object sender, PaintEventArgs e)
{
}
private void guna2Button3_Click(object sender, EventArgs e)
{
}
private void tableLayoutPanel4_Paint(object sender, PaintEventArgs e)
{
}
private void map_Load(object sender, EventArgs e)
{
}
private void tabL_Paint(object sender, PaintEventArgs e)
{
}
}
}