-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainForm.pas
2933 lines (2447 loc) · 85.1 KB
/
MainForm.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
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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
unit MainForm;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Grids, ValEdit, Buttons, Spin, ComCtrls, XPMan,
Menus, LangLoader, Geoid, jpeg, OutputPlus, ComObj;
type
TForm1 = class(TForm)
Button6: TButton;
Button3: TButton;
StringGrid1: TStringGrid;
Panel1: TPanel;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Edit4: TEdit;
Edit5: TEdit;
Edit6: TEdit;
Edit7: TEdit;
Edit8: TEdit;
Button4: TButton;
Button1: TButton;
Button2: TButton;
Edit9: TEdit;
Edit10: TEdit;
Button10: TButton;
Label6: TLabel;
StringGrid2: TStringGrid;
SpeedButton1: TSpeedButton;
SpeedButton2: TSpeedButton;
SpeedButton3: TSpeedButton;
SpeedButton4: TSpeedButton;
SpeedButton5: TSpeedButton;
SpeedButton6: TSpeedButton;
SpeedButton7: TSpeedButton;
ListBox3: TListBox;
Button5: TButton;
Label8: TLabel;
Button7: TButton;
Label9: TLabel;
StatusBar1: TStatusBar;
Label10: TLabel;
CheckBox3: TCheckBox;
PageControl1: TPageControl;
TabSheet1: TTabSheet;
Label5: TLabel;
Label7: TLabel;
RadioGroup1: TRadioGroup;
ListBox1: TComboBox;
ListBox2: TComboBox;
RadioGroup2: TRadioGroup;
SpinEdit1: TSpinEdit;
CheckBox1: TCheckBox;
CheckBox2: TCheckBox;
SpinEdit2: TSpinEdit;
OpenDialog1: TOpenDialog;
SaveDialog1: TSaveDialog;
TabSheet2: TTabSheet;
Shape1: TShape;
ListBox4: TListBox;
ComboBox1: TComboBox;
ListBox5: TListBox;
ComboBox2: TComboBox;
Button8: TButton;
ProgressBar1: TProgressBar;
ProgressBar2: TProgressBar;
PopupMenu1: TPopupMenu;
N1: TMenuItem;
PopupMenu2: TPopupMenu;
MenuItem1: TMenuItem;
PopupMenu3: TPopupMenu;
PopupMenu4: TPopupMenu;
N2: TMenuItem;
N3: TMenuItem;
Button9: TButton;
Label11: TLabel;
RS: TRadioGroup;
LangBox: TComboBox;
PopupMenu5: TPopupMenu;
P5N1: TMenuItem;
N4: TMenuItem;
N5: TMenuItem;
Geoid1: TComboBox;
Geoid2: TComboBox;
Label12: TLabel;
SpeedButton8: TSpeedButton;
SpeedButton9: TSpeedButton;
Label13: TLabel;
Panel2: TPanel;
Image1: TImage;
MainMenu1: TMainMenu;
N6: TMenuItem;
N7: TMenuItem;
N8: TMenuItem;
N9: TMenuItem;
N10: TMenuItem;
N11: TMenuItem;
N12: TMenuItem;
N13: TMenuItem;
N14: TMenuItem;
N15: TMenuItem;
N16: TMenuItem;
N19: TMenuItem;
N20: TMenuItem;
N21: TMenuItem;
N17: TMenuItem;
N18: TMenuItem;
N22: TMenuItem;
N23: TMenuItem;
N24: TMenuItem;
N25: TMenuItem;
N26: TMenuItem;
N27: TMenuItem;
N28: TMenuItem;
Panel3: TPanel;
ComboBox3: TComboBox;
ShowLitera: TCheckBox;
RS1: TRadioButton;
RS2: TRadioButton;
CheckBox4: TCheckBox;
Bevel1: TBevel;
ComboBox4: TComboBox;
SpeedButton10: TSpeedButton;
N29: TMenuItem;
ComboBox5: TComboBox;
ComboBox6: TComboBox;
Panel4: TPanel;
procedure RenameTabs(StringGrid:TStringGrid; TabNameStyle:byte);
procedure ClearGrid(StringGrid:TStringGrid);
procedure TabStringGrid(StringGrid:TStringGrid);
procedure DelStringGrid(StringGrid:TStringGrid);
procedure OpenTable(StringGrid:TStringGrid; S:TStringList);
procedure SaveTable(StringGrid:TStringGrid; FileName: String; FileType:byte);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure ListBox1Click(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure ListBox2Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure RadioGroup1Click(Sender: TObject);
procedure RadioGroup2Click(Sender: TObject);
procedure SpeedButton7Click(Sender: TObject);
procedure StringGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure SpeedButton5Click(Sender: TObject);
procedure SpeedButton6Click(Sender: TObject);
procedure StringGrid2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
procedure FormCreate(Sender: TObject);
procedure SpeedButton1Click(Sender: TObject);
procedure SpeedButton4Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure CheckBox2Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure SpeedButton2Click(Sender: TObject);
procedure SpeedButton3Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure ListBox3Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Init;
procedure ReInit;
procedure PageControl1Change(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure ComboBox1Change(Sender: TObject);
procedure ComboBox2Change(Sender: TObject);
procedure ListBox4Click(Sender: TObject);
procedure ListBox5Click(Sender: TObject);
procedure ComboBox3Change(Sender: TObject);
procedure N1Click(Sender: TObject);
procedure MenuItem1Click(Sender: TObject);
procedure N2Click(Sender: TObject);
procedure N3Click(Sender: TObject);
procedure ListBox4MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure ListBox5MouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure OnShowHint(var HintStr: string;
var CanShow: Boolean; var HintInfo: THintInfo);
procedure Button9Click(Sender: TObject);
procedure RSClick(Sender: TObject);
procedure LangBoxChange(Sender: TObject);
procedure RS1Click(Sender: TObject);
procedure RS2Click(Sender: TObject);
procedure N4Click(Sender: TObject);
procedure N5Click(Sender: TObject);
procedure SpeedButton8Click(Sender: TObject);
procedure SpeedButton9Click(Sender: TObject);
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure StringGrid2DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
procedure N15Click(Sender: TObject);
procedure N16Click(Sender: TObject);
procedure N20Click(Sender: TObject);
procedure N21Click(Sender: TObject);
procedure N26Click(Sender: TObject);
procedure N14Click(Sender: TObject);
procedure N22Click(Sender: TObject);
procedure N23Click(Sender: TObject);
procedure N19Click(Sender: TObject);
procedure FormShow(Sender: TObject);
procedure ComboBox4Change(Sender: TObject);
procedure FindWGS;
procedure SpeedButton10Click(Sender: TObject);
// procedure CMDialogKey(var Msg: TWMKey);
// message CM_DIALOGKEY;
private
{ Private declarations }
public
procedure FindCat(Cat:String; ListBox:TListBox);
procedure XlsToTXT(XLSFile:string);
public
MyDir: String;
CanLoad : boolean;
OpenFileName:String;
{ Public declarations }
end;
var
Form1: TForm1;
Inited: Boolean = false;
DMSMode: Integer = 0;
Psz: Integer = -1; Psh: Integer = -1; Psbl: Integer = -1;
HintX,HintY : integer;
EdMode :Boolean = false;
implementation
uses GeoFunctions, GeoClasses, GeoFiles, GeoString, Unit2, Unit3, Unit4,
Unit6, Unit7, Unit5, LocFm, Unit8, Unit9;
{$R *.dfm}
procedure TForm1.XlsToTXT(XLSFile:string);
const
xlCellTypeLastCell = $0000000B;
var
ExlApp, Sheet: OLEVariant;
i, j, r, c:integer;
S: TStringList; str:String;
begin
ExlApp := CreateOleObject('Excel.Application');
ExlApp.Visible := false;
ExlApp.Workbooks.Open(XLSFile);
Sheet := ExlApp.Workbooks[ExtractFileName(XLSFile)].WorkSheets[1];
Sheet.Cells.SpecialCells(xlCellTypeLastCell, EmptyParam).Activate;
r := ExlApp.ActiveCell.Row;
c := ExlApp.ActiveCell.Column;
S := TStringList.Create;
S.Add('');
for j:= 1 to r do
begin
S.Add('');
for i:= 1 to c do
try
if sheet.cells[j,i].text <> '' then
str := sheet.cells[j,i].text + #$9
else
str := ' '+ #$9;
S[S.Count-1] := S[S.Count-1] + str;
except
end;
end;
ExlApp.Quit;
ExlApp := Unassigned;
Sheet := Unassigned;
S.SaveToFile('Data\Temp.txt');
S.Free;
end;
function GetCols(str, sep: string; ColN, ColCount:integer; ChangeSep:Boolean): string;
var j,stl,b :integer;
begin
Result:='';
stl:=0;
b:=1;
for j:=1 to length(Str)+1 do
Begin
if ((copy(Str,j,1)=sep)or(j=length(Str)+1))and(copy(Str,j-1,1)<>sep) then
begin
if (stl>=ColN) and (Stl<ColN+ColCount) then
Begin
if result='' then
Result:=(Copy(Str,b,j-b))
else
Result:=Result+' '+(Copy(Str,b,j-b));
End;
inc(stl);
b:=j+1;
if stl>ColN+ColCount then
break;
end;
End;
if ChangeSep then
Begin
if result <> '' then
for j:= 1 to length(Result)+1 do
if ((Result[j] = '.') or (Result[j] = ','))and(Result[j]<>sep) then
Result[j] := DecimalSeparator;
End;
end;
function ReplaceCols(str, sep: string; ColN, ColCount:integer; newcol:string): string;
var j,stl,b, s1, s2 :integer;
begin
Result:='';
stl:=0;
b:=1;
s1 := -1;
for j:=1 to length(Str)+1 do
Begin
if ((copy(Str,j,1)=sep)or(j=length(Str)+1))and(copy(Str,j-1,1)<>sep) then
begin
if (stl>=ColN) and (Stl<ColN+ColCount) then
Begin
if s1 = -1 then
s1 := b;
s2 := j-s1;
{ if result='' then
Result:=(Copy(Str,b,j-b))
else
Result:=Result+' '+(Copy(Str,b,j-b));}
End;
inc(stl);
b:=j+1;
if stl>ColN+ColCount then
break;
end;
End;
if s1 <> -1 then
Begin
Delete(Str, s1, s2); //Delete(Str,s1,s2);
Insert(NewCol,Str,s1);
End;
result := Str;
{ if result <> '' then
for j:= 1 to length(Result)+1 do
if ((Result[j] = '.') or (Result[j] = ','))and(Result[j]<>sep) then
Result[j] := DecimalSeparator;}
end;
procedure TForm1.Button1Click(Sender: TObject);
var SK1, SK2 : Integer;
zone : Integer;
b1, l1, b2, l2, h2, h1, x, y: Double;
South : boolean;
begin
SK1 := FindDatum('WGS84');
SK2 := FindDatum('SK42');
Label6.Caption := IntToStr(Sk1)+' '+ IntTostr(Sk2);
b1 := StrToLatLon(edit1.text, true);
l1 := StrToLatLon(edit2.text, false);
South := b1 < 0;
CheckBox3.Checked := South;
h1 := StrToFloat2(edit5.text);
Label4.Caption := FloatToStr(b1)+' '+ FloatToStr(l1);
Geo1ToGeo2(b1, l1, h1, SK1, SK2, b2, l2, h2);
Edit3.Text := DegToDMS(b2, true, DMSMode, not ShowLitera.Checked, psz) ; // NEW 25.06
Edit4.Text := DegToDMS(l2, false, DMSMode, not ShowLitera.Checked, psz) ; // NEW 25.06
Edit6.Text := format('%3f',[h2]) ;
Label1.Caption := Degtodms(b2, DMSMode)+' '+ Degtodms(l2,DMSMode) +' '+format('%.3f',[h2]);
GeoToGaussKruger(SK2, b2,l2,x,y,zone,true);
Label2.Caption := format('Gauss '+ '%3f',[x])+' '+ format('%3f',[y])+' ' + format('%3f',[h2]);
Edit7.Text := format('%3f',[x]) ;
Edit8.Text := format('%3f',[y]) ;
GeoToUTM (Sk1, b1, l1, (b1<0), x, y, zone,true);
Label3.Caption := 'UTM '+ format('%3f',[y])+' '+ format('%3f',[x])+' ' + format('%3f',[h2])+ ' '+ IntTostr(Zone);
Edit9.Text := FloatTostr(x) ;
Edit10.Text := FloatTostr(y) ;
end;
procedure TForm1.Button2Click(Sender: TObject);
var SK1, SK2 : Integer;
b1, l1, b2, l2, h2, h1 : Double;
begin
SK1 := FindDatum('WGS84');
SK2 := FindDatum('SK42');
Label6.Caption := IntToStr(Sk1)+' '+ IntTostr(Sk2);
b1 := StrToLatLon(edit3.text, true);
l1 := StrToLatLon(edit4.text, false);
h1 := StrToFloat2(edit6.text);
Geo1ToGeo2(b1, l1, h1, SK2, SK1, b2, l2, h2);
Label1.Caption := Degtodms(b2, DMSMode)+' '+ Degtodms(l2, DMSMode) +' '+format('%.3f',[h2]);
Edit1.Text := Degtodms(b2, true, DMSMode, not ShowLitera.Checked, psz); /// NEW 25.06
Edit2.Text := Degtodms(l2, false, DMSMode, not ShowLitera.Checked, psz);
Edit5.Text := format('%.3f',[h2]);
end;
procedure TForm1.Button10Click(Sender: TObject);
var SK1 : Integer;
b1, l1, h1, xx,yy : Double;
begin
SK1 := FindDatum('WGS84');
Label6.Caption := IntToStr(Sk1);
xx := StrToFloat2(edit9.text);
yy := StrToFloat2(edit10.text);
h1 := StrToFloat2(edit5.text);
UTMToGeo(SK1,xx,yy,CheckBox3.Checked,b1,l1);
Label1.Caption := Degtodms(b1, DMSMode)+' '+ Degtodms(l1, DMSMode) +' '+format('%.3f',[h1]);
Edit1.Text := Degtodms(b1, true, DMSMode, not ShowLitera.Checked);
Edit2.Text := Degtodms(l1, false, DMSMode, not ShowLitera.Checked);
Edit5.Text := FloatToStr(h1);
end;
procedure TForm1.ListBox1Click(Sender: TObject);
var i, j :integer;
begin
if ListBox1.ItemIndex>=0 then
Begin
i:= FindDatumByCaption(ListBox1.Items[ListBox1.ItemIndex]);
if i=-1 then
exit;
RadioGroup1.ItemIndex := 0;
RadioGroup1.Buttons[2].Enabled := false;
RadioGroup1.Buttons[3].Enabled := false;
RadioGroup1.Buttons[4].Enabled := false;
for j:=0 to length(DatumList[i].Projections)-1 Do
begin
if DatumList[i].Projections[j]='Gauss' then
RadioGroup1.Buttons[2].Enabled := true;
if DatumList[i].Projections[j]='UTM' then
begin
RadioGroup1.Buttons[3].Enabled := true;
RadioGroup1.Buttons[4].Enabled := true;
end;
end;
{ Memo1.clear;
Memo1.Lines.Add(DatumList[i].Name);
Memo1.Lines.Add(DatumList[i].Caption);
Memo1.Lines.Add('');
Memo1.Lines.Add('Ýëëèïñîèä:');
//Memo1.Lines.Add(DatumList[i].Ellipsoid.name);
Memo1.Lines.Add(DatumList[i].Ellipsoid.Caption);
Memo1.Lines.Add('');
Memo1.Lines.Add('Ñâÿçü ñ:'); }
{ For j := 0 to Length(DatumList[i].ConvertData)-1 do
Begin
//Memo1.Lines.Add(DatumList[i].ConvertData[j].ConvertDatumName);
k := FindDatum(DatumList[i].ConvertData[j].ConvertDatumName);
if k<>-1 then
ListBox2.Items.Add(DatumList[k].Caption);
End;
/// ÏÎÈÑÊ ÑÂßÇÀÍÍÛÕ ÑÊ
for l := 0 to Length(DatumList)-1 do
for m := 0 to Length(DatumList[l].ConvertData)-1 do
if DatumList[l].ConvertData[m].ConvertDatumName = DatumList[i].Name then
begin
AlreadyHas := false;
for k:= 0 to ListBox2.Items.Count-1 do
if DatumList[l].Caption = ListBox2.Items[k] then
begin
AlreadyHas :=true;
break;
end;
if not AlreadyHas then
ListBox2.Items.Add(DatumList[l].Caption);
end;
ListBox2.OnChange(nil); }
End;
end;
procedure TForm1.FormActivate(Sender: TObject);
var I:Integer;
begin
if not Inited then
Try
Repaint;
Init;
LoadLang(True);
//SaveLngs;
ReInit;
Repaint;
for I := 0 to LangBox.Items.Count do
if LangBox.Items[I] = Lang then
Begin
LangBox.ItemIndex := I;
break;
End;
if EdMode then
begin
form9.showmodal;
end;
Finally
Panel2.Hide;
FindWGS;
End;
end;
procedure TForm1.ListBox2Click(Sender: TObject);
var i, j :integer;
begin
if ListBox2.ItemIndex>=0 then
Begin
i:= FindDatumByCaption(ListBox2.Items[ListBox2.ItemIndex]);
RadioGroup2.ItemIndex := 0;
RadioGroup2.Buttons[2].Enabled := false;
RadioGroup2.Buttons[3].Enabled := false;
RadioGroup2.Buttons[4].Enabled := false;
for j:=0 to length(DatumList[i].Projections)-1 Do
begin
if DatumList[i].Projections[j]='Gauss' then
RadioGroup2.Buttons[2].Enabled := true;
if DatumList[i].Projections[j]='UTM' then
begin
RadioGroup2.Buttons[3].Enabled := true;
RadioGroup2.Buttons[4].Enabled := true;
end;
end;
End;
end;
procedure TForm1.Button4Click(Sender: TObject);
var S, S2 : TStringList;
i:integer;
begin
S:= TStringList.Create;
S2:= TStringList.Create;
S.LoadFromFile('Test3.txt');
for i:= 0 to S.count-1 do
Begin
Edit1.Text := GetCols(s[i],';',1,1,true);
Edit2.Text := GetCols(s[i],';',2,1,true);
Edit5.Text := GetCols(s[i],';',3,1,true);
Button1.OnClick(nil);
S2.Add(GetCols(s[i],';',0,1,true)+' '+label2.Caption);
end;
S2.SaveToFile('TestRes3.txt');
S.Destroy;
S2.Destroy;
end;
procedure TForm1.RadioGroup1Click(Sender: TObject);
begin
RenameTabs(StringGrid1,RadioGroup1.ItemIndex);
if RadioGroup1.ItemIndex >= 2 then
Begin
CheckBox1.Visible := true;
SpinEdit1.Visible := CheckBox1.Checked;
Label5.Visible := SpinEdit1.Visible;
End
else
Begin
CheckBox1.Visible := false;
SpinEdit1.Visible := false;
Label5.Visible := SpinEdit1.Visible;
End
end;
procedure TForm1.RenameTabs(StringGrid: TStringGrid; TabNameStyle: byte);
begin
case TabNameStyle of
4: begin
StringGrid.Cells[0,0] := Inf[11];
StringGrid.Cells[1,0] := Inf[6];
StringGrid.Cells[2,0] := Inf[9];
StringGrid.Cells[3,0] := inf[17];
end;
3: begin
StringGrid.Cells[0,0] := Inf[11];
StringGrid.Cells[2,0] := Inf[10];
StringGrid.Cells[1,0] := Inf[5];
StringGrid.Cells[3,0] := Inf[17];
end;
2: begin
StringGrid.Cells[0,0] := Inf[11];
StringGrid.Cells[1,0] := Inf[5];
StringGrid.Cells[2,0] := Inf[10];
StringGrid.Cells[3,0] := Inf[17];
end;
1: begin
StringGrid.Cells[0,0] := Inf[11];
StringGrid.Cells[1,0] := Inf[2];
StringGrid.Cells[2,0] := Inf[3];
StringGrid.Cells[3,0] := Inf[4];
end;
0: begin
StringGrid.Cells[0,0] := Inf[11];
StringGrid.Cells[1,0] := Inf[0]+#176;
StringGrid.Cells[2,0] := Inf[1]+#176;
StringGrid.Cells[3,0] := Inf[17];
end;
end;
end;
procedure TForm1.RadioGroup2Click(Sender: TObject);
begin
if RadioGroup2.ItemIndex >= 2 then
Begin
CheckBox2.Visible := true;
SpinEdit2.Visible := CheckBox2.Checked;
Label7.Visible := SpinEdit2.Visible;
End
else
Begin
CheckBox2.Visible := false;
SpinEdit2.Visible := false;
Label7.Visible := SpinEdit2.Visible;
End;
RenameTabs(StringGrid2,RadioGroup2.ItemIndex);
end;
procedure TForm1.SpeedButton7Click(Sender: TObject);
begin
if Panel1.Width >= 710 then
Panel1.Width := 10
else
Panel1.Width := Panel1.Width+250;
end;
procedure TForm1.StringGrid1KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key= vk_Tab) or (Key = vk_Return) then
TabStringGrid(StringGrid1);
if (Key= vk_Delete) or (Key = vk_Back) then
DelStringGrid(StringGrid1);
end;
procedure TForm1.SpeedButton5Click(Sender: TObject);
begin
ClearGrid(StringGrid1);
end;
procedure TForm1.ClearGrid(StringGrid: TStringGrid);
var i, j: Integer;
begin
with StringGrid do
begin
for i:=1 to RowCount-1 do
for j:=0 to ColCount-1 do
Cells[j, i]:='';
StringGrid.RowCount := 2;
end;
end;
procedure TForm1.SpeedButton6Click(Sender: TObject);
begin
ClearGrid(StringGrid2);
end;
procedure TForm1.TabStringGrid(StringGrid: TStringGrid);
begin
with StringGrid do
if Col < ColCount-1 then
Col:=Col+1
else
begin
Col:=0;
if Row >= RowCount-1 then
RowCount := RowCount +1;
Row:=Row+1;
end;
// StringGrid.fo
end;
procedure TForm1.StringGrid2KeyDown(Sender: TObject; var Key: Word;
Shift: TShiftState);
begin
if (Key= vk_Tab)or(Key=vk_return) then
TabStringGrid(StringGrid2);
if (Key= vk_Delete) or (Key = vk_Back) then
DelStringGrid(StringGrid2);
end;
procedure TForm1.FormCreate(Sender: TObject);
var i: integer;
begin
// StringGrid1.Options:=StringGrid1.Options+[goEditing];
Application.HintPause :=0;
Application.OnShowHint := OnShowHint;
MyDir := GetCurrentDir;
i:=1;
while ParamStr(i)<>'' do
Begin
if ParamStr(i)='-dev' then
Begin
Panel1.Visible := true;
if DecimalSeparator <> RS.Items[RS.ItemIndex] then
DecimalSeparator := RS.Items[RS.ItemIndex][1];
End;
if ParamStr(i)='-ed' then
EdMode := true;
inc(i);
End;
if DecimalSeparator=',' then
RS1.Checked := true
else RS2.Checked := true;
end;
procedure TForm1.SpeedButton10Click(Sender: TObject);
begin
Form8.CheckBox4.Checked := CheckBox4.Checked;
Form8.ShowLitera.Checked := ShowLitera.Checked;
Form8.RS1.Checked := RS1.Checked;
Form8.RS2.Checked := RS2.Checked;
Form8.ComboBox3.ItemIndex := ComboBox3.ItemIndex;
Form8.ComboBox4.ItemIndex := ComboBox4.ItemIndex;
Form8.ComboBox5.ItemIndex := ComboBox5.ItemIndex;
Form8.ComboBox6.ItemIndex := ComboBox6.ItemIndex;
Form8.ShowModal;
end;
procedure TForm1.SpeedButton1Click(Sender: TObject);
var S:TSTringList;
begin
if OpenDialog1.Execute then
begin
Form2.ComboBox1.Items := ListBox1.Items;
Form2.ComboBox1.ItemIndex := ListBox1.ItemIndex;
Form2.ComboBox1.OnChange(nil);
Form2.RadioGroup2.OnClick(nil);
Form2.ComboBox2.ItemIndex := ComboBox1.ItemIndex;
Form2.ComboBox2.OnChange(nil);
Form2.ListBox4.ItemIndex := ListBox4.ItemIndex;
Form2.ListBox4.OnClick(nil);
Form2.PageControl1.ActivePageIndex := PageControl1.ActivePageIndex;
SetCurrentDir(MyDir);
OpenFileName := OpenDialog1.FileName;
if Pos('xls', AnsiLowerCase(ExtractFileExt(OpenFileName))) > 0 then
begin
XlsToTXT(OpenFileName);
OpenFileName := 'Data\Temp.txt';
Form2.RadioGroup1.ItemIndex := 1;
end;
Form2.Showmodal;
if CanLoad then
begin
PageControl1.ActivePageIndex := Form2.PageControl1.ActivePageIndex;
if PageControl1.ActivePageIndex = 0 then
begin
ListBox1.ItemIndex := Form2.ComboBox1.ItemIndex;
RadioGroup1.ItemIndex := Form2.RadioGroup2.ItemIndex;
end
else
begin
ComboBox1.ItemIndex := Form2.ComboBox2.ItemIndex;
ComboBox1.OnChange(nil);
ListBox4.ItemIndex := Form2.ListBox4.ItemIndex;
ListBox4.OnClick(nil);
end;
S:= TSTringList.Create;
S.LoadFromFile(OpenFileName);
OpenTable(StringGrid1,S);
S.Destroy;
end;
end;
end;
procedure TForm1.OpenTable(StringGrid: TStringGrid; S: TStringList);
var i, j : integer;
Sep : String;
begin
ClearGrid(StringGrid);
StringGrid.Visible :=false;
for i:= Form2.SpinEdit1.Value-1 to S.count-1 do
Begin
if i<0 then
continue;
with StringGrid do
if i >= RowCount-2 then
RowCount := i+2-(Form2.SpinEdit1.Value-1);
case Form2.RadioGroup1.ItemIndex of
0: sep:=' ';
1: sep:=#$9;
2: sep:=Form2.Edit1.Text[1];
3: sep:=';';
4: sep:=',';
end;
for j:= 0 to 3 do
StringGrid.Cells[j,i+1-(Form2.SpinEdit1.Value-1)] := GetCols(s[i],sep, StrToInt(Form2.ValueList.Cells[1,j+1])-1,1, j>0);
end;
StringGrid.FixedRows := 1;
StringGrid.Visible :=true;
end;
procedure TForm1.SpeedButton4Click(Sender: TObject);
var S : TStringList;
begin
if OpenDialog1.Execute then
begin
Form2.ComboBox1.Items := ListBox2.Items;
Form2.ComboBox1.ItemIndex := ListBox2.ItemIndex;
Form2.ComboBox1.OnChange(nil);
Form2.RadioGroup2.ItemIndex := RadioGroup2.ItemIndex;
Form2.ComboBox2.ItemIndex := ComboBox2.ItemIndex;
Form2.ComboBox2.OnChange(nil);
Form2.ListBox4.ItemIndex := ListBox5.ItemIndex;
Form2.ListBox4.OnClick(nil);
Form2.PageControl1.ActivePageIndex := PageControl1.ActivePageIndex;
if PageControl1.ActivePageIndex = 0 then
Form2.RadioGroup2.OnClick(nil);
SetCurrentDir(MyDir);
OpenFileName := OpenDialog1.FileName;
if Pos('xls', AnsiLowerCase(ExtractFileExt(OpenFileName))) > 0 then
begin
XlsToTXT(OpenFileName);
OpenFileName := 'Data\Temp.txt';
Form2.OnShow(nil);
Form2.RadioGroup1.ItemIndex := 1;
end;
Form2.Showmodal;
if CanLoad then
begin
PageControl1.ActivePageIndex := Form2.PageControl1.ActivePageIndex;
if PageControl1.ActivePageIndex = 0 then
begin
ListBox2.ItemIndex := Form2.ComboBox1.ItemIndex;
RadioGroup2.ItemIndex := Form2.RadioGroup2.ItemIndex;
end
else
begin
ComboBox2.ItemIndex := Form2.ComboBox2.ItemIndex;
ComboBox2.OnChange(nil);
ListBox5.ItemIndex := Form2.ListBox4.ItemIndex;
ListBox5.OnClick(nil);
end;
S:= TSTringList.Create;
S.LoadFromFile(OpenFileName);
OpenTable(StringGrid2,S);
S.Destroy;
end;
end;
end;
function MyFormat(D:Double; fmt:shortint):string;
begin
case fmt of
0: result := IntToStr(round(D));
1: result := format('%.1f',[D]);
2: result := format('%.2f',[D]);
-1, 3: result := format('%.3f',[D]);
4: result := format('%.4f',[D]);
5: result := format('%.5f',[D]);
6: result := format('%.6f',[D]);
7: result := format('%.7f',[D]);
8: result := format('%.8f',[D]);
9: result := format('%.9f',[D]);
10: result := format('%.10f',[D]);
11: result := format('%.11f',[D]);
12: result := format('%.12f',[D]);
13: result := format('%.13f',[D]);
14: result := format('%.14f',[D]);
15: result := format('%.15f',[D]);
16: result := format('%.16f',[D]);
end;
end;
procedure TForm1.Button3Click(Sender: TObject);
var SK1, SK2, Dat1, Dat2, i, Zone2 :integer;
B1, L1, X1, Y1, H1, B2, L2, X2, Y2, H2 : Double;
WB, WL, WH, dH, dEll : Double; WGS84, GN:Integer;
AutoZone2, South : Boolean;
begin
{NEW 21.06 --------------------------------------------------------------------}
if Length(GeoidList) < 2 then
SetLength(GeoidList, 2);
StatusBar1.SimpleText := inf[62];
SetCurrentDir(MyDir);
if Geoid1.ItemIndex > 0 then
begin
GN := FindGeoidMetaByCaption(Geoid1.Items[Geoid1.ItemIndex]);
if GN <> -1 then
if GeoidList[0].NameID <> GeoidsMetaData[GN].NameID then
ReloadGeoid(GeoidDir + GeoidsMetaData[GN].FileName, 0);
end;
if Geoid2.ItemIndex > 0 then
begin
GN := FindGeoidMetaByCaption(Geoid2.Items[Geoid2.ItemIndex]);
if GN <> -1 then
if GeoidList[1].NameID <> GeoidsMetaData[GN].NameID then
ReloadGeoid(GeoidDir + GeoidsMetaData[GN].FileName, 1);
end;
{------------------------------------------------------------------------------}
ProgressBar1.Position := 0;