-
Notifications
You must be signed in to change notification settings - Fork 12
/
painteraggform.pas
124 lines (97 loc) · 2.71 KB
/
painteraggform.pas
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
unit PainterAggForm;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, Menus, Math,
Agg2D, Agg2DControl,
OsMapTypes, OsMapGeometry, OsMapManager, Types;
type
{ TFormPainterAgg }
TFormPainterAgg = class(TForm)
Agg2DControl1: TAgg2DControl;
miTest1: TMenuItem;
PopupMenu1: TPopupMenu;
procedure Agg2DControl1MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Agg2DControl1MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure Agg2DControl1MouseWheel(Sender: TObject; Shift: TShiftState;
WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
procedure FormCreate(Sender: TObject);
procedure miTest1Click(Sender: TObject);
private
public
procedure AggTest1();
end;
var
FormPainterAgg: TFormPainterAgg;
implementation
{$R *.lfm}
uses
MainForm;
{ TFormPainterAgg }
procedure TFormPainterAgg.Agg2DControl1MouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ssShift in Shift then
begin
Form1.ShowObjectsAt(Form1.fseLon.Value, Form1.fseLat.Value);
end
else
Form1.btnShowClick(nil);
end;
procedure TFormPainterAgg.Agg2DControl1MouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
var
Coord: TGeoPoint;
begin
if Form1.MapManager.MapProjection.IsValid() then
begin
Form1.MapManager.MapProjection.PixelToGeo(X, Y, Coord);
Form1.fseLat.Value := Coord.Lat;
Form1.fseLon.Value := Coord.Lon;
end;
end;
procedure TFormPainterAgg.Agg2DControl1MouseWheel(Sender: TObject;
Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint;
var Handled: Boolean);
begin
Form1.FormMouseWheel(Sender, Shift, WheelDelta, MousePos, Handled);
end;
procedure TFormPainterAgg.FormCreate(Sender: TObject);
begin
Agg2DControl1.DoubleBuffered := True;
end;
procedure TFormPainterAgg.miTest1Click(Sender: TObject);
begin
AggTest1();
end;
procedure TFormPainterAgg.AggTest1();
var
vg: TAgg2D;
x, y: TReal;
begin
vg := Agg2DControl1.Agg2D;
// init font
vg.Font('Tahoma', 40, True, False, fcVector, 0);
vg.FlipText := True;
vg.ClearAll(255, 255, 255);
//vg.NoFill();
vg.FillColor.Initialize($FF, $00, $00, 255);
vg.LineColor.Initialize($FF, $FF, $FF, 255);
x := 40;
y := 70;
// letters
vg.Text(x, y, 'T');
x := x + 40;
vg.TextAngle := degtorad(10);
vg.Text(x, y, 'E');
x := x + 40;
vg.TextAngle := degtorad(20);
vg.Text(x, y, 'S');
x := x + 40;
vg.TextAngle := degtorad(30);
vg.Text(x, y, 'T');
Agg2DControl1.Invalidate();
end;
end.