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
|
procedure SetFs9PlnWaypoints(Route, PathSim, PathPln:String);// Text *.pln files
var
LstrCaption,
LstrLatitude,
LstrLongitude,
LstrDirLatitude,
LstrDirLongitude: String;
ind, WpIndex: Integer;
searchResult: TSearchRec;
aStringList: TStringList;
LfltLatitude,
LfltLongitude: Single;
Splitted: TArray<String>;
begin
//GstlMapPoints.Clear;
aStringList:= TStringList.Create;
aStringList.StrictDelimiter:= True;
aStringList.Delimiter:= ',';
if (findFirst(PathSim + '\Civa\ADEU\' + Route , faAnyFile, SearchResult) = 0)then
begin
ShowMessage('This route has already ADEU Files CPS will delete them'
+ ' before create new');
Repeat
DeleteFile(Route + '\Civa\ADEU\'
+ searchResult.Name);
Until FindNext(searchResult)<>0 ;
FindClose(searchResult);
end;
aStringList.LoadFromFile(Flight.PlnFileUsed);
WpIndex:= aStringList.IndexOfName('waypoint.0');
for ind:= WpIndex to aStringList.Count -1 do
begin
if aStringList.Strings[ind]= '' then
Break;
Splitted:= aStringList.Strings[ind].Split([',']);
if not Splitted[0].Contains('*') then
LstrCaption:= Copy(Splitted[0], Pos('=', Splitted[0])+ 1,
(Length(Splitted[0])- Pos('=',
Splitted[0])+ 1));
if not Splitted[3].Contains('*') then
LstrCaption:= Copy(Splitted[3], Pos('=', Splitted[3])+ 1,
(Length(Splitted[3])- Pos('=',
Splitted[3])+ 1));
LstrCaption:= ReplaceText(LstrCaption,' ','');
if Length(LstrCaption)> 7 then
begin
MessageDlg('The waypoint : ' + LstrCaption + ' (and may be more)'
+ ' is unallowable by ICAO' +
#13#10 + 'Please change it (them) for 7 Characters name !'
, mtError,[mbOK], 0, mbOK);
Exit;
end;
//Fill cbxDep/cbxDes with LstrCaption
frmTripPlanner.FillCombo(LstrCaption);
if (Splitted[2].Contains('*'))then
begin
LstrLatitude:= Splitted[2];
if (Splitted[3].Contains('*'))then
LstrLongitude:= Splitted[3];
end
else
begin
if (Splitted[5].Contains('*'))then
LstrLatitude:= Splitted[5];
if (Splitted[6].Contains('*'))then
LstrLongitude:= Splitted[6];
end;
LstrLatitude:= ReplaceText(Lstrlatitude,' ', '');
LstrLongitude:= ReplaceText(Lstrlongitude,' ', '');
LstrDirLatitude:= Copy(LstrLatitude,1,1);// N-S
LstrDirLongitude:= Copy(LstrLongitude,1,1); // E-
LfltLatitude:= ConvertCoordinatesD(LstrLatitude);
if LstrDirLatitude = 'S' then
LfltLatitude:= - LfltLatitude;
LfltLongitude:= ConvertCoordinatesD(LstrLongitude);
if LstrDirLongitude = 'W' then
LfltLongitude:= - LfltLongitude;
if ((GfltWXMinLon = 0)
and (GfltWXMaxLon = 0)
and (GfltWXMinLat = 0)
and (GfltWXMaxLat = 0)) then
begin
GfltWXMinLon:= LfltLongitude;
GfltWXMaxLon:= LfltLongitude;
GfltWXMinLat:= LfltLatitude;
GfltWXMaxLat:= LfltLatitude;
end;
if LfltLongitude < GfltWXMinLon then
GfltWXMinLon:= LfltLongitude;
if LfltLongitude > GfltWXMaxLon then
GfltWXMaxLon:= LfltLongitude;
if LfltLatitude <GfltWXMinLat then
GfltWXMinLat:= LfltLatitude;
if LfltLatitude > GfltWXMaxLat then
GfltWXMaxLat:= LfltLatitude;
GstlFsPoints.Assign(aStringList);
end;
aStringList.Free;
end; |
Partager