Спутниковые программы [Сергей Вячеславович Хвощев глобус] (pdf) читать постранично, страница - 7
Книга в формате pdf! Изображения и текст могут не отображаться!
[Настройки текста] [Cбросить фильтры]
y_sr := y_sr / count;
for i := 1 to ListBox1.Items.count - 1 do
begin
x_sko := x_sko + sqr(ListBox1.Items[i].ToExtended - x_sr);
y_sko := y_sko + sqr(ListBox2.Items[i].ToExtended - y_sr);
end;
x_sko := sqrt(x_sko / count);
y_sko := sqrt(y_sko / count);
sko := sqrt(sqr(x_sko) + sqr(y_sko));
Label10.Text := Label10.Text + ' ' + FloatToStrF(sko,ffFixed,10,3);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
ListBox1.Items.Clear;
ListBox2.Items.Clear;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
IdTCPServer1.Active := true;
end;
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
s: string;
begin
Edit1.Text := AContext.Connection.Socket.ReadLn;
s := Edit1.Text;
_dx := Copy(s, 1, pos(' ', s) - 1);
delete(s, 1, pos(' ', s));
_dy := Copy(s, 1, Length(s));
Label7.Text := _dx;
Label8.Text := _dy;
dX := StrToFloat(_dx);
dY := StrToFloat(_dy);
end;
procedure TForm1.LocationSensor1LocationChanged(Sender: TObject;
const OldLocation, NewLocation: TLocationCoord2D);
begin
F1 := NewLocation.Latitude;
L1 := NewLocation.Longitude;
WGS_SK(F1, L1, 0);
SK_Pr(B, L);
x1 := x;
y1 := y;
Label1.Text := FloatToStr(x1);
Label2.Text := FloatToStr(y1);
Label3.Text := FloatToStr(x1 + dX);
Label4.Text := FloatToStr(y1 + dY);
ListBox1.Items.Add(Label3.Text);
ListBox2.Items.Add(Label4.Text);
end;
10. Еще вариант базы и ровера.
Ровер отправляет на базу
procedure TForm1.Button1Click(Sender: TObject);
begin
IdTCPClient1.Host := Edit1.Text;
IdTCPClient1.Port:=StrToInt(Edit2.Text);
IdTCPClient1.Connect;
Button2.Enabled := true;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
LocationSensor1.Active := true;
end;
procedure TForm1.Button4Click(Sender: TObject);
var
i: Integer;
sredneeX, sredneeY, skoX, skoY, sko: real;
ss, xx, yy: string;
count: Integer;
begin
sredneeX := 0;
sredneeY := 0;
skoX := 0;
skoY := 0;
count := Memo1.Lines.count;
Button4.Text := intToStr(count);
for i := 0 to Memo1.Lines.count - 1 do
begin
ss := Memo1.Lines[i];
xx := Copy(ss, 1, pos(' ', ss) - 1);
Trim(xx);
delete(ss, 1, pos(' ', ss));
yy := Copy(ss, 1, length(ss));
Trim(yy);
sredneeX := sredneeX + StrToFloat(xx);
sredneeY := sredneeY + StrToFloat(yy);
end;
sredneeX := sredneeX / count;
sredneeY := sredneeY / count;
for i := 0 to Memo1.Lines.count - 1 do
begin
ss := Memo1.Lines[i];
xx := Copy(ss, 1, pos(' ', ss) - 1);
Trim(xx);
delete(ss, 1, pos(' ', ss));
yy := Copy(ss, 1, length(ss));
Trim(yy);
skoX := skoX + sqr(StrToFloat(xx) - sredneeX);
skoY := skoY + sqr(StrToFloat(yy) - sredneeY);
end;
skoX := sqrt(skoX / count);
skoY := sqrt(skoY / count);
sko := sqrt(sqr(skoX) + sqr(skoY));
Label3.Text := FloatToStrF(sko, ffFixed, 10, 3);
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
Memo1.Lines.Clear;
end;
procedure TForm1.LocationSensor1LocationChanged(Sender: TObject;
const OldLocation, NewLocation: TLocationCoord2D);
begin
F1 := NewLocation.Latitude;
L1 := NewLocation.Longitude;
WGS_SK(F1, L1, 0);
SK_Pr(B, L);
x1 := x;
y1 := y;
Label1.Text := FloatToStr(x1);
Label2.Text := FloatToStr(y1);
IdTCPClient1.Socket.WriteLn(Label1.Text + ' ' + Label2.Text);
Memo1.Lines.Add(IdTCPClient1.Socket.ReadLn);
end;
На базе твердые координаты.
procedure TForm1.Button1Click(Sender: TObject);
begin
LocationSensor1.Active := true;
IdTCPServer1.DefaultPort:=StrToInt(Edit4.Text);
IdTCPServer1.Active := true;
end;
procedure TForm1.IdTCPServer1Execute(AContext: TIdContext);
var
s, _x, _y: string;
Xispr, Yispr: real;
begin
Edit1.Text := AContext.Connection.Socket.ReadLn;
s := Edit1.Text;
_x := Copy(s, 1, pos(' ', s) - 1);
delete(s, 1, pos(' ', s));
_y := Copy(s, 1, Length(s));
Xispr := StrToFloat(_x) + dX;
Yispr := StrToFloat(_y) + dY;
AContext.Connection.Socket.WriteLn(FloatToStrF(Xispr, ffFixed, 11, 3) + ' ' +
FloatToStrF(Yispr, ffFixed, 11, 3));
end;
procedure TForm1.LocationSensor1LocationChanged(Sender: TObject;
const OldLocation, NewLocation: TLocationCoord2D);
begin
F1 := NewLocation.Latitude;
L1 := NewLocation.Longitude;
WGS_SK(F1, L1, 0);
SK_Pr(B, L);
x1 := x;
y1 := y;
Label1.Text := FloatToStr(x1);
Label2.Text := FloatToStr(y1);
dX := StrToFloat(Edit2.Text) - x1;
dY := StrToFloat(Edit3.Text) - y1;
Memo1.Lines.Add(FloatToStrF(dX, ffFixed, 11, 3) + ' ' + FloatToStrF(dY,
ffFixed, 11, 3));
end;
Исправляет координаты и отправляет клиенту на ровер.
Последние комментарии
4 часов 54 минут назад
5 часов 31 минут назад
1 день 19 часов назад
1 день 21 часов назад
2 дней 12 часов назад
2 дней 12 часов назад