This commit is contained in:
f1iwq2
2020-04-02 18:40:35 +02:00
parent 3758d64936
commit 8f2e8119a6
14 changed files with 678 additions and 498 deletions

Binary file not shown.

View File

@@ -55,6 +55,7 @@ type
Const Const
Max_Event_det_tick=10000; Max_Event_det_tick=10000;
Max_event_det=400; Max_event_det=400;
Max_Trains=50;
var var
FormDebug: TFormDebug; FormDebug: TFormDebug;
@@ -62,6 +63,10 @@ var
AffSignal,AffAffect,initform,AffFD : boolean; AffSignal,AffAffect,initform,AffFD : boolean;
N_event_det : integer; // index du dernier évènement (de 1 à 20) N_event_det : integer; // index du dernier évènement (de 1 à 20)
event_det : array[1..Max_event_det] of integer; event_det : array[1..Max_event_det] of integer;
event_det_train : array[1..Max_Trains] of record
NbEl : integer;
Det : array[1..3] of integer; // tableau des evts détecteurs par train
end;
// tick 1/10s,détecteur // tick 1/10s,détecteur
N_Event_tick : integer ; // dernier index N_Event_tick : integer ; // dernier index
@@ -74,8 +79,6 @@ var
actionneur : integer; actionneur : integer;
objet : integer; // numéro d'objet dans CDM objet : integer; // numéro d'objet dans CDM
etat : integer ; // état du détecteur de l'aiguillage ou de l'actionneur etat : integer ; // état du détecteur de l'aiguillage ou de l'actionneur
//train : integer ;
//suivant : integer ; // d'ou vient le train
traite : boolean; // traité lors de a recherche d'une route traite : boolean; // traité lors de a recherche d'une route
end; end;

Binary file not shown.

View File

@@ -104,11 +104,11 @@ begin
case feux[i].aspect of case feux[i].aspect of
// feux de signalisation // feux de signalisation
2 : dessine_feu2(Vcanvas,EtatFeupilote); 2 : dessine_feu2(Vcanvas,0,0,1,1,EtatFeupilote,1);
3 : dessine_feu3(Vcanvas,EtatFeupilote); 3 : dessine_feu3(Vcanvas,0,0,1,1,EtatFeupilote,1);
4 : dessine_feu4(VCanvas,0,0,1,1,EtatFeupilote,1); 4 : dessine_feu4(VCanvas,0,0,1,1,EtatFeupilote,1);
5 : dessine_feu5(VCanvas,EtatFeupilote); 5 : dessine_feu5(VCanvas,0,0,1,1,EtatFeupilote,1);
7 : dessine_feu7(VCanvas,EtatFeupilote); 7 : dessine_feu7(VCanvas,0,0,1,1,EtatFeupilote,1);
9 : dessine_feu9(VCanvas,0,0,1,1,EtatFeupilote,1); 9 : dessine_feu9(VCanvas,0,0,1,1,EtatFeupilote,1);
// indicateurs de direction // indicateurs de direction
12 : dessine_dir2(VCanvas,EtatFeupilote); 12 : dessine_dir2(VCanvas,EtatFeupilote);

Binary file not shown.

View File

@@ -1,6 +1,6 @@
object FormPrinc: TFormPrinc object FormPrinc: TFormPrinc
Left = 55 Left = 56
Top = 196 Top = 197
AutoSize = True AutoSize = True
BorderStyle = bsSingle BorderStyle = bsSingle
Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ' Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ'
@@ -1415,7 +1415,7 @@ object FormPrinc: TFormPrinc
Top = 136 Top = 136
Width = 97 Width = 97
Height = 25 Height = 25
Caption = 'Simu D'#233'tecteur 513' Caption = 'Test'
TabOrder = 12 TabOrder = 12
Visible = False Visible = False
OnClick = Button2Click OnClick = Button2Click

File diff suppressed because it is too large Load Diff

Binary file not shown.

View File

@@ -43,10 +43,18 @@ object FormSimulation: TFormSimulation
Width = 49 Width = 49
Height = 21 Height = 21
TabOrder = 1 TabOrder = 1
Text = '1' Text = '0'
OnChange = EditIntervalleChange OnChange = EditIntervalleChange
OnKeyPress = EditIntervalleKeyPress OnKeyPress = EditIntervalleKeyPress
end end
object CheckAffTick: TCheckBox
Left = 64
Top = 64
Width = 225
Height = 17
Caption = 'Afficher les ticks pendant la simulation'
TabOrder = 2
end
object OpenDialog: TOpenDialog object OpenDialog: TOpenDialog
Left = 48 Left = 48
Top = 96 Top = 96

View File

@@ -12,6 +12,7 @@ type
OpenDialog: TOpenDialog; OpenDialog: TOpenDialog;
EditIntervalle: TEdit; EditIntervalle: TEdit;
Label1: TLabel; Label1: TLabel;
CheckAffTick: TCheckBox;
procedure ButtonChargeClick(Sender: TObject); procedure ButtonChargeClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure EditIntervalleKeyPress(Sender: TObject; var Key: Char); procedure EditIntervalleKeyPress(Sender: TObject; var Key: Char);
@@ -25,26 +26,29 @@ type
var var
FormSimulation: TFormSimulation; FormSimulation: TFormSimulation;
Intervalle : integer; Intervalle : integer;
AffTickSimu : boolean;
implementation implementation
{$R *.dfm} {$R *.dfm}
procedure TFormSimulation.ButtonChargeClick(Sender: TObject); procedure TFormSimulation.ButtonChargeClick(Sender: TObject);
var s : string; var s,nF : string;
fte : textFile; fte : textFile;
i,k,erreur : integer; i,k,erreur : integer;
sortie : boolean; sortie : boolean;
begin begin
AffTickSimu:= checkAffTick.Checked;
s:=GetCurrentDir; s:=GetCurrentDir;
s:='C:\Program Files (x86)\Borland\Delphi7\Projects\Signaux_complexes_GL'; s:='C:\Program Files (x86)\Borland\Delphi7\Projects\Signaux_complexes_GL';
OpenDialog.InitialDir:=s; OpenDialog.InitialDir:=s;
OpenDialog.DefaultExt:='txt'; OpenDialog.DefaultExt:='txt';
OpenDialog.Title:='Ouvrir un fichier de simulation';
OpenDialog.Filter:='Fichiers texte (*.txt)|*.txt|Tous fichiers (*.*)|*.*'; OpenDialog.Filter:='Fichiers texte (*.txt)|*.txt|Tous fichiers (*.*)|*.*';
if openDialog.Execute then if openDialog.Execute then
begin begin
s:=openDialog.FileName; nF:=openDialog.FileName;
assignFile(fte,s); assignFile(fte,nF);
reset(fte); reset(fte);
index_simule:=1; index_simule:=1;
repeat repeat
@@ -115,13 +119,13 @@ begin
FormSimulation.Close; FormSimulation.Close;
end; end;
Affiche('Fichier simulation : '+nF ,clyellow);
end; end;
procedure TFormSimulation.FormCreate(Sender: TObject); procedure TFormSimulation.FormCreate(Sender: TObject);
begin begin
Intervalle:=1; Intervalle:=0;
EditIntervalle.Text:=IntToSTR(Intervalle); EditIntervalle.Text:=IntToSTR(Intervalle);
end; end;

Binary file not shown.

View File

@@ -177,7 +177,11 @@ type
FeuAspect : integer; // aspect du feu (2 feux...9 feux) FeuAspect : integer; // aspect du feu (2 feux...9 feux)
FeuOriente : integer ; // orientation du feu : 1 vertical en bas / 2 horizontal gauche / 3 horizontal droit FeuOriente : integer ; // orientation du feu : 1 vertical en bas / 2 horizontal gauche / 3 horizontal droit
end; end;
TfeuTCO = array[1..50] of record
Adresse : integer ; // adresse du feu;
x,y : integer ; // coordonnées pixels
FeuOriente : integer;
end;
const const
clGrille=$707070; clGrille=$707070;
@@ -193,6 +197,8 @@ var
TamponTCO_Org : record TamponTCO_Org : record
x1,y1,x2,y2 : integer; x1,y1,x2,y2 : integer;
end; end;
FeuTCO : TFeuTCO;
NbFeuTCO : integer;
rAncien : TRect; rAncien : TRect;
PCanvasTCO : Tcanvas; PCanvasTCO : Tcanvas;
PBitMapTCO : TBitMap; PBitMapTCO : TBitMap;
@@ -235,7 +241,7 @@ begin
exit; exit;
end; end;
x:=1;y:=1;NbreCellX:=0;NbreCellY:=0; x:=1;y:=1;NbreCellX:=0;NbreCellY:=0;NbFeuTCO:=0;
//Faire une passe pour lire la taille de la matrice //Faire une passe pour lire la taille de la matrice
while not eof(fichier) do while not eof(fichier) do
@@ -289,6 +295,17 @@ begin
tco[x,y].FeuOriente:=valeur; tco[x,y].FeuOriente:=valeur;
delete(s,1,i); delete(s,1,i);
// si c'est un feu, remplir tableau FeuTCO
if tco[x,y].Bimage=12 then
begin
inc(NbFeuTCO);
// Affiche(intToSTR(tco[x,y].Adresse),clyellow);
FeuTCO[NbFeuTCO].Adresse:=tco[x,y].Adresse;
FeuTCO[NbFeuTCO].FeuOriente:=tco[x,y].FeuOriente;
FeuTCO[NbFeuTCO].x:=x;
FeuTCO[NbFeuTCO].y:=y;
end;
inc(x); inc(x);
until s=''; until s='';
@@ -296,7 +313,8 @@ begin
inc(y);x:=1; inc(y);x:=1;
end; end;
closefile(fichier); closefile(fichier);
Affiche('Dimensions du tco : '+intToSTR(NbreCellX)+'x'+intToSTR(NbreCellY),clyellow); Affiche('Dimensions du tco : '+intToSTR(NbreCellX)+'x'+intToSTR(NbreCellY)+' NbeFeuxTCO='+IntToSTR(NbFeuTCO),clyellow);
end; end;
procedure sauve_fichier_tco; procedure sauve_fichier_tco;
@@ -844,8 +862,11 @@ begin
Orientation:=TCO[x,y].FeuOriente; Orientation:=TCO[x,y].FeuOriente;
Adresse:=TCO[x,y].Adresse; Adresse:=TCO[x,y].Adresse;
if adresse=0 then exit;
i:=Index_feu(adresse); i:=Index_feu(adresse);
if i=0 then exit;
aspect:=feux[i].aspect; aspect:=feux[i].aspect;
//Affiche(IntToSTR(i)+' '+intToSTR(aspect),clred);
case aspect of case aspect of
2 : ImageFeu:=Formprinc.Image2feux; 2 : ImageFeu:=Formprinc.Image2feux;
@@ -858,8 +879,8 @@ begin
end; end;
//ImageFeu:=PointeurImage(adresse); // pointeur vers le type de feu à dessiner //ImageFeu:=PointeurImage(adresse); // pointeur vers le type de feu à dessiner
TailleY:=ImageFeu.picture.BitMap.Height; // 50 taille du feu d'origine (verticale) TailleY:=ImageFeu.picture.BitMap.Height; // taille du feu d'origine (verticale)
TailleX:=ImageFeu.picture.BitMap.Width; //91n TailleX:=ImageFeu.picture.BitMap.Width; //
//Facteurs de réductions X et Y pour un signal vertical //Facteurs de réductions X et Y pour un signal vertical
frX:=LargeurCell/TailleX; frX:=LargeurCell/TailleX;
@@ -897,15 +918,17 @@ begin
end; end;
dessine_feu_mx(canvasDest,x0,y0,frX,frY,adresse,orientation);
// allumage des feux du signal ----------------- // allumage des feux du signal -----------------
(*TailleY:=HauteurCell*2; (*
TailleX:=LargeurCell;
frX:=LargeurCell/TailleX;
frY:=HauteurCell/TailleY;*)
case aspect of case aspect of
2 : dessine_feu2(canvasDest,x0,y0,frX,frY,etatsignalcplx[adresse],orientation);
3 : dessine_feu3(canvasDest,x0,y0,frX,frY,etatsignalcplx[adresse],orientation);
4 : dessine_feu4(canvasDest,x0,y0,frX,frY,etatsignalcplx[adresse],orientation); 4 : dessine_feu4(canvasDest,x0,y0,frX,frY,etatsignalcplx[adresse],orientation);
9 : dessine_feu9(canvasDest,x0,y0,frX,frY,etatsignalcplx[adresse],orientation); 5 : dessine_feu5(canvasDest,x0,y0,frX,frY,etatsignalcplx[adresse],orientation);
end; 7 : dessine_feu7(canvasDest,x0,y0,frX,frY,etatsignalcplx[adresse],orientation);
9 : dessine_feu_mx(canvasDest,x0,y0,frX,frY,etatsignalcplx[adresse],orientation);
end; *)
end; end;
procedure TFormTCO.Efface_Cellule(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode); procedure TFormTCO.Efface_Cellule(Canvas : Tcanvas;x,y : integer; couleur : Tcolor;Mode : TPenMode);
@@ -1081,7 +1104,6 @@ begin
LargeurCell:=25; LargeurCell:=25;
HauteurCell:=25; HauteurCell:=25;
AvecGrille:=true; AvecGrille:=true;
XclicCell:=1; XclicCell:=1;
YclicCell:=1; YclicCell:=1;
KeyPreview:=false; // invalide les évènements clavier KeyPreview:=false; // invalide les évènements clavier
@@ -1785,8 +1807,9 @@ begin
Affiche_TCO; Affiche_TCO;
end; end;
// changement de l'adresse d'un élément
procedure TFormTCO.EditAdrElementChange(Sender: TObject); procedure TFormTCO.EditAdrElementChange(Sender: TObject);
var Adr,erreur : integer; var Adr,erreur,i : integer;
begin begin
Val(EditAdrElement.Text,Adr,erreur); Val(EditAdrElement.Text,Adr,erreur);
if (erreur<>0) or (Adr<0) or (Adr>2048) then if (erreur<>0) or (Adr<0) or (Adr>2048) then
@@ -1794,8 +1817,20 @@ begin
EditAdrElement.text:=intToSTR(tco[XClicCell,YClicCell].Adresse); EditAdrElement.text:=intToSTR(tco[XClicCell,YClicCell].Adresse);
exit; exit;
end; end;
tco[XClicCell,YClicCell].Adresse:=Adr; tco[XClicCell,YClicCell].Adresse:=Adr;
affiche_cellule(XClicCell,YClicCell,pmCopy); affiche_cellule(XClicCell,YClicCell,pmCopy);
// si c'est un feu, mettre à jour le tableau FeuTCO
if tco[XClicCell,YClicCell].BImage=12 then
begin
i:=0;
while i<NbFeuTCO do
begin
inc(i);
if (FeuTCO[i].x=xClicCell) and (FeuTCO[i].y=yClicCell) then FeuTCO[i].Adresse:=Adr;
end;
end;
end; end;
@@ -1839,15 +1874,7 @@ end;
procedure TFormTCO.Button1Click(Sender: TObject); procedure TFormTCO.Button1Click(Sender: TObject);
begin begin
Detecteur[513]:=true; Affiche(IntToSTR(NbfeuTCO),clyellow);
Maj_tco(513,true);
with PCanvasTCO do
begin
pen.Mode:=pmCopy;
pen.color:=clRed;
brush.color:=clGreen;
Rectangle(2,2,140,140);
end;
end; end;
procedure TFormTCO.Button2Click(Sender: TObject); procedure TFormTCO.Button2Click(Sender: TObject);
@@ -1856,6 +1883,7 @@ begin
Maj_tco(513,false); Maj_tco(513,false);
end; end;
// dépose d'un feu sur le TCO
procedure TFormTCO.ImageDiag1EndDrag(Sender, Target: TObject; X, Y: Integer); procedure TFormTCO.ImageDiag1EndDrag(Sender, Target: TObject; X, Y: Integer);
begin begin
if (x=0) and (y=0) then exit; if (x=0) and (y=0) then exit;
@@ -1866,6 +1894,13 @@ begin
tco[XClicCell,YClicCell].BType:=0; // rien tco[XClicCell,YClicCell].BType:=0; // rien
tco[XClicCell,YClicCell].BImage:=10; // image 10 tco[XClicCell,YClicCell].BImage:=10; // image 10
tco[XClicCell,YClicCell].Adresse:=0; tco[XClicCell,YClicCell].Adresse:=0;
tco[XClicCell,YClicCell].FeuOriente:=1;
inc(NbFeuTCO);
FeuTCO[NbFeuTCO].Adresse:=0;
FeuTCO[NbFeuTCO].FeuOriente:=1;
FeuTCO[NbFeuTCO].x:=XClicCell;
FeuTCO[NbFeuTCO].y:=YClicCell;
EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse);
EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype); EdittypeElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Btype);

Binary file not shown.

View File

@@ -22,7 +22,7 @@ var
FormVersion: TFormVersion; FormVersion: TFormVersion;
Lance_verif : integer; Lance_verif : integer;
Const Version='1.45'; //Version='1.2';// sert à la comparaison de la version publiée Const Version='1.5'; //Version='1.2';// sert à la comparaison de la version publiée
implementation implementation