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
Max_Event_det_tick=10000;
Max_event_det=400;
Max_Trains=50;
var
FormDebug: TFormDebug;
@@ -62,6 +63,10 @@ var
AffSignal,AffAffect,initform,AffFD : boolean;
N_event_det : integer; // index du dernier évènement (de 1 à 20)
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
N_Event_tick : integer ; // dernier index
@@ -74,8 +79,6 @@ var
actionneur : integer;
objet : integer; // numéro d'objet dans CDM
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
end;

Binary file not shown.

View File

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

Binary file not shown.

View File

@@ -1,6 +1,6 @@
object FormPrinc: TFormPrinc
Left = 55
Top = 196
Left = 56
Top = 197
AutoSize = True
BorderStyle = bsSingle
Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ'
@@ -1415,7 +1415,7 @@ object FormPrinc: TFormPrinc
Top = 136
Width = 97
Height = 25
Caption = 'Simu D'#233'tecteur 513'
Caption = 'Test'
TabOrder = 12
Visible = False
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
Height = 21
TabOrder = 1
Text = '1'
Text = '0'
OnChange = EditIntervalleChange
OnKeyPress = EditIntervalleKeyPress
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
Left = 48
Top = 96

View File

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

Binary file not shown.

View File

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

Binary file not shown.

View File

@@ -22,7 +22,7 @@ var
FormVersion: TFormVersion;
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