diff --git a/Notice d'utilisation des signaux_complexes_GL_V6.3.pdf b/Notice d'utilisation des signaux_complexes_GL_V6.4.pdf similarity index 79% rename from Notice d'utilisation des signaux_complexes_GL_V6.3.pdf rename to Notice d'utilisation des signaux_complexes_GL_V6.4.pdf index 82ceae6..928c79d 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V6.3.pdf and b/Notice d'utilisation des signaux_complexes_GL_V6.4.pdf differ diff --git a/Signaux_complexes_GL.cfg b/Signaux_complexes_GL.cfg index 1e45cf1..e9e902f 100644 --- a/Signaux_complexes_GL.cfg +++ b/Signaux_complexes_GL.cfg @@ -14,8 +14,8 @@ -$N+ -$O- -$P+ --$Q- --$R- +-$Q+ +-$R+ -$S- -$T- -$U- diff --git a/Signaux_complexes_GL.dof b/Signaux_complexes_GL.dof index 2a4eebc..f78f51d 100644 --- a/Signaux_complexes_GL.dof +++ b/Signaux_complexes_GL.dof @@ -17,8 +17,8 @@ M=0 N=1 O=0 P=1 -Q=0 -R=0 +Q=1 +R=1 S=0 T=0 U=0 diff --git a/UnitConfig.dfm b/UnitConfig.dfm index a516816..8209bbd 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1571,7 +1571,7 @@ object FormConfig: TFormConfig Top = 8 Width = 633 Height = 505 - ActivePage = TabSheetDccpp + ActivePage = TabSheetSig Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -2419,7 +2419,7 @@ object FormConfig: TFormConfig Caption = 'Vitesse de franchissement d'#233'vi'#233' :' TabOrder = 0 object RadioButtonsans: TRadioButton - Left = 24 + Left = 8 Top = 16 Width = 57 Height = 17 @@ -2433,7 +2433,7 @@ object FormConfig: TFormConfig OnClick = RadioButtonsansClick end object RadioButton30kmh: TRadioButton - Left = 24 + Left = 8 Top = 32 Width = 73 Height = 17 @@ -2447,7 +2447,7 @@ object FormConfig: TFormConfig OnClick = RadioButton30kmhClick end object RadioButton60kmh: TRadioButton - Left = 24 + Left = 8 Top = 48 Width = 73 Height = 17 @@ -2460,6 +2460,29 @@ object FormConfig: TFormConfig TabOrder = 2 OnClick = RadioButton60kmhClick end + object RadioButtonSpecifique: TRadioButton + Left = 88 + Top = 24 + Width = 81 + Height = 17 + Hint = + 'Pour signaux belges. Permet d'#39'afficher le chiffre de r'#233'duction d' + + 'e vitesse sur le signal pr'#233'c'#233'dent l'#39'aiguillage' + Caption = 'Sp'#233'cifique :' + ParentShowHint = False + ShowHint = True + TabOrder = 3 + OnClick = RadioButtonSpecifiqueClick + end + object EditSpecifique: TEdit + Left = 112 + Top = 40 + Width = 33 + Height = 21 + TabOrder = 4 + Text = '40' + OnChange = EditSpecifiqueChange + end end object CheckInverse: TCheckBox Left = 16 @@ -2986,7 +3009,7 @@ object FormConfig: TFormConfig Left = 336 Top = 32 Width = 281 - Height = 425 + Height = 441 Caption = 'Description du signal' TabOrder = 0 object ImageSignal: TImage @@ -3016,14 +3039,14 @@ object FormConfig: TFormConfig Caption = 'D'#233'codeur: ' end object LabelDetAss: TLabel - Left = 88 + Left = 96 Top = 104 Width = 86 Height = 13 Caption = 'D'#233'tecteur associ'#233 end object LabelElSuiv: TLabel - Left = 184 + Left = 192 Top = 104 Width = 75 Height = 13 @@ -3031,7 +3054,7 @@ object FormConfig: TFormConfig end object Label17: TLabel Left = 8 - Top = 288 + Top = 315 Width = 228 Height = 26 Caption = @@ -3121,7 +3144,7 @@ object FormConfig: TFormConfig end object MemoCarre: TMemo Left = 8 - Top = 320 + Top = 344 Width = 265 Height = 89 ScrollBars = ssBoth @@ -3135,12 +3158,12 @@ object FormConfig: TFormConfig Width = 129 Height = 21 Style = csDropDownList - ItemHeight = 0 + ItemHeight = 13 TabOrder = 1 OnChange = ComboBoxDecChange end object EditDet1: TEdit - Left = 120 + Left = 136 Top = 120 Width = 41 Height = 21 @@ -3148,7 +3171,7 @@ object FormConfig: TFormConfig OnChange = EditDet1Change end object EditSuiv1: TEdit - Left = 184 + Left = 200 Top = 120 Width = 41 Height = 21 @@ -3158,7 +3181,7 @@ object FormConfig: TFormConfig OnChange = EditSuiv1Change end object EditDet2: TEdit - Left = 120 + Left = 136 Top = 144 Width = 41 Height = 21 @@ -3166,7 +3189,7 @@ object FormConfig: TFormConfig OnChange = EditDet2Change end object EditSuiv2: TEdit - Left = 184 + Left = 200 Top = 144 Width = 41 Height = 21 @@ -3176,7 +3199,7 @@ object FormConfig: TFormConfig OnChange = EditSuiv2Change end object EditDet3: TEdit - Left = 120 + Left = 136 Top = 168 Width = 41 Height = 21 @@ -3184,7 +3207,7 @@ object FormConfig: TFormConfig OnChange = EditDet3Change end object EditSuiv3: TEdit - Left = 184 + Left = 200 Top = 168 Width = 41 Height = 21 @@ -3194,7 +3217,7 @@ object FormConfig: TFormConfig OnChange = EditSuiv3Change end object EditDet4: TEdit - Left = 120 + Left = 136 Top = 192 Width = 41 Height = 21 @@ -3202,7 +3225,7 @@ object FormConfig: TFormConfig OnChange = EditDet4Change end object EditSuiv4: TEdit - Left = 184 + Left = 200 Top = 192 Width = 41 Height = 21 @@ -3253,7 +3276,8 @@ object FormConfig: TFormConfig 'Directionnel 3 feux' 'Directionnel 4 feux' 'Directionnel 5 feux' - 'Directionnel 6 feux') + 'Directionnel 6 feux' + 'Signal belge type 1') end object EditSpecUni: TEdit Left = 8 @@ -3319,6 +3343,30 @@ object FormConfig: TFormConfig TabOrder = 18 OnClick = CheckFRCClick end + object CheckBoxVersContrevoie: TCheckBox + Left = 120 + Top = 280 + Width = 137 + Height = 17 + Hint = 'Permet d'#39'afficher le chevron si l'#39'aiguillage du signal est devi'#233 + Caption = 'Signal vers contrevoie' + ParentShowHint = False + ShowHint = True + TabOrder = 19 + OnClick = CheckBoxVersContrevoieClick + end + object CheckBoxContreVoie: TCheckBox + Left = 120 + Top = 294 + Width = 137 + Height = 25 + Hint = 'Signal clignotant' + Caption = 'Signal de contrevoie' + ParentShowHint = False + ShowHint = True + TabOrder = 20 + OnClick = CheckBoxContreVoieClick + end end object RichSig: TRichEdit Left = 0 diff --git a/UnitConfig.pas b/UnitConfig.pas index c442d57..030720b 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -336,6 +336,10 @@ type PopupMenuConfig: TPopupMenu; Copier1: TMenuItem; Coller1: TMenuItem; + CheckBoxVersContrevoie: TCheckBox; + CheckBoxContreVoie: TCheckBox; + RadioButtonSpecifique: TRadioButton; + EditSpecifique: TEdit; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -498,6 +502,10 @@ type Shift: TShiftState; X, Y: Integer); procedure RichCdeDccppKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); + procedure RadioButtonSpecifiqueClick(Sender: TObject); + procedure CheckBoxVersContrevoieClick(Sender: TObject); + procedure CheckBoxContreVoieClick(Sender: TObject); + procedure EditSpecifiqueChange(Sender: TObject); private { Déclarations privées } public @@ -591,7 +599,7 @@ function decodeDCC(s : string) : string; implementation -uses UnitDebug,UnitTCO, UnitSR, UnitCDF,UnitAnalyseSegCDM; +uses UnitDebug,UnitTCO, UnitSR, UnitCDF,UnitAnalyseSegCDM, unitPilote; {$R *.dfm} @@ -897,9 +905,15 @@ begin // vitesse de franchissement et inversion if not(croi) then begin - if aiguillage[index].vitesse=0 then s:=s+',V0'; - if aiguillage[index].vitesse=30 then s:=s+',V30'; - if aiguillage[index].vitesse=60 then s:=s+',V60'; + case aiguillage[index].vitesse of + 0 : s:=s+',V0'; + 30 : s:=s+',V30'; + 60 : s:=s+',V60'; + else begin + s:=s+',V'+formconfig.EditSpecifique.Text; + end; + end; + if aiguillage[index].inversionCDM=1 then s:=s+',I1' else s:=s+',I0'; end; @@ -958,16 +972,16 @@ begin s:=IntToSTR(adresse)+','; // forme - D=directionnel ajouter 10 aspect:=feux[i].aspect; - if aspect<10 then s:=s+IntToSTR(aspect)+',' else s:=s+'D'+intToSTR(aspect-10)+','; + if (aspect<10) or (aspect>=20) then s:=s+IntToSTR(aspect)+',' else s:=s+'D'+intToSTR(aspect-10)+','; // bouton feu blanc, n'existe pas pour un feu directionnel (aspect>10) - if aspect<10 then begin if feux[i].feublanc then s:=s+'1,' else s:=s+'0,';end; + if (aspect<10) or (aspect>=20) then begin if feux[i].feublanc then s:=s+'1,' else s:=s+'0,';end; // décodeur s:=s+IntToSTR(feux[i].decodeur)+','; // detecteur et élement suivant (4 maxi) - if aspect<10 then + if (aspect<10) or (aspect>=20) then begin s:=s+'('+IntToSTR(feux[i].Adr_det1)+','+TypeEl_To_char(feux[i].Btype_suiv1)+IntToSTR(feux[i].Adr_el_suiv1); j:=feux[i].Adr_det2; @@ -1029,12 +1043,20 @@ begin s:=s+',NA'+intToSTR(feux[i].na); end; + // signal belge + if (feux[i].aspect=20) then + begin + s:=s+',NA'+intToSTR(feux[i].na)+',VCV'; + if feux[i].verscontrevoie then s:=s+'1' else s:=s+'0'; + s:=s+',CV'; + if feux[i].contrevoie then s:=s+'1' else s:=s+'0'; + end; end else // feux directionnels begin NfeuxDir:=aspect-10; - for j:=1 to NfeuxDir+1 do + for j:=1 to NfeuxDir+1 do begin s:=s+'('; for k:=1 to Length(feux[i].AigDirection[j])-1 do @@ -1045,7 +1067,7 @@ begin s:=s+')'; end; end; - + encode_sig_feux:=s; end; @@ -1138,7 +1160,7 @@ begin // feu de signalisation--------------------------------- begin val(sa,asp,erreur); //aspect - if (asp<2) or (asp=6) or (asp=8) or (asp>9) then + if (asp<2) or (asp=6) or (asp=8) or (asp>20) then begin Affiche('Erreur 676: configuration aspect ('+intToSTR(asp)+') signal incorrect à la ligne '+chaine_signal,clRed); asp:=2; @@ -1234,8 +1256,55 @@ begin if length(s)>0 then begin feux[i].checkFR:=s[1]='1';delete(s,1,1);end; end; + if length(s)>0 then if s[1]=',' then delete(s,1,1); + if length(s)>0 then + begin + if copy(s,1,2)='NA' then + begin + delete(s,1,2); + val(s,j,erreur); + delete(s,1,1); + if (j<2) or (j>5) then + begin + j:=5;affiche('Paramètre NA incorrect dans ligne '+chaine_signal,clred) + end; + feux[i].na:=j; + end; + end; if length(s)>0 then if s[1]=',' then delete(s,1,1); + if length(s)>0 then + begin + if copy(s,1,3)='VCV' then + begin + delete(s,1,3); + val(s,j,erreur); + delete(s,1,1); + if (j<0) or (j>1) then + begin + j:=0;affiche('Paramètre VCV incorrect dans ligne '+chaine_signal,clred) + end; + feux[i].verscontrevoie:=j=1; + end; + end; + + if length(s)>0 then if s[1]=',' then delete(s,1,1); + if length(s)>0 then + begin + if copy(s,1,2)='CV' then + begin + delete(s,1,2); + val(s,j,erreur); + delete(s,1,1); + if (j<0) or (j>1) then + begin + j:=0;affiche('Paramètre CV incorrect dans ligne '+chaine_signal,clred) + end; + feux[i].contrevoie:=j=1; + end; + end; + + if length(s)>0 then if s[1]='U' then delete(s,1,1); // si décodeur UniSemaf (6) champ supplémentaire U @@ -3739,9 +3808,10 @@ begin CheckInverse.checked:=aiguillage[Index_Aig(adresse)].inversionCDM=1; - if aiguillage[Index_Aig(adresse)].vitesse=0 then begin RadioButtonSans.checked:=true;RadioButton30kmh.checked:=false;RadioButton60kmh.checked:=false;end; - if aiguillage[Index_Aig(adresse)].vitesse=30 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=true;RadioButton60kmh.checked:=false;end; - if aiguillage[Index_Aig(adresse)].vitesse=60 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButton60kmh.checked:=true;end; + if aiguillage[Index_Aig(adresse)].vitesse=0 then begin RadioButtonSans.checked:=true; RadioButton30kmh.checked:=false;RadioButtonSpecifique.checked:=false;RadioButton60kmh.checked:=false;end; + if aiguillage[Index_Aig(adresse)].vitesse=30 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=true; RadioButtonSpecifique.checked:=false;RadioButton60kmh.checked:=false;end; + if aiguillage[Index_Aig(adresse)].vitesse=40 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButtonSpecifique.checked:=true ;RadioButton60kmh.checked:=false;end; + if aiguillage[Index_Aig(adresse)].vitesse=60 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButtonSpecifique.checked:=false;RadioButton60kmh.checked:=true;end; end; if croi then @@ -3787,9 +3857,14 @@ begin Label18.Visible:=false; CheckInverse.checked:=aiguillage[Index_Aig(adresse)].inversionCDM=1; - if aiguillage[Index].vitesse=0 then begin RadioButtonSans.checked:=true;RadioButton30kmh.checked:=false;RadioButton60kmh.checked:=false;end; - if aiguillage[Index].vitesse=30 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=true;RadioButton60kmh.checked:=false;end; - if aiguillage[Index].vitesse=60 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButton60kmh.checked:=true;end; + if aiguillage[Index].vitesse=0 then begin RadioButtonSans.checked:=true;RadioButton30kmh.checked:=false;RadioButtonSpecifique.checked:=false;RadioButton60kmh.checked:=false;end + else + if aiguillage[Index].vitesse=30 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=true;RadioButtonSpecifique.checked:=false;RadioButton60kmh.checked:=false;end + else + if aiguillage[Index].vitesse=60 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButtonSpecifique.checked:=false;RadioButton60kmh.checked:=true;end + else + begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButtonSpecifique.checked:=true;RadioButton60kmh.checked:=false;end ; + EditPointe_BG.Text:=intToSTR(aiguillage[index].Apointe)+aiguillage[index].ApointeB; EditPointe_BG.Hint:=TypeElAIg_to_char(aiguillage[index].Apointe,aiguillage[index].ApointeB); @@ -4034,6 +4109,8 @@ begin picture.Bitmap:=Select_dessin_feu(feux[i].aspect); end; + if feux[i].contrevoie then inverse_image(formCOnfig.ImageSignal,Formprinc.ImageSignal20); + with formconfig do begin MemoCarre.Lines.Clear; @@ -4044,25 +4121,35 @@ begin decodeur:=feux[i].decodeur; ButtonConfigSR.Visible:=false; - //SR - if (decodeur=7) or (decodeur=2) then ButtonConfigSR.Visible:=true; - // unisemaf - if (decodeur=6) then - begin - EditSpecUni.Visible:=true; - LabelUni.Caption:='Spec Unisemaf'; - LabelUni.Visible:=true; - EditSpecUni.Text:=IntToSTR(feux[i].Unisemaf); - editSpecUni.Hint:='Paramètre de description supplémentaire du décodeur Unisemaf'; - editSpecUni.ShowHint:=true; - end; - // digikeijs - if (decodeur=5) then - begin - ButtonConfigSR.Visible:=true ; - end; - if (decodeur<>6) then + case decodeur of + 2,7 : ButtonConfigSR.Visible:=true; + 5 : ButtonConfigSR.Visible:=true ; // digikeijs + 6 : begin + EditSpecUni.Visible:=true; + LabelUni.Caption:='Spec Unisemaf'; + LabelUni.Visible:=true; + EditSpecUni.Text:=IntToSTR(feux[i].Unisemaf); + editSpecUni.Hint:='Paramètre de description supplémentaire du décodeur Unisemaf'; + editSpecUni.ShowHint:=true; + end; + 9 : begin + s:='Décodeur pour signaux belges SNCB - 4 aspects uniquement: '; + labelInfo.Caption:=s+'vert - rouge - double jaune - rouge blanc'; + end; + 10 : begin + s:='Décodeur pour signaux belges SNCB - 6 aspects + chiffre + V '; + labelInfo.Caption:=s; + labelUni.Caption:='Nombre d''adresses';LabelUni.Visible:=true; + editSpecUni.Hint:='Nombre d''adresses occupées par le signal'; + editSpecUni.ShowHint:=true; + EditSpecUni.Visible:=true; + EditSpecUni.Text:=IntToSTR(feux[i].Na); + end + else labelInfo.Caption:=''; + end; + + if (decodeur<>6) and (decodeur<>10) then begin EditSpecUni.Visible:=false;LabelUni.Visible:=false;end; @@ -4074,11 +4161,13 @@ begin 5 : ComboBoxAsp.ItemIndex:=3; 7 : ComboBoxAsp.ItemIndex:=4; 9 : ComboBoxAsp.ItemIndex:=5; + 20 : ComboBoxAsp.ItemIndex:=11; else ComboBoxAsp.ItemIndex:=d-10+4; end; - if ((d=2) or (d>=5)) and (d<10) then checkBoxFB.Visible:=true else checkBoxFB.Visible:=false; + // affiche ou non les checkbox en fonction de l'aspect + if (((d=2) or (d>=5)) and (d<10)) or (d=20) then checkBoxFB.Visible:=true else checkBoxFB.Visible:=false; if d>2 then begin checkFVC.Visible:=true; @@ -4090,10 +4179,34 @@ begin checkFRC.Visible:=false; end; - if (d>3) and (d<10) then CheckVerrouCarre.Visible:=true else CheckVerrouCarre.Visible:=false; + if ((d>3) and (d<10)) or (d=20) then CheckVerrouCarre.Visible:=true else CheckVerrouCarre.Visible:=false; + if d=20 then + begin + CheckBoxVersContrevoie.Visible:=true; + CheckBoxContrevoie.Visible:=true; + CheckBoxContrevoie.Checked:=feux[i].contrevoie; + CheckBoxVersContrevoie.Checked:=feux[i].Verscontrevoie; + + if Feux[i].Btype_suiv1=Aig then s:='Permet d''afficher le chevron sur le signal si l''aiguillage '+intToSTR(Feux[i].Adr_el_suiv1)+' est dévié' + else s:='Permet d''afficher le chevron sur le signal si son aiguillage est dévié;'+char(13)+'mais ce signal n''est pas suivi d''un aiguillage'; + CheckBoxversContrevoie.Hint:=s; + CheckBoxFB.caption:='Avec demande Blanc rouge'; + checkVerrouCarre.Caption:='verrouillable au rouge'; + checkVerrouCarre.Hint:='Positionne le feu au rouge si aucun train n''est présent 3 cantons avant le signal'; + checkFVC.visible:=false; + checkFRC.visible:=false; + end + else + begin + CheckBoxVersContrevoie.Visible:=false; + CheckBoxContrevoie.Visible:=false; + CheckBoxFB.caption:='Avec demande feu blanc'; + checkVerrouCarre.Caption:='verrouillable au carré'; + checkVerrouCarre.Hint:='Positionne le feu au carré si aucun train n''est présent 3 cantons avant le signal'; + end; // signal normal - if d<10 then + if (d<10) or (d>=20) then begin Label17.Caption:='Conditions supplémentaires d''affichage du carré par les aiguillages :'; Label17.Width:=228; @@ -4982,11 +5095,45 @@ begin begin aiguillage[index].vitesse:=30; aiguillage[index].modifie:=true; - end; + end; s:=encode_aig(index); formconfig.RichAig.Lines[ligneclicAig]:=s; end; +procedure vitesse_spec; +var s : string; + AdrAig,erreur,index,v : integer; +begin + if clicliste then exit; + + s:=formconfig.RichAig.Lines[ligneclicAig]; + Val(s,adrAig,erreur); + if AdrAig=0 then exit; + index:=Index_Aig(AdrAig); + if index<>0 then + begin + val(formconfig.editSpecifique.Text,v,erreur); + if (v>=99) or (v<1) or (erreur<>0) then begin FormConfig.labelInfo.Caption:='Erreur vitesse';exit;end; + FormConfig.labelInfo.Caption:=''; + aiguillage[index].vitesse:=v; + aiguillage[index].modifie:=true; + end; + s:=encode_aig(index); + formconfig.RichAig.Lines[ligneclicAig]:=s; +end; + +procedure TFormConfig.EditSpecifiqueChange(Sender: TObject); +begin + if affevt then affiche('Evt edit vitesse spec',clyellow); + vitesse_spec; +end; + +procedure TFormConfig.RadioButtonSpecifiqueClick(Sender: TObject); +begin + if affevt then affiche('Evt RadioBouton vitesse spec',clyellow); + vitesse_spec; +end; + procedure TFormConfig.RadioButton60kmhClick(Sender: TObject); var AdrAig,erreur,index : integer; s : string; @@ -5020,6 +5167,23 @@ begin feux[i].decodeur:=decodeur; Maj_Hint_Signal(i); + case decodeur of + 6 : begin + labelUni.Caption:='Spec Unisemaf';LabelUni.Visible:=true; + EditSpecUni.Visible:=true; + end; + 9 : begin + s:='Décodeur pour signaux belges SNCB - 4 aspects uniquement: '; + labelInfo.Caption:=s+'vert - rouge - double jaune - rouge blanc'; + end; + 10 : begin + s:='Décodeur pour signaux belges SNCB - 6 aspects + chiffre + V '; + labelInfo.Caption:=s; + labelUni.Caption:='Nombre d''adresses';LabelUni.Visible:=true; + EditSpecUni.Visible:=true; + end + else labelInfo.Caption:=''; + end; s:=encode_sig_feux(i); formconfig.RichSig.Lines[ligneclicSig]:=s; aff_champs_sig_feux(i); @@ -5172,7 +5336,7 @@ var s : string; begin if clicliste or (ligneClicSig<0) then exit; if affevt then Affiche('Evt FB',clOrange); - + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetSig then begin feux[ligneClicSig+1].FeuBlanc:=checkBoxFB.Checked; @@ -5814,6 +5978,7 @@ end; procedure TFormConfig.ComboBoxAspChange(Sender: TObject); var x,y,i,index,aspect,adresseFeu : integer; s : string; + bm :tbitmap; begin if clicListe then exit; if affevt then Affiche('Evt aspect',clOrange); @@ -5826,36 +5991,13 @@ begin 3 : aspect:=5; 4 : aspect:=7; 5 : aspect:=9; + 11 : aspect:=20; else aspect:=i+6; end; index:=ligneClicSig+1; // index du feu if index<1 then exit; if NbreFeux10 then + if (feux[index].aspect>10) and (feux[index].aspect<20 )then begin val(EditNbreFeux.Text,i,e); feux[0].EtatSignal:=i; @@ -262,6 +290,44 @@ begin d:=feux[i].decodeur; n:=feux[i].aspect; LabelDec.Caption:=decodeur[d]; + feux[0].decodeur:=d; + feux[0].aspect:=n; + // signal belge + if (n=20) then + begin + Radiocarre.Caption:='Vert jaune horizontal'; + Radioviolet.Caption:='Vert jaune vertical'; + RadioJaune.Caption:='Deux jaunes'; + RadioJauneCli.Caption:='Deux jaunes clignotants'; + RadioBlanc.caption:='Rouge Blanc'; + RadioBlancCli.caption:='Rouge Blanc clignotants'; + + radiovertcli.visible:=false; + radioJaunecli.visible:=false; + radioRougecli.visible:=false; + radioBlanccli.visible:=false; + + groupBox3.Top:=GroupBox2.Top; + groupBox3.Left:=GroupBox2.Left; + groupBox2.Visible:=false; + groupBox3.Visible:=true; + end; + + if n<>20 then + begin + Radiocarre.Caption:='Carré'; + Radioviolet.Caption:='Violet'; + RadioJauneCli.Caption:='Avertissement clignotant'; + RadioJaune.Caption:='Avertissement'; + RadioBlanc.caption:='Blanc'; + RadioBlancCli.caption:='Blanc clignotant'; + radiovertcli.visible:=true; + radioJaunecli.visible:=true; + radioRougecli.visible:=true; + radioBlanccli.visible:=true; + end; + + // checkcarré if (n<4) or (n>10) then checkVerrouCarre.Visible:=false else begin @@ -269,6 +335,31 @@ begin checkVerrouCarre.Checked:=feux[i].VerrouilleCarre; end; + ImagePilote.Parent:=FormPilote; + ImagePilote.Picture.Bitmap.TransparentMode:=tmAuto; + ImagePilote.Picture.Bitmap.TransparentColor:=clblue; + ImagePilote.Transparent:=true; + ImagePilote.Picture.BitMap:=Feux[i].Img.Picture.Bitmap; + LabelTitrePilote.Caption:='Pilotage du signal '+intToSTR(AdrPilote); + feux[0].EtatSignal:=feux[i].EtatSignal; + + if (feux[i].aspect>10) and (feux[i].aspect<20) then + begin + // signaux directionnels + GroupBox1.Visible:=false; + GroupBox2.Visible:=false; + LabelNbFeux.Visible:=true; + EditNbreFeux.Visible:=true; + EditNbreFeux.Text:='1'; + end + else + begin + LabelNbFeux.Visible:=False; + EditNbreFeux.Visible:=false; + GroupBox1.Visible:=true; + if (feux[i].aspect<10) then GroupBox2.Visible:=true else GroupBox2.Visible:=false; + end; + end; procedure TFormPilote.CheckVerrouCarreClick(Sender: TObject); @@ -290,5 +381,23 @@ begin if key=chr(27) then close; end; +procedure TFormPilote.CheckChiffreClick(Sender: TObject); +begin + if checkChiffre.Checked then Maj_Etat_Signal(0,chiffre) else Maj_Etat_Signal(0,chiffre or SetRaz_F); + dessine_feu_pilote; +end; + +procedure TFormPilote.CheckChevronClick(Sender: TObject); +begin + if checkChevron.Checked then Maj_Etat_Signal(0,chevron) else Maj_Etat_Signal(0,chevron or setRaz_F); + dessine_feu_pilote; +end; + +procedure TFormPilote.CheckClignoteClick(Sender: TObject); +begin + if checkclignote.Checked then Maj_Etat_Signal(0,clign) else Maj_Etat_Signal(0,clign or setRaz_F); + dessine_feu_pilote; +end; + begin end. diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 806a977..c6776ab 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -35,8 +35,8 @@ object FormPrinc: TFormPrinc ParentFont = False end object Image9feux: TImage - Left = 416 - Top = 0 + Left = 528 + Top = 8 Width = 57 Height = 105 Picture.Data = { @@ -1205,6 +1205,245 @@ object FormPrinc: TFormPrinc Top = 0 Height = 598 end + object ImageSignal20: TImage + Left = 384 + Top = 8 + Width = 57 + Height = 105 + Picture.Data = { + 07544269746D6170D21C0000424DD21C00000000000036040000280000003900 + 00006900000001000800000000009C1800000000000000000000000100000000 + 000000000000000080000080000000808000800000008000800080800000C0C0 + C000C0DCC000F0CAA6000020400000206000002080000020A0000020C0000020 + E00000400000004020000040400000406000004080000040A0000040C0000040 + E00000600000006020000060400000606000006080000060A0000060C0000060 + E00000800000008020000080400000806000008080000080A0000080C0000080 + E00000A0000000A0200000A0400000A0600000A0800000A0A00000A0C00000A0 + E00000C0000000C0200000C0400000C0600000C0800000C0A00000C0C00000C0 + E00000E0000000E0200000E0400000E0600000E0800000E0A00000E0C00000E0 + E00040000000400020004000400040006000400080004000A0004000C0004000 + E00040200000402020004020400040206000402080004020A0004020C0004020 + E00040400000404020004040400040406000404080004040A0004040C0004040 + E00040600000406020004060400040606000406080004060A0004060C0004060 + E00040800000408020004080400040806000408080004080A0004080C0004080 + E00040A0000040A0200040A0400040A0600040A0800040A0A00040A0C00040A0 + E00040C0000040C0200040C0400040C0600040C0800040C0A00040C0C00040C0 + E00040E0000040E0200040E0400040E0600040E0800040E0A00040E0C00040E0 + E00080000000800020008000400080006000800080008000A0008000C0008000 + E00080200000802020008020400080206000802080008020A0008020C0008020 + E00080400000804020008040400080406000804080008040A0008040C0008040 + E00080600000806020008060400080606000806080008060A0008060C0008060 + E00080800000808020008080400080806000808080008080A0008080C0008080 + E00080A0000080A0200080A0400080A0600080A0800080A0A00080A0C00080A0 + E00080C0000080C0200080C0400080C0600080C0800080C0A00080C0C00080C0 + E00080E0000080E0200080E0400080E0600080E0800080E0A00080E0C00080E0 + E000C0000000C0002000C0004000C0006000C0008000C000A000C000C000C000 + E000C0200000C0202000C0204000C0206000C0208000C020A000C020C000C020 + E000C0400000C0402000C0404000C0406000C0408000C040A000C040C000C040 + E000C0600000C0602000C0604000C0606000C0608000C060A000C060C000C060 + E000C0800000C0802000C0804000C0806000C0808000C080A000C080C000C080 + E000C0A00000C0A02000C0A04000C0A06000C0A08000C0A0A000C0A0C000C0A0 + E000C0C00000C0C02000C0C04000C0C06000C0C08000C0C0A000F0FBFF00A4A0 + A000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFC + FCFCFCFCA4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4FCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFC + A400000000000000000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA4000000 + 00000000000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA400000000000000 + 000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA40000000000000000000000 + 0000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFCFCFCFCFCFCFCFCA4000000000000000000000000000000 + 00A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFCFCFCFCFCFCFCFCA400000000000000000000000000000000A4FCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FCFCFCFCFCFCFCFCA400000000000000000000000000000000A4FCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFC + FCFCFCFCA400000000000000000000000000000000A4FCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFC + A400000000000000000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA4000000 + 00000000000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA400000000000000 + 000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA40000000000000000000000 + 0000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFCFCFCFCFCFCFCFCA4000000000000000000000000000000 + 00A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFCFCFCFCFCFCFCFCA400000000000000000000000000000000A4FCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FCFCFCFCFCFCFCFCA400000000000000000000000000000000A4FCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFC + FCFCFCFCA400000000000000000000000000000000A4FCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFC + A400000000000000000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA4000000 + 00000000000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA400000000000000 + 000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA40000000000000000000000 + 0000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFCFCFCFCFCFCFCFCA4000000000000000000000000000000 + 00A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFCFCFCFCFCFCFCFCA400000000000000000000000000000000A4FCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FCFCFCFCFCFCFCFCA400000000000000000000000000000000A4FCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFC + FCFCFCFCA400000000000000000000000000000000A4FCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFC + A400000000000000000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCA4A4A4A4 + A4A4A4A4A4A4A4A4A4A4A4A4A4A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFC0000000000000000 + 0000000000000000000000FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFC0000FFFFFFFFFFFFFFFFFFFFFF + FFFFFFFFFFFF000000FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFCFCFCFCFCFC00FFFF000000000000000000000000000000 + 0000FFFF0000FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFCFCFCFCFC00FF000000000000000000000000000000000000000000 + FF0000FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FCFCFCFC00FF0000000000000000000000000000000000000000000000FF0000 + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFCFC00 + FF00000000000000000000000000000000000000000000000000FF00FCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCFC00FF00000000 + 00000000000000000000000000000000000000000000FF0000FCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF000000000000000000 + 00000000000000000000000000000000000000FF00FCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF00000000000000000000000000 + 000000000000000000000000000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFC00FF0000000000000000A4A4A4A40000000000 + 000000000000000000000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFC00FF00000000000000A4A4A4A4A4A40000000000000000 + 0000000000000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFC00FF000000000000A4A4A4A4A4A4A4A40000000000000000000000 + 00000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FC00FF000000000000A4A4A4A4A4A4A4A4000000000000000000000000000000 + FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF00 + 0000000000A4A4A4A4A4A4A4A4000000000000000000000000000000FF00FCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF0000000000 + 00A4A4A4A4A4A4A4A4000000000000000000000000000000FF00FCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF00000000000000A4A4 + A4A4A4A400000000000000000000000000000000FF00FCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF0000000000000000A4A4A4A400 + 00000000000000000000000000000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFC00FF0000000000000000000000000000000000 + 000000000000000000000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFC00FF000000000000000000000000000000000000000000 + 0000000000000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFC00FF00000000000000000000000000000000000000000000000000 + 00000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FC00FF0000000000000000000000000000000000000000000000000000000000 + FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF00 + 00000000000000000000000000000000000000000000000000000000FF00FCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF0000000000 + 000000A4A4A4A40000000000000000000000000000000000FF00FCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF00000000000000A4A4 + A4A4A4A400000000000000000000000000000000FF00FCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF000000000000A4A4A4A4A4A4A4 + A4000000000000000000000000000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFC00FF000000000000A4A4A4A4A4A4A4A4000000 + 000000000000000000000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFC00FF000000000000A4A4A4A4A4A4A4A400000000000000 + 0000000000000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFC00FF000000000000A4A4A4A4A4A4A4A40000000000000000000000 + 00000000FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FC00FF00000000000000A4A4A4A4A4A400000000000000000000000000000000 + FF00FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF00 + 00000000000000A4A4A4A40000000000000000000000000000000000FF0000FC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF0000000000 + 00000000000000000000000000000000000000000000000000FF0000FCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF000000000000000000 + 00000000000000000000000000000000000000000000FF0000FCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF00000000000000000000000000 + 00000000000000000000000000000000000000FF0000FCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFC00FF0000000000000000000000000000000000 + 00000000000000000000000000000000FF0000FCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFC00FF000000000000000000000000000000000000000000 + 00000000000000000000000000FF0000FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFC00FF0000000000000000A4A4A4A400000000000000000000000000 + 00000000000000000000FF0000FCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FC00FF00000000000000A4A4A4A4A4A400000000000000000000000000000000 + 00000000000000FF0000FCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF00 + 0000000000A4A4A4A4A4A4A4A400000000000000000000000000000000000000 + 00000000FF0000FCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF0000000000 + 00A4A4A4A4A4A4A4A40000000000000000000000000000000000000000000000 + 00FF0000FCFCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF000000000000A4A4A4 + A4A4A4A4A400000000000000000000000000000000000000000000000000FF00 + 00FCFCFCFCFCFCFCFCFCFC000000FCFCFC00FF000000000000A4A4A4A4A4A4A4 + A40000000000000000000000000000000000000000000000000000FF0000FCFC + FCFCFCFCFCFCFC000000FCFCFC00FF00000000000000A4A4A4A4A4A400000000 + 000000000000000000000000000000000000000000000000FF0000FCFCFCFCFC + FCFCFC000000FCFCFC00FF0000000000000000A4A4A4A4000000000000000000 + 000000000000000000000000000000000000000000FF0000FCFCFCFCFCFCFC00 + 0000FCFCFC00FF00000000000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FF0000FCFCFCFCFCFC000000FCFC + FC00FF0000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000000000FF0000FCFCFCFCFC000000FCFCFC00FF00 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000000000FF0000FCFCFCFC000000FCFCFC00FF0000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 000000000000000000FF00FCFCFCFC000000FCFCFC00FF000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + 0000000000FF00FCFCFCFC000000FCFCFC00FF0000000000000000A4A4A4A400 + 000000000000000000000000000000000000000000A4A4A4A400000000000000 + 00FF00FCFCFCFC000000FCFCFC00FF00000000000000A4A4A4A4A4A400000000 + 00000000000000000000000000000000A4A4A4A4A4A400000000000000FF00FC + FCFCFC000000FCFCFC00FF000000000000A4A4A4A4A4A4A4A400000000000000 + 0000000000000000000000A4A4A4A4A4A4A4A4000000000000FF00FCFCFCFC00 + 0000FCFCFC00FF000000000000A4A4A4A4A4A4A4A40000000000000000000000 + 00000000000000A4A4A4A4A4A4A4A4000000000000FF00FCFCFCFC000000FCFC + FC00FF000000000000A4A4A4A4A4A4A4A4000000000000000000000000000000 + 000000A4A4A4A4A4A4A4A4000000000000FF00FCFCFCFC000000FCFCFC00FF00 + 0000000000A4A4A4A4A4A4A4A4000000000000000000000000000000000000A4 + A4A4A4A4A4A4A4000000000000FF00FCFCFCFC000000FCFCFC00FF0000000000 + 0000A4A4A4A4A4A40000000000000000000000000000000000000000A4A4A4A4 + A4A400000000000000FF00FCFCFCFC000000FCFCFC00FF0000000000000000A4 + A4A4A400000000000000000000000000000000000000000000A4A4A4A4000000 + 0000000000FF00FCFCFCFC000000FCFCFC0000FF000000000000000000000000 + 0000000000000000000000000000000000000000000000000000000000000000 + FF0000FCFCFCFC000000FCFCFCFC00FF00000000000000000000000000000000 + 00000000000000000000000000000000000000000000000000000000FF00FCFC + FCFCFC000000FCFCFCFC0000FF00000000000000000000000000000000000000 + 0000000000000000000000000000000000000000000000FF0000FCFCFCFCFC00 + 0000FCFCFCFCFC0000FF00000000000000000000000000000000000000000000 + 000000000000000000000000000000000000FF0000FCFCFCFCFCFC000000FCFC + FCFCFCFC0000FFFF000000000000000000000000000000000000000000000000 + 00000000000000000000000000FF0000FCFCFCFCFCFCFC000000FCFCFCFCFCFC + FC0000FFFFFF0000000000000000000000000000000000000000000000000000 + 00000000000000FFFF0000FCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFC0000 + 0000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF + FFFFFF000000FCFCFCFCFCFCFCFCFC000000FCFCFCFCFCFCFCFCFCFCFC000000 + 0000000000000000000000000000000000000000000000000000000000000000 + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFCA4A4A4A4A4A4A4A4A4A4A4A4A4A4A4 + A4A4A4A4A4A4A4A4A4A4A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFCA4000000000000000000000000000000000000 + 000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFCA400000000000000000000000000000000000000000000 + 0000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFCA4000000000000000000000000000000000000000000000000A4FC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFC + FCA4000000000000000000000000000000000000000000000000A4FCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCA40000 + 00000000000000000000000000000000000000000000A4FCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCA4000000000000 + 000000000000000000000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000FCFCFCA400000000000000000000 + 0000000000000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFCFCFCFCFC000000FCFCFCA40000000000000000000000000000 + 00000000000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFCFCFCFCFC000000FCFCFCA4000000000000000000000000000000000000 + 000000000000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC + FCFCFC000000FCFCFCA400000000000000000000000000000000000000000000 + 0000A4FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC00 + 0000FCFCFCA4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4A4FC + FCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFCFC000000} + Visible = False + end object ScrollBox1: TScrollBox Left = 630 Top = 200 @@ -1728,23 +1967,23 @@ object FormPrinc: TFormPrinc end object Panel2: TPanel Left = 8 - Top = 32 + Top = 80 Width = 609 - Height = 497 + Height = 449 TabOrder = 11 object SplitterV: TSplitter Left = 1 Top = 1 Width = 8 - Height = 495 + Height = 447 Beveled = True OnMoved = SplitterVMoved end object FenRich: TRichEdit Left = 8 - Top = 16 + Top = 56 Width = 593 - Height = 505 + Height = 465 Color = clBlack Font.Charset = DEFAULT_CHARSET Font.Color = clYellow diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 2c0b2d8..4371cc7 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -8,10 +8,15 @@ Unit UnitPrinc; sinon une exception surgira au moment de l'ouverture du com Dans projet/option/fiches : fiches disponibles : formtco uniquement ******************************************** + Attention si le répertoire d'install n'est pas autorisé, windows10-11 va sauver les fichiers dans + C:\Users\moi\AppData\Local\VirtualStore\Program Files (x86)\Signaux_complexes + il faut autoriser l'utilisateur: Utilisateurs (nom\utilisateurs) + + Pilotage des accessoires: raquette octet sortie - + 2 = aiguillage droit = sortie 2 de l'adresse d'accessoire - - 1 = aiguillage dévié = sortie 1 de l'adresse d'accessoire + + 2 = vert = aiguillage droit = sortie 2 de l'adresse d'accessoire + - 1 = rouge = aiguillage dévié = sortie 1 de l'adresse d'accessoire vitesse port com lenz=57600 @@ -169,6 +174,7 @@ type Coller1: TMenuItem; ButtonAffAnalyseCDM: TButton; Affiche_fenetre_CDM: TMenuItem; + ImageSignal20: TImage; procedure FormCreate(Sender: TObject); procedure MSCommUSBLenzComm(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); @@ -299,8 +305,14 @@ Max_Simule=10000; Max_Event_det_tick=30000; EtatSign : array[0..13] of string[20] =('carré','sémaphore','sémaphore cli','vert','vert cli','violet', 'blanc','blanc cli','jaune','jaune cli','ral 30','ral 60','rappel 30','rappel 60'); -NbDecodeur = 9; -decodeur : array[0..NbDecodeur-1] of string[20] =('rien','Digital Bahn','CDF','LDT','LEB','Digikeijs 4018','Unisemaf Paco','Stéphane Ravaut','Arcomora'); +EtatSignBelge: array[0..11] of string[30]= + ('vert jaune horizontal','rouge','rouge cli','vert','vert cli','vert jaune vertical','rouge blanc','rouge blanc cli', + 'deux jaunes','deux jaunes cli','Chiffre','Chevron'); + + +NbDecodeur = 11; +decodeur : array[0..NbDecodeur-1] of string[20] =('rien','Digital Bahn','CDF','LS-DEC-SNCF','LEB','Digikeijs 4018','Unisemaf Paco','Stéphane Ravaut', + 'Arcomora','LS-DEC-NMBS','B-models'); Etats : array[0..19] of string[30]=('Non commandé', 'carré','sémaphore','sémaphore cli','vert','vert cli','violet','blanc','blanc cli','jaune','jaune cli', 'ralen 30','ralen 60','ralen 60 + jaune cli','rappel 30','rappel 60','rappel 30 + jaune','rappel 30 + jaune cli','rappel 60 + jaune','rappel 60 + jaune cli'); @@ -352,8 +364,8 @@ Taiguillage = record modifie : boolean ; end; -TFeu = record - adresse, aspect : integer; // adresse du signal, aspect (2 feux..9 feux 12=direction 2 feux .. 16=direction 6 feux) +TSignal = record + adresse, aspect : integer; // adresse du signal, aspect (2 feux..9 feux 12=direction 2 feux .. 16=direction 6 feux) (20=signal belge 1) Img : TImage; // Pointeur sur structure TImage du feu Lbl : TLabel; // pointeur sur structure Tlabel du feu checkFB : TCheckBox; // pointeur sur structure Checkbox "demande feu blanc" @@ -361,6 +373,8 @@ TFeu = record checkFV : boolean; // demande feu vert cli FeuVertCli : boolean ; // avec checkbox ou pas FeuRougeCli : boolean ; // avec checkbox ou pas + contrevoie : boolean; // signal de contrevoie (SNCB) + Verscontrevoie : boolean; // signal vers contrevoie (SNCB) FeuBlanc : boolean ; // avec checkbox ou pas decodeur : integer; // type du décodeur // 'rien','DigitalBahn','CDF','LDT','LEB','Digikeijs','Unisemaf','SR' Adr_det1 : integer; // adresse du détecteur1 sur lequel il est implanté @@ -529,7 +543,7 @@ var aiguillage : array[0..NbreMaxiAiguillages] of Taiguillage; // signaux - L'index du tableau n'est pas son adresse CdeDccpp : array[1..MaxCdeDccpp] of string; - feux : array[0..NbreMaxiSignaux] of Tfeu; + feux : array[0..NbreMaxiSignaux] of TSignal; trains_cdm : array[1..Max_Trains] of record nom_train : string; adresse,vitmax : integer; @@ -576,7 +590,7 @@ var etat : boolean; end; end; - Feu_supprime,Feu_sauve : Tfeu; + Feu_supprime,Feu_sauve : TSignal; Aig_supprime,Aig_sauve : TAiguillage; BrancheN : array[1..MaxBranches,1..MaxElBranches] of TBranche; @@ -591,6 +605,7 @@ procedure dessine_feu4(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal procedure dessine_feu5(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer); procedure dessine_feu7(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer); procedure dessine_feu9(Acanvas : Tcanvas;x,y : integer;frX,frY : real;etatsignal : word;orientation : integer); +procedure dessine_feu20(Acanvas : Tcanvas;x,y : integer;frX,frY : real;etatsignal : word;orientation : integer;adresse : integer); procedure dessine_dirN(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation,N : integer); procedure Maj_Etat_Signal(adresse,aspect : integer); procedure Affiche(s : string;lacouleur : TColor); @@ -635,6 +650,7 @@ function BTypeToChaine(BT : TEquipement) : string; function testBit(n : word;position : integer) : boolean; procedure det_contigu(det1,det2 : integer;var suivant : integer;var ElSuiv : TEquipement); Function SetBit(n : word;position : integer) : word; +procedure inverse_image(imageDest,ImageSrc : Timage) ; implementation @@ -762,9 +778,11 @@ procedure cercle(ACanvas : Tcanvas;x,y,rayon : integer;couleur : Tcolor); begin with Acanvas do begin + brush.Style:=bsSolid; brush.Color:=couleur; pen.Color:=clBlack; pen.Width:=1; + pen.Mode:=pmCopy; Ellipse(x-rayon,y-rayon,x+rayon,y+rayon); end; end; @@ -947,7 +965,7 @@ begin LgImage:=Formprinc.Image5feux.Picture.Bitmap.Width; HtImage:=Formprinc.Image5feux.Picture.Bitmap.Height; - + if (orientation=2) then begin //rotation 90° vers la gauche des feux @@ -984,7 +1002,7 @@ begin if not((code=vert_cli) and clignotant) then cercle(ACanvas,xvert,yvert,rayon,GrisF); if not((code=semaphore_cli) and clignotant) then cercle(ACanvas,xSem,ySem,rayon,GrisF); if not((code=jaune_cli) and clignotant) then cercle(ACanvas,xjaune,yjaune,rayon,GrisF); - + //allumages if ((code=semaphore_cli) and (clignotant)) or (code=semaphore) then cercle(ACanvas,xsem,ysem,rayon,clRed); if ((code=blanc_cli) and (clignotant)) or (code=blanc) then cercle(ACanvas,xblanc,yblanc,rayon,clWhite); @@ -1089,7 +1107,7 @@ var rayon, Xrap1,Yrap1,Xrap2,Yrap2,Temp : integer; LgImage,HtImage,xt,yt,code,combine : integer; ech : real; - + begin rayon:=round(6*frX); code_to_aspect(Etatsignal,code,combine); // et aspect @@ -1188,6 +1206,288 @@ begin end; end; +// Ecrire sur un canvas un texte incliné, avec ou sans bordure, monochrome ou à face texturée +procedure AffTexteIncliBordeTexture( C : TCanvas; X,Y : integer; Fonte : tFont; + clBord : TColor; EpBord : integer; PenMode : TPenMode; + Texture : tBitMap; Texte : string; AngleDD : longint); +// params : C = Canvas-cible +// X,Y = Coordonnées angle supérieur gauche du début du texte. +// Fonte = Police de caractères à utiliser : uniquement des fontes scalables. +// clBord = Couleur de la bordure. +// EpBord = Epaisseur de la bordure. +// PenMode = TPenMode : utiliser en général pmCopy. +// Texture = BitMap de texture : Si Texture = Nil alors la face sera de la couleur de Fonte avec un contour de clBord si EpBord > 0. +// Texte = Texte à écrire. +// AngleDD = Angle d'inclinaison en Dixièmes de degré. +var dc : HDC; + lgFont : LOGFONT; + AncFonte,NouvFonte : HFONT; + AncPen,NouvPen : HPEN; + AncBrush,NouvBrush : HBRUSH; +begin + C.Pen.Mode:=PenMode; + dc := C.Handle; + + // Initialisation de la fonte + zeroMemory(@lgFont,sizeOf(lgFont)); + strPCopy(lgFont.lfFaceName,Fonte.Name); + lgFont.lfHeight := Fonte.Height; + if Fonte.style=[] then lgFont.lfWeight:=FW_REGULAR; // Normal + if Fonte.style=[fsBold] then lgFont.lfWeight:=FW_BOLD; // Gras + + if fsItalic in Fonte.style then lgFont.lfItalic:=1; + if fsUnderline in Fonte.style then lgFont.lfUnderline:=1; + if fsStrikeout in Fonte.style then lgFont.lfStrikeout:=1; + + lgFont.lfEscapement:=AngleDD; // Modification de l'inclinaison + + NouvFonte := CreateFontInDirect(lgFont); + AncFonte := SelectObject(dc,NouvFonte); + + // Initialisation du contour : + if EpBord<>0 then NouvPen := CreatePen(PS_SOLID,EpBord,clBord) + else NouvPen := CreatePen(PS_NULL,0,0); + AncPen := SelectObject(dc,NouvPen); + + // Initialisation de la couleur de la police ou de la Texture : + if Texture=nil then NouvBrush := CreateSolidBrush(Fonte.color) + else NouvBrush := CreatePatternBrush(Texture.Handle); + AncBrush := SelectObject(dc,NouvBrush); + // Le contexte doit être transparent + SetBkMode(dc,TRANSPARENT); + + // Dessin du texe : + BeginPath(dc); + TextOut(dc,X,Y,PChar(Texte),length(texte)); //<- au lieu de TextOut(dc,X,Y,PansiChar(Texte),length(texte)) pour rendre le code compatible avec toutes les versions de Delphi (de D2 à XE2); + EndPath(dc); + StrokeAndFillPath(dc); + + // Restauration objets et libération mémoire + SelectObject(dc,AncFonte); + DeleteObject(NouvFonte); + SelectObject(dc,AncPen); + DeleteObject(NouvPen); + SelectObject(dc,AncBrush); + DeleteObject(NouvBrush); + +end; // AffTexteIncliBordeTexture + +// inverse une image horz et la met dans dest +procedure inverse_image(imageDest,ImageSrc : Timage); +var r,mrect,nrect : trect; + larg,haut : integer; +begin + larg:=ImageSrc.Width; + haut:=ImageSrc.Height; + mRect:= rect(0, 0, larg, haut); + nRect:= rect(larg-1,0,-1,haut); + ImageDest.canvas.CopyRect(mRect, ImageSrc.canvas, nRect); +end; + +// dessine les feux sur une cible belge à 5 feux +// cette image peut être inversée (contre voie) +procedure dessine_feu20(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer;adresse : integer); +var xblanc,xvert,xrouge,Yblanc,xjauneBas,xJauneHaut,yJauneBas,yJauneHaut,YVert,Yrouge,largeur, + index,Temp,rayon,LgImage,HtImage,code,combine,x1,y1,x2,y2,x3,y3,xChiffre,yChiffre,xfin,yfin,angle, + AdrAig,IndexAig,vitesse : integer; + ech : real; + inverse,etatChevron,EtatChiffre,codeClignote : boolean; + r : Trect; +begin + code_to_aspect(Etatsignal,code,combine); // et aspect + combine:=etatSignal and $fc00; + // LDT-DEC-NMBS ou b-model + etatChiffre:=testBit(combine,chiffre); + etatChevron:=testBit(combine,chevron); + CodeClignote:=testBit(combine,clign); + largeur:=57; + + rayon:=round(6*frX); + {Xblanc:=12;YBlanc:=51; + Xrouge:=12;Yrouge:=25; + xJauneBas:=12;yJauneBas:=38; + xJauneHaut:=38;yJauneHaut:=12; + xVert:=12;YVert:=12;} + xVert:=15; yvert:=24; + xrouge:=15; yrouge:=37; + xjauneBas:=15;yjauneBas:=50; + xblanc:=15;yblanc:=63; + xJauneHaut:=41;yJauneHaut:=24; + + // chevron + x1:=9;y1:=3; + x2:=16;y2:=10; + x3:=x2+(x2-x1);y3:=y1; + // texte + XChiffre:=14;Ychiffre:=76; + Xfin:=26;yFin:=99; + + index:=index_feu(adresse); + if feux[index].contrevoie then + begin + xvert:=largeur-xvert; + xrouge:=largeur-xrouge; + xjaunebas:=largeur-xjaunebas; + xjaunehaut:=largeur-xjaunehaut; + xblanc:=largeur-xblanc; + x1:=largeur-x1; + x2:=largeur-x2; + x3:=largeur-x3; + Xchiffre:=32; + Xfin:=44; + end; + + if XChiffre>Xfin then echange(Xchiffre,Xfin); + + LgImage:=Formprinc.ImageSignal20.Picture.Bitmap.Width; + HtImage:=Formprinc.ImageSignal20.Picture.Bitmap.Height; + + if (orientation=2) then + begin + //rotation 90° vers la gauche des feux + // calcul des facteurs de réduction pour la rotation + ech:=frY;frY:=frX;FrX:=ech; + Temp:=HtImage-yjauneBas;YJauneBas:=XJauneBas;XjauneBas:=Temp; + Temp:=HtImage-yjauneHaut;YJauneHaut:=XJauneHaut;XjauneHaut:=Temp; + Temp:=HtImage-yblanc;YBlanc:=XBlanc;XBlanc:=Temp; + Temp:=HtImage-yRouge;YRouge:=Xrouge;XRouge:=Temp; + Temp:=HtImage-yvert;Yvert:=Xvert;Xvert:=Temp; + Temp:=HtImage-y1;Y1:=X1;X1:=Temp; + Temp:=HtImage-y2;Y2:=X2;X2:=Temp; + Temp:=HtImage-y3;Y3:=X3;X3:=Temp; + Temp:=HtImage-yChiffre;YChiffre:=XChiffre;XChiffre:=Temp; + Temp:=HtImage-yfin;Yfin:=Xfin;Xfin:=Temp; + end; + + if (orientation=3) then + begin + //rotation 90° vers la droite des feux + // calcul des facteurs de réduction pour la rotation + ech:=frY;frY:=frX;FrX:=ech; + Temp:=LgImage-XjauneBas;XJauneBas:=YJauneBas;YjauneBas:=Temp; + Temp:=LgImage-XJauneHaut;XJauneHaut:=YJauneHaut;YjauneHaut:=Temp; + Temp:=LgImage-Xvert;Xvert:=Yvert;Yvert:=Temp; + Temp:=LgImage-Xrouge;Xrouge:=Yrouge;Yrouge:=Temp; + Temp:=LgImage-Xblanc;Xblanc:=Yblanc;Yblanc:=Temp; + + Temp:=LgImage-x1;X1:=Y1;Y1:=Temp; + Temp:=LgImage-X2;X2:=Y2;Y2:=Temp; + Temp:=LgImage-X3;X3:=Y3;Y3:=Temp; + Temp:=LgImage-XChiffre;XChiffre:=YChiffre;YChiffre:=Temp; + Temp:=LgImage-Xfin;Xfin:=Yfin;Yfin:=Temp; + end; + + XJauneBas:=round(XjauneBas*Frx)+x; YJauneBas:=round(YjauneBas*Fry)+Y; + XJauneHaut:=round(XjauneHaut*Frx)+x; YJauneHaut:=round(YjauneHaut*Fry)+Y; + Xblanc:=round(XBlanc*FrX)+x; YBlanc:=round(YBlanc*FrY)+Y; + Xvert:=round(Xvert*FrX)+x; Yvert:=round(Yvert*FrY)+Y; + Xrouge:=round(Xrouge*FrX)+x; Yrouge:=round(Yrouge*FrY)+Y; + xchiffre:=round(Xchiffre*frx)+x; ychiffre:=round(ychiffre*fry)+y; + xfin:=round(Xfin*frx)+x; yfin:=round(yfin*fry)+y; + x1:=round(X1*frx)+x; y1:=round(y1*fry)+y; + x2:=round(X2*frx)+x; y2:=round(y2*fry)+y; + x3:=round(X3*frx)+x; y3:=round(y3*fry)+y; + + // extinctions + if not((code=vert) and codeclignote and clignotant) then cercle(ACanvas,xvert,yvert,rayon,GrisF); + if not((code=semaphore) and codeclignote and clignotant) then cercle(ACanvas,xrouge,yrouge,rayon,GrisF); + if not((code=rouge_blanc) and codeclignote and clignotant) then + begin + cercle(ACanvas,xBlanc,yBlanc,rayon,GrisF); + cercle(ACanvas,xRouge,yRouge,rayon,GrisF); + end; + if not((code=deux_jaunes) and codeclignote and clignotant) then + begin + cercle(ACanvas,xjaunebas,yjauneBas,rayon,GrisF); + cercle(ACanvas,xjaunehaut,yjauneHaut,rayon,GrisF); + end; + if not((code=vert_jaune_H) and codeclignote and clignotant) then + begin + cercle(ACanvas,xjauneHaut,yjauneHaut,rayon,grisF); + cercle(ACanvas,xvert,yvert,rayon,grisF); + end; + if not((code=vert_jaune_V) and codeclignote and clignotant) then + begin + cercle(ACanvas,xjauneBas,yjauneBas,rayon,grisF); + cercle(ACanvas,xvert,yvert,rayon,grisF); + end; + + + //allumages + if ((code=vert) and codeClignote and clignotant) or ((code=vert) and not(codeclignote)) then cercle(ACanvas,xvert,yvert,rayon,clGreen); + if ((code=semaphore) and codeClignote and clignotant) or ((code=semaphore) and not(codeclignote)) then cercle(ACanvas,xrouge,yrouge,rayon,clRed); + if ((code=rouge_blanc) and codeClignote and clignotant) or ((code=rouge_blanc) and not(codeclignote)) then + begin + cercle(ACanvas,xblanc,yblanc,rayon,clWhite); + cercle(ACanvas,xrouge,yrouge,rayon,clred); + end; + if ((code=deux_jaunes) and codeClignote and clignotant) or ((code=deux_jaunes) and not(codeclignote)) then + begin + cercle(ACanvas,xjauneBas,yjauneBas,rayon,clOrange); + cercle(ACanvas,xjauneHaut,yjauneHaut,rayon,clOrange); + end; + if ((code=vert_jaune_H) and codeClignote and clignotant) or ((code=vert_jaune_H) and not(codeclignote)) then + begin + cercle(ACanvas,xjauneHaut,yjauneHaut,rayon,clorange); + cercle(ACanvas,xvert,yvert,rayon,clgreen); + end; + if ((code=vert_jaune_V) and codeClignote and clignotant) or ((code=vert_jaune_V) and not(codeclignote)) then + begin + cercle(ACanvas,xjaunebas,yjaunebas,rayon,clorange); + cercle(ACanvas,xvert,yvert,rayon,clgreen); + end; + + with Acanvas do + begin + if Etatchevron then pen.color:=ClWhite else pen.color:=clblack; + + // dessine le chevron + pen.Width:=2; + Moveto(x1,y1);Lineto(x2,y2);Lineto(x3,y3); + + // écrit le chiffre + if etatChiffre then + begin + Brush.Color:=clblack; + with font do + begin + Font.Color:=clWhite; + font.Size:=(LargeurCell div 5)+4; + font.Style:=[fsbold]; + end; + + if feux[index].Btype_suiv1=aig then + begin + adrAig:=feux[index].Adr_el_suiv1; + IndexAig:=index_aig(adrAig); + vitesse:=aiguillage[IndexAig].vitesse div 10; + + if orientation=1 then Textout(XChiffre,Ychiffre,intToSTR(vitesse)) + else + begin + case orientation of + 2 : angle:=-900; + 3 : angle:=900; + end; + AffTexteIncliBordeTexture(Acanvas,Xchiffre,Ychiffre,Acanvas.Font,clYellow,0,pmcopy,nil,intToSTR(vitesse),angle); + end; + end; + end + else + begin + // éteint le chiffre + Brush.Color:=clblack; + Pen.Color:=clblack; + r.Left:=xchiffre+1;r.Top:=Ychiffre+1; + r.Right:=Xfin-2;r.Bottom:=Yfin-1; + Fillrect(r); + end; + + end; + + +end; + // dessine les feux sur une cible directionnelle à N feux procedure dessine_dirN(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation,N : integer); @@ -1223,7 +1523,7 @@ begin HtImage:=Height; end; 6 : with Formprinc.Image6Dir.Picture.Bitmap do - begin + begin LgImage:=Width; HtImage:=Height; end; @@ -1435,6 +1735,7 @@ begin 5 : dessine_feu5(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation); 7 : dessine_feu7(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation); 9 : dessine_feu9(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation); + 20 : dessine_feu20(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation,feux[i].adresse); // indicateurs de direction 12..16 : dessine_dirN(CanvasDest,x,y,frx,fry,feux[i].EtatSignal,orientation,aspect-10); end; @@ -1481,28 +1782,7 @@ begin begin TFormPilote.Create(Self); // rajouté show; - ImagePilote.Parent:=FormPilote; - ImagePilote.Picture.Bitmap.TransparentMode:=tmAuto; - ImagePilote.Picture.Bitmap.TransparentColor:=clblue; - ImagePilote.Transparent:=true; - ImagePilote.Picture.BitMap:=Feux[i].Img.Picture.Bitmap; - LabelTitrePilote.Caption:='Pilotage du signal '+intToSTR(AdrPilote); - feux[0].EtatSignal:=feux[i].EtatSignal; - if feux[i].aspect>10 then - begin - GroupBox1.Visible:=false; - GroupBox2.Visible:=false; - LabelNbFeux.Visible:=true; - EditNbreFeux.Visible:=true; - EditNbreFeux.Text:='1'; - end - else - begin - LabelNbFeux.Visible:=False; - EditNbreFeux.Visible:=false; - GroupBox1.Visible:=true; - GroupBox2.Visible:=true; - end; + end; end; @@ -1516,7 +1796,9 @@ begin 5 : Bm:=Formprinc.Image5feux.picture.Bitmap; 7 : Bm:=Formprinc.Image7feux.picture.Bitmap; 9 : Bm:=Formprinc.Image9feux.picture.Bitmap; + 20 : Bm:=Formprinc.ImageSignal20.picture.Bitmap; + // signaux directionnels 12 : Bm:=Formprinc.Image2Dir.picture.Bitmap; 13 : Bm:=Formprinc.Image3Dir.picture.Bitmap; 14 : Bm:=Formprinc.Image4Dir.picture.Bitmap; @@ -1582,9 +1864,17 @@ begin if TypeFeu=3 then feux[rang].EtatSignal:=semaphore_F; if (TypeFeu>3) and (TypeFeu<10) and feux[rang].VerrouCarre then feux[rang].EtatSignal:=carre_F; if (TypeFeu>3) and (TypeFeu<10) and not(feux[rang].VerrouCarre) then feux[rang].EtatSignal:=semaphore_F; + if (TypeFeu>10) and (typeFeu<20) then feux[rang].EtatSignal:=0; - if TypeFeu>10 then feux[rang].EtatSignal:=0; - + if typeFeu=20 then + begin + feux[rang].EtatSignal:=semaphore_F; + if feux[rang].contrevoie then + begin + inverse_image(Feux[rang].Img,Formprinc.ImageSignal20); + feux[rang].EtatSignal:=feux[rang].EtatSignal+clign_F; + end; + end; dessine_feu_mx(Feux[rang].Img.Canvas,0,0,1,1,feux[rang].adresse,1); //if feux[rang].aspect=5 then cercle(Picture.Bitmap.Canvas,13,22,6,ClYellow); end; @@ -2109,10 +2399,25 @@ begin end; // renvoie la chaîne de l'état du signal -function chaine_signal(etat : word) : string; +function chaine_signal(etat,decodeur : word) : string; var aspect,combine : integer; s : string; begin + if decodeur>=9 then + begin + // en signalisation belge, on peut avoir plusieurs bits à 1 simultanément en combine + code_to_aspect(etat,aspect,combine); + combine:=etat and $fc00; + // LDT-DEC-NMBS ou b-model + s:=EtatSignBelge[Aspect]; + if combine<>0 then + begin + if testBit(combine,chiffre) then s:=s+'+'+EtatSignBelge[chiffre]; // bit 10 + if testBit(combine,chevron) then s:=s+'+'+EtatSignBelge[chevron]; // bit 11 + end; + result:=s; + exit; + end; code_to_aspect(etat,aspect,combine); s:=''; if (aspect=16) then s:='' else begin if aspect<>-1 then s:=etatSign[aspect];end; @@ -2127,10 +2432,46 @@ begin chaine_signal:=s; end; -// mise à jour état signal complexe dans le tableau de bits du signal EtatSignalCplx +procedure Maj_Etat_Signal_Belge(adresse,aspect : integer); +var i,code,combine : integer; + etats : word; +// La signalisation combinée est à partir du bit 10 (chiffre, chevron) +begin + if debug=3 then formprinc.Caption:='Maj_Etat_Signal '+IntToSTR(adresse); + i:=index_feu(adresse); +// if testBit(feux[i].EtatSignal,aspect)=false then // si le bit dans l'état du signal n'est pas allumé, procéder. + begin + // signalisation de base + if aspect<=9 then + begin + // razer tous les bits non combinés (de 0 à 9) + etats:=feux[i].EtatSignal and not($03FF); + // et allumer le nouveau + etats:=setbit(etats,aspect); + feux[i].EtatSignal:=etats; + end; + // signalisation combinée + if aspect>=10 then + begin + etats:=feux[i].EtatSignal; + //si le bit 15 est à 1, c'est l'indicateur de raz + if testBit(aspect,setraz) then + begin + etats:=Razbit(etats,setraz); + etats:=RazBit(etats,aspect); + end + else etats:=setBit(etats,aspect); + + feux[i].EtatSignal:=etats; + end; + end; +end; + +// mise à jour état signal complexe francais dans le tableau de bits du signal EtatSignalCplx // adresse : adresse du signal complexe // Aspect : code représentant l'état du signal de 0 à 15 -procedure Maj_Etat_Signal(adresse,aspect : integer); +// La signalisation combinée est à partir du bit 10 (ralen 30) +procedure Maj_Etat_Signal_fr(adresse,aspect : integer); var i : integer; begin // ('0carré','1sémaphore','2sémaphore cli','3vert','4vert cli','5violet', @@ -2185,6 +2526,15 @@ begin if debug=3 then formprinc.Caption:=''; end; +procedure Maj_Etat_Signal(adresse,aspect : integer); +var i,d : integer; +begin + i:=index_feu(adresse); + d:=feux[i].aspect; + if d=20 then Maj_Etat_Signal_belge(adresse,aspect) + else Maj_Etat_Signal_fr(adresse,aspect); +end; + {============================================= envoie les données au décodeur digital bahn équipé du logiciel "led_schalten" sur un panneau directionnel - adresse : adresse du signal - code de 1 à 3 pour allumer @@ -2450,12 +2800,12 @@ begin code:=feux[i].EtatSignal; nombre:=feux[i].Na; // nombre d'adresses occupées par le signal code_to_aspect(code,aspect,combine); - s:='Signal CDF: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal CDF: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[i].decodeur); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); if AffDetSig then begin - s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal); + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal,feux[i].decodeur); AfficheDebug(s,clyellow); end; @@ -2505,12 +2855,12 @@ begin begin code:=feux[index].EtatSignal; //code_to_aspect(code,aspect,combine); - s:='Signal SR: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal SR: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[index].decodeur); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); if AffDetSig then begin - s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[index].EtatSignal); + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[index].EtatSignal,feux[index].decodeur); AfficheDebug(s,clyellow); end; @@ -2571,12 +2921,12 @@ begin begin code:=feux[index].EtatSignal; code_to_aspect(code,aspect,combine); - s:='Signal LEB: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal LEB: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[index].decodeur); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); if AffDetSig then begin - s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[index].EtatSignal); + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[index].EtatSignal,feux[index].decodeur); AfficheDebug(s,clyellow); end; @@ -2625,12 +2975,12 @@ begin code:=feux[index].EtatSignal; asp:=feux[index].aspect; code_to_aspect(code,aspect,combine); - s:='Signal Arcomora: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal Arcomora: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[index].decodeur); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); if AffDetSig then begin - s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[index].EtatSignal); + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[index].EtatSignal,feux[index].decodeur); AfficheDebug(s,clyellow); end; @@ -2744,12 +3094,12 @@ begin begin code:=feux[i].EtatSignal; code_to_aspect(code,aspect,combine); - s:='Signal NMRA: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal NMRA: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[i].decodeur); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); if AffDetSig then begin - s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal); + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal,feux[i].decodeur); AfficheDebug(s,clyellow); end; @@ -2794,12 +3144,12 @@ begin begin code:=feux[index].EtatSignal; code_to_aspect(code,aspect,combine); - s:='Signal Unisemaf: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal Unisemaf: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[index].decodeur); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); if AffDetSig then begin - s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[index].EtatSignal); + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[index].EtatSignal,feux[index].decodeur); AfficheDebug(s,clyellow); end; // pour Unisemaf, la cible est définie dans le champ Unisemaf de la structure feux @@ -3290,20 +3640,100 @@ begin if ((aspect=jaune) or (aspect=jaune_cli)) and (combine=rappel_60) then begin pilote_acc(adresse,1,feu);pilote_acc(adresse+2,2,feu);pilote_acc(adresse+3,2,feu);end; end; - end; + end; + end; +end; + +procedure envoi_b_models(adresse : integer); +var na,code,aspect,combine,mode : integer; + afb,recht,i : integer; + s : string; +begin + i:=index_feu(adresse); + if (feux[i].AncienEtat<>feux[i].EtatSignal) then //; && (stop_cmd==FALSE)) + begin + code:=feux[i].EtatSignal; + code_to_aspect(code,aspect,combine); + s:='Signal b_models: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[i].decodeur); + if traceSign then affiche(s,clOrange); + if Affsignal then afficheDebug(s,clOrange); + if AffDetSig then + begin + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal,feux[i].decodeur); + AfficheDebug(s,clyellow); + end; + na:=feux[i].Na; + // doc VB 5 lampes + chiffre + V + // marqué recht et Afb dans la doc !! + afb:=1; // afb + recht:=2; // recht + if aspect=semaphore then + begin + pilote_acc(adresse,afb,feu); + if (na>=4) and (combine=chiffre) then pilote_acc(adresse+3,afb,feu); // chiffre + if (na>=5) and (combine=chevron) then pilote_acc(adresse+4,afb,feu); // chevron + end; + if aspect=rouge_blanc then + begin + pilote_acc(adresse+2,recht,feu); + if na>=4 then pilote_acc(adresse+3,afb,feu); + if na>=5 then pilote_acc(adresse+4,afb,feu); + end; + if aspect=vert then + begin + pilote_acc(adresse,recht,feu); + if (na>=4) and (combine=chiffre) then pilote_acc(adresse+3,afb,feu); + if (na>=5) and (combine=chevron) then pilote_acc(adresse+4,afb,feu); + end; + if aspect=deux_jaunes then + begin + pilote_acc(adresse+1,afb,feu); + if na>=4 then pilote_acc(adresse+3,afb,feu); + if na>=5 then pilote_acc(adresse+4,afb,feu); + end; + if aspect=vert_jaune_H then + begin + pilote_acc(adresse+1,recht,feu); + if na>=4 then pilote_acc(adresse+3,afb,feu); + if na>=5 then pilote_acc(adresse+4,afb,feu); + end; + if (aspect=vert) and (combine=chiffre) then + begin + pilote_acc(adresse,recht,feu) ; + if na>=4 then pilote_acc(adresse+3,recht,feu); + if na>=5 then pilote_acc(adresse+4,afb,feu); + end; + if (aspect=deux_jaunes) then + begin + pilote_acc(adresse+1,afb,feu) ; + if na>=4 then pilote_acc(adresse+3,recht,feu); + if na>=5 then pilote_acc(adresse+4,afb,feu); + end; + if aspect=vert_jaune_H then + begin + pilote_acc(adresse+1,recht,feu); + if na>=4 then pilote_acc(adresse+3,recht,feu); + if na>=5 then pilote_acc(adresse+4,afb,feu); + end; + if aspect=vert_jaune_V then + begin + pilote_acc(adresse+1,afb,feu) ; + if na>=4 then pilote_acc(adresse+3,afb,feu); + if na>=5 then pilote_acc(adresse+4,recht,feu); + end; + end; end; {========================================================================== -envoie les données au décodeur LDT - adresse=adresse sur le BUS DCC - code=code d'allumage selon l'adressage (ex carre, vert, rappel_30 ..). - mode=mode du décodeur adressé, de 1 à 2 - un décodeur occupe 8 adresses - Le mode 1 permet la commande des signaux de 2, 3 et 4 feux - Le mode 2 permet la commande de signaux de plus de 4 feux -===========================================================================} -procedure envoi_LDT(adresse : integer); +envoie les données au décodeur LDT_nmbs (belge) +seulement 4 aspects !! +rouge +vert +2 jaune (slow approch de la doc ldt) +blanc +} +procedure envoi_ldt_nmbs(adresse : integer); var code,aspect,combine,mode : integer; i : integer; s : string; @@ -3313,12 +3743,47 @@ begin begin code:=feux[i].EtatSignal; code_to_aspect(code,aspect,combine); - s:='Signal LDT: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal LDT_NMBS: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[i].decodeur); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); if AffDetSig then begin - s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal); + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal,feux[i].decodeur); + AfficheDebug(s,clyellow); + end; + if aspect=vert then begin pilote_acc(adresse,2,feu);end; + if aspect=semaphore then begin pilote_acc(adresse,1,feu);end; + if aspect=deux_jaunes then begin pilote_acc(adresse+1,2,feu);end; + if aspect=vert_jaune_H then begin pilote_acc(adresse+1,1,feu);end; + // a voir!!! + end; +end; + +{========================================================================== +envoie les données au décodeur LDT_sncf + adresse=adresse sur le BUS DCC + code=code d'allumage selon l'adressage (ex carre, vert, rappel_30 ..). + mode=mode du décodeur adressé, de 1 à 2 + un décodeur occupe 8 adresses + Le mode 1 permet la commande des signaux de 2, 3 et 4 feux + Le mode 2 permet la commande de signaux de plus de 4 feux +===========================================================================} +procedure envoi_LDT_sncf(adresse : integer); +var code,aspect,combine,mode : integer; + i : integer; + s : string; +begin + i:=index_feu(adresse); + if (feux[i].AncienEtat<>feux[i].EtatSignal) then //; && (stop_cmd==FALSE)) + begin + code:=feux[i].EtatSignal; + code_to_aspect(code,aspect,combine); + s:='Signal LDT: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[i].decodeur); + if traceSign then affiche(s,clOrange); + if Affsignal then afficheDebug(s,clOrange); + if AffDetSig then + begin + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal,feux[i].decodeur); AfficheDebug(s,clyellow); end; @@ -3370,7 +3835,7 @@ begin begin code:=feux[i].EtatSignal; code_to_aspect(code,aspect,combine); - s:='Signal virtuel: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal virtuel: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[i].decodeur); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); end; @@ -3459,12 +3924,12 @@ begin code:=feux[i].EtatSignal; nombre:=feux[i].Na; // nombre d'adresses occupées par le signal code_to_aspect(code,aspect,combine); - s:='Signal digikeijs 4018: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal digikeijs 4018: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[i].decodeur); if traceSign then affiche(s,clOrange); if Affsignal then afficheDebug(s,clOrange); if AffDetSig then begin - s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal); + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal,feux[i].decodeur); AfficheDebug(s,clyellow); end; @@ -3517,12 +3982,12 @@ begin begin code:=feux[i].EtatSignal; code_to_aspect(code,aspect,combine); - s:='Signal Bahn: ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal Bahn: ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[i].decodeur); if traceSign then affiche(s,clOrange); if Affsignal or traceListe then afficheDebug(s,clOrange); if AffDetSig then begin - s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal); + s:='Tick='+IntToSTR(tick)+' Signal '+IntToSTR(adresse)+'='+chaine_signal(feux[i].EtatSignal,feux[i].decodeur); AfficheDebug(s,clyellow); end; //Affiche(IntToSTR(aspect)+' '+inttoSTR(combine),clOrange); @@ -3633,19 +4098,21 @@ begin if (feux[i].AncienEtat<>feux[i].EtatSignal) then begin - if feux[i].aspect<10 then // si signal non directionnel + if (feux[i].aspect<10) or (feux[i].aspect>=20) then // si signal non directionnel begin // envoie la commande au décodeur case feux[i].decodeur of 0 : envoi_virtuel(Adr); 1 : envoi_signalBahn(Adr); 2 : envoi_CDF(Adr); - 3 : envoi_LDT(Adr); + 3 : envoi_LDT_sncf(Adr); 4 : envoi_LEB(Adr); 5 : digi_4018(Adr); 6 : envoi_UniSemaf(Adr); 7 : envoi_SR(Adr); 8 : envoi_arcomora(Adr); + 9 : envoi_ldt_nmbs(adr); + 10 : envoi_b_models(adr); end; // Gestion démarrage temporisé des trains si on quitte le rouge : ne fonctionne qu'en roulage @@ -3730,6 +4197,7 @@ begin 14 : ImageFeu:=Formprinc.Image4Dir; 15 : ImageFeu:=Formprinc.Image5Dir; 16 : ImageFeu:=Formprinc.Image6Dir; + 20 : ImageFeu:=formprinc.ImageSignal20; else ImageFeu:=Formprinc.Image3feux; end; TailleY:=ImageFeu.picture.BitMap.Height; // taille du feu d'origine (verticale) @@ -5655,7 +6123,7 @@ begin exit; end; - if feux[i].aspect>10 then + if (feux[i].aspect>10) and (feux[i].aspect<20) then begin s:='La demande de carré d''un signal directionnel '+IntToSTR(Adresse)+' est irrecevable'; Affiche(s,clred); @@ -5977,7 +6445,7 @@ begin AdrSignalsuivant:=0; exit; end; - if feux[i].aspect>10 then + if (feux[i].aspect>10) and (feux[i].aspect<20) then begin s:='La demande de l''état du signal suivant depuis un feu directionnel '+IntToSTR(Adresse)+' est irrecevable'; Affiche(s,clred); @@ -6130,7 +6598,7 @@ begin end; // renvoie l'adresse de la première aiguille déviée après le signal "adresse" et ce jusqu'au prochain signal -// sinon renvoie 0 +// sinon il n'y a pas d'aiguille ou si pas dévié, renvoie 0 // adresse=adresse du signal function Aiguille_deviee(adresse : integer) : integer ; var AdrFeu,i,j,prec,AdrSuiv,Actuel,index,index2,voie : integer; @@ -6789,6 +7257,129 @@ begin PresTrainPrec:=Pres_Train; end; +// met à jour l'état du signel belge selon l'environnement des aiguillages et des trains +procedure signal_belge(Adrfeu : integer;detect : boolean); +var adrAig,adr_det,adr_el_suiv,AdrTrainLoc,voie,indexAig,aiguille,etat,AdrSignalsuivant : integer; + Btype_el_suivant : TEquipement; + car,presTrain,reserveTrainTiers,Aff_Semaphore : boolean; + s: string; +begin + if affsignal=false then + begin + if signalDebug=AdrFeu then AffSignal:=true + else affsignal:=false; + end; + if AffSignal then + begin + s:='Traitement du signal '+intToSTR(Adrfeu)+'------------------------------------'; + AfficheDebug(s,clOrange); + nivDebug:=3; + end; + + + + if affSignal then AfficheDebug('Signal belge',clOrange); + + index:=Index_feu(AdrFeu); + Adr_det:=Feux[index].Adr_det1; // détecteur sur le signal + Adr_El_Suiv:=Feux[index].Adr_el_suiv1; // adresse élément suivant au feu + Btype_el_suivant:=Feux[index].Btype_suiv1; + PresTrain:=false; + + // détecteurs précédent le feu , pour déterminer si leurs mémoires de zones sont à 1 pour libérer le carré + //if (Feux[index].VerrouCarre) and (modele>=4) then + presTrain:=PresTrainPrec(AdrFeu,Nb_cantons_Sig,false,AdrTrainLoc,voie); //etape A // présence train par adresse train ; renvoie l'adresse du train dans AdrTrainLoc + if AffSignal and roulage then AfficheDebug('L''@ du train avant le signal est '+intToSTR(AdrTrainLoc),clYellow); + + // si le signal peut afficher un carré et les aiguillages après le signal sont mal positionnées ou aig réservé ou que pas présence train avant signal et signal + // verrouillable au carré, afficher un carré + + car:=carre_signal(AdrFeu,AdrTrainLoc,reserveTrainTiers); // si reserveTrainTiers, réservé par un autre train + if AffSignal and reserveTrainTiers then AfficheDebug('trouvé aiguillage réservé par autre train',clYellow); + if AffSignal and car then AfficheDebug('le signal a des aiguilles en talon aval mal positionnées',clYellow); + // En mode roulage, si la réservation est faite par le train détecté en étape A, ne pas verrouiller au carré + if roulage then car:=reserveTrainTiers or car; + + // conditions supplémentaires de carré en fonction des aiguillages décrits + car:=cond_carre(AdrFeu) or car; + if AffSignal and feux[index].VerrouilleCarre then AfficheDebug('le signal est verrouillé au carré',clYellow); + + + if (Feux[index].VerrouCarre and not(presTrain)) or car + then Maj_Etat_Signal_belge(AdrFeu,semaphore) + else + begin + // si on quitte le détecteur on affiche un sémaphore : tester le sens de circulation + // pour ne pas passer au rouge un feu à contresens. + // trouver la mémoire de zone MemZone[Adr_det,?] qui a déclenché le feu rouge + if AffSignal then AfficheDebug('test du sémaphore',clYellow); + Aff_semaphore:=test_memoire_zones(AdrFeu); // test si présence train après signal + if Aff_Semaphore then + begin + if AffSignal then AfficheDebug('Présence train après signal'+intToSTR(AdrFeu)+' -> sémaphore ou carré',clYellow); + if testBit(feux[index].EtatSignal,carre)=FALSE then + begin + if feux[index].checkFR then Maj_Etat_Signal_belge(AdrFeu,semaphore_cli) + else Maj_Etat_Signal_belge(AdrFeu,semaphore); + end; + end + else + begin + // si aiguillage au pied du signal avec chevron + if feux[index].Btype_suiv1=aig then + begin + adrAig:=feux[index].Adr_el_suiv1; + IndexAig:=index_aig(adrAig); + + if aiguillage[IndexAig].position=const_devie then + begin + if feux[index].verscontrevoie then Maj_Etat_Signal_belge(AdrFeu,chevron) else Maj_Etat_Signal_belge(AdrFeu,chevron or setRaz_F); + if aiguillage[indexAig].vitesse<>0 then Maj_Etat_Signal_belge(AdrFeu,chiffre) + else + Maj_Etat_Signal_belge(AdrFeu,chiffre or setRaz_F); + end + else begin Maj_Etat_Signal_belge(AdrFeu,chiffre or setRaz_F); Maj_Etat_Signal_belge(AdrFeu,chevron or setRaz_F);end; + end; + etat:=etat_signal_suivant(AdrFeu,1,AdrSignalsuivant) ; // état du signal suivant + adresse du signal suivant dans Signal_Suivant + if adrSignalSuivant=0 then Maj_Etat_Signal_belge(AdrFeu,semaphore) + else + begin + if TestBit(etat,semaphore) or TestBit(etat,carre) or TestBit(etat,rouge_blanc) then Maj_Etat_Signal_belge(AdrFeu,deux_jaunes) + else + begin + if testBit(etat,chiffre) then + begin + Maj_Etat_Signal_belge(AdrFeu,vert_jaune_H) + end + else + // aiguille signal suivant droite + begin + if AffSignal then AfficheDebug('pas d''aiguille déviée',clYellow); + // feu vert, vert cli ou blanc + //if affsignal then AfficheDebug('test 405',clyellow); + if feux[index].checkFB<>nil then + begin + //if affsignal then AfficheDebug('test 406',clyellow); + if feux[index].checkFB.Checked then + Maj_Etat_Signal_belge(AdrFeu,rouge_blanc) + else Maj_Etat_Signal_belge(AdrFeu,vert); + end + else + begin + if feux[index].checkFV then Maj_Etat_Signal_belge(AdrFeu,vert_cli) + else Maj_Etat_Signal_belge(AdrFeu,vert); + //if affsignal then AfficheDebug('Mise du feu au vert',clyellow); + end; + end; + end; + end; + end; + end; + envoi_signal(AdrFeu); + if signalDebug=AdrFeu then begin AffSignal:=false;nivDebug:=0;end; + if debug=3 then formprinc.Caption:=''; +end; + // mise à jour de l'état d'un signal en fonction de son environnement et affiche le signal // AdrFeu: adresse du signal @@ -6815,15 +7406,22 @@ begin index:=index_feu(Adrfeu); if (Nivdebug>=1) then AfficheDebug('Proc Maj_feu '+IntToSTR(adrFeu),clorange); - if (AdrFeu<>0) and (index<>0) then - begin + if (AdrFeu=0) or (index=0) then exit; + modele:=Feux[index].aspect; + + if modele=20 then + begin + signal_belge(AdrFeu,detect); + exit; + end; + Adr_det:=Feux[index].Adr_det1; // détecteur sur le signal Adr_El_Suiv:=Feux[index].Adr_el_suiv1; // adresse élément suivant au feu Btype_el_suivant:=Feux[index].Btype_suiv1; // signal directionnel ? - if (modele>10) then + if (modele>10) and (modele<20) then begin //Affiche('Signal directionnel '+IntToSTR(AdrFeu),clyellow); Signal_direction(AdrFeu); @@ -6889,7 +7487,7 @@ begin //if AffSignal and car then AfficheDebug('le signal a des aiguilles en talon aval mal positionnées',clYellow); if AffSignal and feux[index].VerrouilleCarre then AfficheDebug('le signal est verrouillé au carré',clYellow); - if (modele>=4) and Feux[index].VerrouCarre and + if (modele>=4) and Feux[index].VerrouCarre and ( (not(PresTrain) or car or feux[index].Verrouillecarre) ) then Maj_Etat_Signal(AdrFeu,carre) else begin @@ -6999,7 +7597,7 @@ begin end; end; end; - end; + envoi_signal(AdrFeu); if signalDebug=AdrFeu then begin AffSignal:=false;nivDebug:=0;end; if debug=3 then formprinc.Caption:=''; @@ -11521,9 +12119,10 @@ end; // timer à 100 ms procedure TFormPrinc.Timer1Timer(Sender: TObject); -var aspect,i,a,x,y,Bimage,adresse,TailleX,TailleY,orientation : integer; +var aspect,i,a,x,y,Bimage,combine,adresse,TailleX,TailleY,orientation : integer; imageFeu : Timage; frx,fry : real; + faire : boolean; s : string; begin inc(tick); @@ -11560,12 +12159,23 @@ begin begin a:=feux[i].EtatSignal; // a = état binaire du feu adresse:=feux[i].adresse; - if TestBit(a,jaune_cli) or TestBit(a,ral_60) or - TestBit(a,rappel_60) or testBit(a,semaphore_cli) or - testBit(a,vert_cli) or testbit(a,blanc_cli) then + // signal belge + if feux[i].aspect=20 then begin - Dessine_feu_mx(Feux[i].Img.Canvas,0,0,1,1,adresse,1); - //Affiche('Clignote feu '+IntToSTR(adresse),clyellow); + // signal belge + if TestBit(a,clign) then + begin + Dessine_feu_mx(Feux[i].Img.Canvas,0,0,1,1,adresse,1); + end; + end + else + begin + // signal français + if TestBit(a,jaune_cli) or TestBit(a,ral_60) or + TestBit(a,rappel_60) or testBit(a,semaphore_cli) or + testBit(a,vert_cli) or testbit(a,blanc_cli) then + Dessine_feu_mx(Feux[i].Img.Canvas,0,0,1,1,adresse,1); + //Affiche('Clignote feu '+IntToSTR(adresse),clyellow); end; end; @@ -11583,9 +12193,17 @@ begin adresse:=TCO[x,y].adresse; i:=index_feu(adresse); a:=feux[i].EtatSignal; // a = état binaire du feu - if TestBit(a,jaune_cli) or TestBit(a,ral_60) or - TestBit(a,rappel_60) or testBit(a,semaphore_cli) or - testBit(a,vert_cli) or testbit(a,blanc_cli) then + faire:=false; + if feux[i].aspect<>20 then + faire:=TestBit(a,jaune_cli) or TestBit(a,ral_60) or + TestBit(a,rappel_60) or testBit(a,semaphore_cli) or + testBit(a,vert_cli) or testbit(a,blanc_cli) + else + begin + combine:=a and $fc00; + faire:=testBit(combine,clign); + end; + if faire then begin aspect:=feux[index_feu(adresse)].Aspect; case aspect of @@ -11613,13 +12231,25 @@ begin if AdrPilote<>0 then begin a:=feux[0].EtatSignal; - if TestBit(a,jaune_cli) or TestBit(a,ral_60) or - TestBit(a,rappel_60) or testBit(a,semaphore_cli) or - testBit(a,vert_cli) or testbit(a,blanc_cli) then - Dessine_feu_pilote; // dessiner le feu en fonction du bit "clignotant" + if feux[0].aspect<>20 then + begin + if TestBit(a,jaune_cli) or TestBit(a,ral_60) or + TestBit(a,rappel_60) or testBit(a,semaphore_cli) or + testBit(a,vert_cli) or testbit(a,blanc_cli) then + Dessine_feu_pilote; // dessiner le feu en fonction du bit "clignotant" + end + else + begin + if feux[0].aspect=20 then + begin + // signal belge + if TestBit(a,clign) then Dessine_feu_pilote; + end; + end; + end; - // fenetre de config du signal CDF + // fenetre de config du signal CDF if dessineCDF then begin a:=feux[0].EtatSignal; @@ -11846,7 +12476,8 @@ end; procedure TFormprinc.proc_checkBoxFB(Sender : Tobject); var s : string; Cb : TcheckBox; - etat,adresse : integer; + etat : word; + aspect,combine,adresse : integer; i : word; coche : boolean; begin @@ -11859,8 +12490,9 @@ begin i:=index_feu(adresse); if i=0 then exit; etat:=feux[i].EtatSignal; + code_to_aspect(etat,aspect,combine); // si le feu est vert et que la coche est mise, substituer le blanc - if ((etat=vert_F) or (etat=vert_cli_F)) and coche then + if ((aspect=vert) or (aspect=vert_cli)) and coche then begin Maj_Etat_Signal(Adresse,blanc); Envoi_signauxCplx; @@ -13511,7 +14143,7 @@ end; procedure TFormPrinc.Informationsdusignal1Click(Sender: TObject); var s: string; - i,aspect,combine,adresse,aig,trainReserve,AdrSignalsuivant,voie : integer; + etat,index,i,k,aspect,n,combine,adresse,aig,trainReserve,AdrSignalsuivant,voie : integer; reserveTrainTiers : boolean; code : word; begin @@ -13521,18 +14153,20 @@ begin adresse:=extract_int(s); // extraire l'adresse (ex 260) i:=index_feu(Adresse); - if feux[i].aspect>10 then exit; + n:=feux[i].aspect; + if (n>10) and (n<20) then exit; code:=feux[i].EtatSignal; code_to_aspect(code,aspect,combine); - s:='Signal ad'+IntToSTR(adresse)+'='+chaine_signal(code); + s:='Signal ad'+IntToSTR(adresse)+'='+chaine_signal(code,feux[i].decodeur); Affiche(s,clYellow); //Affiche(IntToSTR(aspect),clred); //Affiche(IntToSTR(combine),clred); + s:='Le signal '+intToSTR(adresse)+' présente '+chaine_signal(code,feux[i].decodeur)+' car '; // carré - if aspect=0 then + if (aspect=carre) and (n<>20) then begin - Affiche('Le signal '+intToSTR(adresse)+' est au carré car ',clyellow); + Affiche(s,clyellow); if carre_signal(Adresse,trainreserve,reserveTrainTiers) then affiche('les aiguillages en aval du signal sont mal positionnés ou leur positions inconnues',clyellow) ; if reserveTrainTiers then affiche('un aiguillage ou un croisement en aval du signal sont réservés par un autre train ',clyellow); if Cond_Carre(Adresse) then affiche_suivi('les aiguillages déclarés dans la définition du signal sont mal positionnés',clyellow); @@ -13540,39 +14174,73 @@ begin if test_memoire_zones(Adresse) then affiche('présence train dans canton suivant le signal',clyellow); if feux[i].VerrouilleCarre then affiche('le signal est verrouillé au carré dans la fenêtre de pilotage',clYellow); end; - if aspect=1 then + + if (aspect=vert_jaune_H) and (n=20) then begin - Affiche('Le signal '+intToSTR(adresse)+' est au sémaphore car ',clyellow); - if test_memoire_zones(Adresse) then affiche_suivi('présence train dans canton après le signal',clyellow); + etat:=etat_signal_suivant(Adresse,1,AdrSignalsuivant) ; // état du signal suivant + adresse du signal suivant dans Signal_Suivant + if testbit(etat,chiffre) then + begin + s:=s+'le signal suivant '+intToSTR(adrSignalSuivant)+' affiche une réduction de vitesse '; + Affiche(s,clyellow); + end; end; - // avertissement - if aspect=8 then + + + if aspect=semaphore then + begin + Affiche(s,clyellow); + if test_memoire_zones(Adresse) then affiche_suivi('présence train dans canton après le signal',clyellow); + if n=20 then + begin + // signal belge + if carre_signal(Adresse,trainreserve,reserveTrainTiers) then affiche('les aiguillages en aval du signal sont mal positionnés ou leur positions inconnues',clyellow) ; + if reserveTrainTiers then affiche('un aiguillage ou un croisement en aval du signal sont réservés par un autre train ',clyellow); + if Cond_Carre(Adresse) then affiche_suivi('les aiguillages déclarés dans la définition du signal sont mal positionnés',clyellow); + if feux[i].VerrouCarre and not(PresTrainPrec(Adresse,Nb_cantons_Sig,false,TrainReserve,voie)) then affiche('le signal est verrouillable au carré et aucun train n''est présent avant le signal',clyellow); + if test_memoire_zones(Adresse) then affiche('présence train dans canton suivant le signal',clyellow); + if feux[i].VerrouilleCarre then affiche('le signal est verrouillé au carré dans la fenêtre de pilotage',clYellow); + end; + end; + // avertissement ou deux-jaunes (belge) + if aspect=jaune then begin i:=etat_signal_suivant(Adresse,1,AdrSignalsuivant); - Affiche('Le signal '+intToSTR(adresse)+' est à l''avertissement car son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(i),clyellow); + index:=index_feu(AdrSignalSuivant); + Affiche(s+'son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(i,feux[index].decodeur),clyellow); end; // avertissement cli - if aspect=9 then + if aspect=jaune_cli then begin i:=etat_signal_suivant(Adresse,1,AdrSignalsuivant); - Affiche('Le signal '+intToSTR(adresse)+' est au jaune cli car son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(i),clyellow); + index:=index_feu(AdrSignalSuivant); + Affiche(s+'son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(i,feux[index].decodeur),clyellow); end; // ralen 30 - if combine=10 then + if (combine=10) and (n<>20) then begin i:=etat_signal_suivant(Adresse,1,AdrSignalsuivant); - Affiche('Le signal '+intToSTR(adresse)+' est au ralentissement 30 car son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(i),clyellow); + index:=index_feu(AdrSignalSuivant); + Affiche(s+'son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(i,feux[index].decodeur),clyellow); end; - if combine=11 then + if (combine=11) and (n<>20) then begin i:=etat_signal_suivant(Adresse,1,AdrSignalsuivant); - Affiche('Le signal '+intToSTR(adresse)+' est au ralentissement 60 car son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(i),clyellow); + index:=index_feu(AdrSignalSuivant); + Affiche(s+'car son signal suivant '+intToSTR(AdrSignalsuivant)+' est au '+chaine_signal(i,feux[index].decodeur),clyellow); end; - if (combine=12) or (combine=13) then + if ((combine=12) or (combine=13)) and (n<>20) then begin Aig:=Aiguille_deviee(Adresse); // si aiguille locale déviée - if (aig<>0) then Affiche('Le signal '+intToSTR(adresse)+' est à rappel 30 car l''aiguillage suivant '+intToSTR(Aig)+' est dévié',clyellow); + if (aig<>0) then Affiche(s+'l''aiguillage suivant '+intToSTR(Aig)+' est dévié',clyellow); + end; + + // chiffre et signal belge + if (combine=10) and (n=20) then + begin + aig:=feux[i].Adr_el_suiv1; + aig:=index_aig(aig); + Affiche(s+'le signal doit être franchi à <'+intToSTR(aiguillage[aig].vitesse)+'km/h',clyellow); end; end; @@ -14023,6 +14691,6 @@ begin end; - + end. diff --git a/UnitTCO.dfm b/UnitTCO.dfm index 0686535..917e677 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -1,6 +1,6 @@ object FormTCO: TFormTCO - Left = 195 - Top = 62 + Left = 4 + Top = 99 Width = 1141 Height = 678 VertScrollBar.Visible = False @@ -81,16 +81,16 @@ object FormTCO: TFormTCO ParentFont = False end object ImageTemp: TImage - Left = 888 - Top = 96 - Width = 97 - Height = 97 + Left = 952 + Top = 64 + Width = 121 + Height = 121 end object ImageTemp2: TImage - Left = 888 - Top = 208 - Width = 97 - Height = 97 + Left = 952 + Top = 200 + Width = 121 + Height = 121 end object ScrollBox: TScrollBox Left = 8 diff --git a/UnitTCO.pas b/UnitTCO.pas index 52b33d7..121fd1c 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -450,6 +450,7 @@ procedure grise_ligne_tco; procedure change_couleur_fond; function verif_cellule(x,y,Bim : integer) : boolean; procedure dessine_icones; +procedure echange(var a,b : integer); implementation @@ -478,6 +479,7 @@ var fichier : textfile; end; begin + //Affiche(GetCurrentDir,clYellow); {$I+} try assign(fichier,'tco.cfg'); @@ -4309,7 +4311,7 @@ end; // Affiche dans le TCO en x,y un signal à 90° d'après l'image transmise // x y en coordonnées pixels -procedure Feu_90G(ImageSource : TImage;x,y : integer;FrX,FrY : real); +procedure Feu_90G(ImageSource : TImage;x,y : integer;FrX,FrY : real;inverse : boolean); var p : array[0..2] of TPoint; TailleY,TailleX : integer; begin @@ -4323,9 +4325,17 @@ begin p[1].Y:=TailleX; //49; p[2].X:=0; //0; p[2].Y:=0; //0; - // copie l'image du signal depuis imagesource vers image temporaire à la même échelle mais retournée à 90° - PlgBlt(PImageTemp.Canvas.Handle,p,ImageSource.Canvas.Handle,0,0,TailleX,TailleY,0,0,0); + if inverse then + begin + inverse_image(FormTCO.ImageTemp2,ImageSource); + // copie l'image du signal depuis imagesource vers image temporaire à la même échelle mais retournée à 90° + PlgBlt(PImageTemp.Canvas.Handle,p,FormTCO.ImageTemp2.Canvas.Handle,0,0,TailleX,TailleY,0,0,0); + end + else + PlgBlt(PImageTemp.Canvas.Handle,p,ImageSource.Canvas.Handle,0,0,TailleX,TailleY,0,0,0); + + //PimageTemp.Visible:=true; // copie l'image du signal retournée depuis image temporaire vers tco avec une réduction en mode transparennt TransparentBlt(PcanvasTCO.Handle,x,y,round(TailleY*FrY),round(TailleX*FrX), // destination PImageTemp.Canvas.Handle,0,0,TailleY,TailleX,clBlue); // source - clblue est la couleur de transparence @@ -4333,7 +4343,7 @@ begin end; // copie de l'image du signal à 90° dans le canvas source et le tourne de 90° et le met dans l'image temporaire -procedure Feu_90D(ImageSource : TImage;x,y : integer ; FrX,FrY : real); +procedure Feu_90D(ImageSource : TImage;x,y : integer ; FrX,FrY : real;inverse : boolean); var p : array[0..2] of TPoint; TailleY,TailleX : integer; begin @@ -4347,8 +4357,15 @@ begin p[1].Y:=0; p[2].X:=TailleY; //90; p[2].Y:=TailleX; //49; - // copie l'image du signal depuis imagesource vers image temporaire à la même échelle mais retournée à 90° - PlgBlt(PImageTemp.Canvas.Handle,p,ImageSource.Canvas.Handle,0,0,TailleX,TailleY,0,0,0); + + if inverse then + begin + inverse_image(FormTCO.ImageTemp2,ImageSource); + // copie l'image du signal depuis imagesource vers image temporaire à la même échelle mais retournée à 90° + PlgBlt(PImageTemp.Canvas.Handle,p,FormTCO.ImageTemp2.Canvas.Handle,0,0,TailleX,TailleY,0,0,0); + end + else + PlgBlt(PImageTemp.Canvas.Handle,p,ImageSource.Canvas.Handle,0,0,TailleX,TailleY,0,0,0); // et copier l'image avec mise à l'échelle tournée sur le TCO TransparentBlt(PcanvasTCO.Handle,x,y,round(tailleY*FrY),round(tailleX*FrX), @@ -4682,6 +4699,7 @@ begin // if (tco[x-1,y].BImage=12) and (tco[x-1,y].FeuOriente=3) then exit; end; } + if (x>NbreCellX) or (y>NbreCellY) or (x<1) or (y<1) then exit; x0:=(x-1)*LargeurCell; y0:=(y-1)*HauteurCell; @@ -4700,12 +4718,13 @@ begin end; // Dessine un signal dans le canvasDest en x,y , dont l'adresse se trouve à la cellule x,y -procedure dessin_feu(CanvasDest : Tcanvas;x,y : integer ); -var x0,y0,xp,yp,orientation,adresse,aspect,PiedFeu,TailleX,TailleY : integer; +procedure dessin_Signal(CanvasDest : Tcanvas;x,y : integer ); +var index,x0,y0,xp,yp,orientation,adresse,aspect,PiedFeu,TailleX,TailleY : integer; ImageFeu : Timage; frX,frY : real; begin //Efface_Cellule(CanvasDest,x,y,pmCopy); + if (x>NbreCellX) or (y>NbreCellY) or (x<1) or (y<1) then exit; xp:=(x-1)*LargeurCell; yp:=(y-1)*HauteurCell; @@ -4714,7 +4733,8 @@ begin Orientation:=TCO[x,y].FeuOriente; if Orientation=0 then Orientation:=1; // cas d'un signal non encore renseigné - aspect:=feux[index_feu(adresse)].aspect; + index:=index_feu(adresse); + aspect:=feux[index].aspect; if aspect=0 then aspect:=9; //if aspect>9 then exit; //Affiche(IntToSTR(i)+' '+intToSTR(aspect),clred); @@ -4731,6 +4751,7 @@ begin 14 : ImageFeu:=Formprinc.Image4Dir; 15 : ImageFeu:=Formprinc.Image5Dir; 16 : ImageFeu:=Formprinc.Image6Dir; + 20 : ImageFeu:=formprinc.ImageSignal20; else ImageFeu:=Formprinc.Image9feux; end; @@ -4745,6 +4766,7 @@ begin x0:=0;y0:=0; // pour les signaux directionnels if orientation=3 then //D begin + if aspect=20 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY);end; if aspect=9 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY);end; if aspect=7 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY);end; if aspect=5 then begin x0:=0; y0:=round((tailleX/2)*frY);end; @@ -4756,6 +4778,7 @@ begin // décalage en X pour mettre la tete du signal alignée sur le bord droit de la cellule pour les signaux tournés à 90G if orientation=2 then begin + if aspect=20 then begin x0:=0; y0:=0;end; if aspect=9 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY);end; if aspect=7 then begin x0:=round(10*frX); y0:=HauteurCell-round(tailleX*frY);end; if aspect=5 then begin x0:=round(10*frX); y0:=round((tailleX/2)*frY);end; @@ -4767,6 +4790,7 @@ begin // décalage en X pour rapprocher le signal du le bord droit de la cellule pour les feux verticaux if orientation=1 then begin + if aspect=20 then begin x0:=0; y0:=0; end; if aspect=9 then begin x0:=0; y0:=0; end; if aspect=7 then begin x0:=0; y0:=0; end; if aspect=5 then begin x0:=round(13*frx); y0:=0;end; @@ -4782,11 +4806,22 @@ begin // affichage du signal et du pied - orientation verticale if (Orientation=1) then begin - // copie avec mise à l'échelle de l'image du signal - TransparentBlt(canvasDest.Handle,x0,y0,round(TailleX*frX),round(TailleY*frY), + // si inversion + if feux[index].contrevoie then + begin + inverse_image(FormTCO.ImageTemp,ImageFeu); + // copie avec mise à l'échelle de l'image du signal + TransparentBlt(canvasDest.Handle,x0,y0,round(TailleX*frX),round(TailleY*frY), + FormTCO.ImageTemp.Canvas.Handle,0,0,TailleX,TailleY,clBlue); + end + else + // copie avec mise à l'échelle de l'image du signal + TransparentBlt(canvasDest.Handle,x0,y0,round(TailleX*frX),round(TailleY*frY), ImageFeu.Canvas.Handle,0,0,TailleX,TailleY,clBlue); + PImageTCO.Picture.Bitmap.Modified:=True; // rafraichit l'affichage sinon le stretchblt n'apparaît pas. case aspect of + 20 : affiche_pied_Vertical5G(x0+round(10*frx),y0+hauteurCell-round(10*fry),frX,frY,piedFeu); 9 : affiche_pied_Vertical9G(x0,y0,frX,frY,piedFeu); 7 : affiche_pied_Vertical7G(x0,y0,frX,frY,piedFeu); 5 : affiche_pied_Vertical5G(x0,y0,frX,frY,piedFeu); @@ -4799,9 +4834,10 @@ begin // affichage du feu et du pieds - orientation 90°G if Orientation=2 then begin - Feu_90G(ImageFeu,x0,y0,frX,frY); // ici on passe l'origine du signal + Feu_90G(ImageFeu,x0,y0,frX,frY,feux[index].contrevoie); // ici on passe l'origine du signal // dessiner le pied case aspect of + 20 : affiche_pied5G_90G(x0+2,y0+round(fry*5),frX,frY,piedFeu); 9 : affiche_pied9G_90G(x0,y0,frX,frY,piedFeu); 7 : affiche_pied7G_90G(x0,y0,frX,frY,piedFeu); 5 : affiche_pied5G_90G(x0,y0,frX,frY,piedFeu); @@ -4814,9 +4850,10 @@ begin // affichage du signal et du pied - orientation 90°D if Orientation=3 then begin - Feu_90D(ImageFeu,x0,y0,frX,frY); + Feu_90D(ImageFeu,x0,y0,frX,frY,feux[index].contrevoie); // dessiner le pied case aspect of + 20 : affiche_pied5G_90D(x0+(largeurCell div 2)+round(frx*12),y0+(hauteurCell div 2),frX,frY,piedFeu); 9 : affiche_pied9G_90D(x0,y0,frX,frY,piedFeu); 7 : affiche_pied7G_90D(x0,y0,frX,frY,piedFeu); 5 : affiche_pied5G_90D(x0,y0,frX,frY,piedFeu); @@ -4845,7 +4882,8 @@ end; // affiche la cellule x et y en cases // index est utilisé pour accéder au tableau du tracé de la fonction zone_tco procedure affiche_cellule(x,y : integer); -var i,repr,Xorg,Yorg,xt,yt,mode,adresse,Bimage,aspect,oriente,pied : integer; +var i,index,repr,Xorg,Yorg,xt,yt,mode,adresse,Bimage,aspect,oriente,pied : integer; + inverse : boolean; s : string; begin //if tco[x,y].BImage=0 then exit; @@ -4891,7 +4929,7 @@ begin 23,31 : dessin_31(PCanvasTCO,X,Y,mode); 24 : dessin_24(PCanvasTCO,X,Y,mode); 25 : dessin_25(PCanvasTCO,X,Y,mode); - 30 : dessin_feu(PCanvasTCO,X,Y); + 30 : dessin_Signal(PCanvasTCO,X,Y); end; PCanvasTCO.font.Size:=(LargeurCell div 10)+4 ; @@ -5004,10 +5042,29 @@ begin // adresse des signaux if (BImage=30) and (adresse<>0) then begin - aspect:=feux[index_feu(adresse)].Aspect; + index:=index_feu(adresse); + aspect:=feux[index].Aspect; oriente:=TCO[x,y].FeuOriente; pied:=TCO[x,y].PiedFeu; + inverse:=feux[index].contrevoie; xt:=0;yt:=0; + if (aspect=20) and (Oriente=1) then + begin + if inverse then begin xt:=2;yt:=2*HauteurCell-round(16*fryGlob);end + else + begin xt:=(largeurCell div 2)+round(5*frXglob);yt:=2*HauteurCell-round(20*fryGlob); end; + end; + if (aspect=20) and (Oriente=2) then + begin + if inverse then begin xt:=round(20*frxGlob);yt:=round(3*fryGlob);end + else + begin xt:=round(10*frxGlob);yt:=HauteurCell-round(16*fryGlob);end; + end; + if (aspect=20) and (Oriente=3) then + begin + if inverse then begin xt:=largeurCell+round(10*frxGlob);yt:=HauteurCell-round(16*fryGlob);end + else begin xt:=largeurCell+round(10*frxGlob);yt:=round(1*fryGlob);end; + end; if (aspect=9) and (Oriente=1) then begin xt:=LargeurCell-round(25*frXGlob);yt:=2*HauteurCell-round(25*fryGlob);end; if (aspect=9) and (Oriente=2) then begin xt:=round(10*frXGlob);yt:=HauteurCell-round(17*frYGlob);end; // orientation G if (aspect=9) and (Oriente=3) then begin xt:=LargeurCell+round(25*frXglob);yt:=1;end; @@ -5028,9 +5085,9 @@ begin if (aspect=2) and (Oriente=1) and (pied=1) then begin xt:=round(45*frXglob);yt:=1;end; // signal à gauche if (aspect=2) and (Oriente=2) then begin xt:=round(10*frXGlob);yt:=HauteurCell;end; // orientation G if (aspect=2) and (Oriente=3) then begin xt:=round(10*frXGlob);yt:=HauteurCell;end; // orientation D - if (aspect>10) and (oriente=1) then begin xt:=1;yt:=HauteurCell-round(14*frYGlob);end; - if (aspect>10) and (oriente=2) then begin xt:=LargeurCell-round(15*frXGlob);yt:=0;end; - if (aspect>10) and (oriente=3) then begin xt:=LargeurCell-round(15*frXGlob);yt:=0;end; + if (aspect>10) and (aspect<20) and(oriente=1) then begin xt:=1;yt:=HauteurCell-round(14*frYGlob);end; + if (aspect>10) and (aspect<20) and (oriente=2) then begin xt:=LargeurCell-round(15*frXGlob);yt:=0;end; + if (aspect>10) and (aspect<20) and (oriente=3) then begin xt:=LargeurCell-round(15*frXGlob);yt:=0;end; with PCanvasTCO do begin @@ -6104,7 +6161,6 @@ begin trackBarZoom.Position:=(ZoomMax+Zoommin) div 2; ScrollBox.Width:=clientWidth-80; - //ScrollBox.Width:=clientWidth-200; if MasqueBandeauTCO then begin ButtonAfficheBandeau.visible:=true; @@ -8032,7 +8088,7 @@ begin tco[XClicCell,YClicCell].y:=0; // ne pas convertir l'adresse sinon evt changement du composant et on écrase l'aspect EditAdrElement.Text:=IntToSTR( tco[XClicCell,YClicCell].Adresse); EdittypeImage.Text:=IntToSTR(tco[XClicCell,YClicCell].BImage); - Dessin_feu(ImageTCO.Canvas,XClicCell,YClicCell); + Dessin_Signal(ImageTCO.Canvas,XClicCell,YClicCell); end; @@ -8136,7 +8192,6 @@ begin end; tco[XClicCell,YClicCell].FeuOriente:=3; // feu orienté à 90° droit - //dessin_feu(PCanvasTCO,XclicCell,YClicCell); Affiche_TCO; actualise; // met à jour la fenetre de config de la cellule end; @@ -8185,7 +8240,6 @@ begin end; tco[XClicCell,YClicCell].FeuOriente:=1; // signal orienté à 180° - //dessin_feu(PCanvasTCO,XclicCell,YClicCell); affiche_tco; actualise; // met à jour la fenetre de config de la cellule end; @@ -8368,7 +8422,7 @@ begin efface_entoure; SelectionAffichee:=false; - if feux[i].aspect>10 then + if (feux[i].aspect>10) and (feux[i].aspect<20) then begin GroupBox1.Visible:=false; GroupBox2.Visible:=false; @@ -8381,7 +8435,7 @@ begin LabelNbFeux.Visible:=False; EditNbreFeux.Visible:=false; GroupBox1.Visible:=true; - GroupBox2.Visible:=true; + if (feux[i].aspect<20) then GroupBox2.Visible:=true else GroupBox2.Visible:=false; end; end; end; diff --git a/verif_version.pas b/verif_version.pas index 951ec06..c953048 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -24,7 +24,7 @@ var Lance_verif : integer; verifVersion,notificationVersion : boolean; -Const Version='6.3'; // sert à la comparaison de la version publiée +Const Version='7.0'; // sert à la comparaison de la version publiée SousVersion=' '; // A B C ... en cas d'absence de sous version mettre un espace function GetCurrentProcessEnvVar(const VariableName: string): string; diff --git a/versions.txt b/versions.txt index 754f3d9..278f41a 100644 --- a/versions.txt +++ b/versions.txt @@ -170,6 +170,7 @@ version 6.1 : Am version 6.2 : Déplacement du curseur du TCO avec les touches curseur. Dessin du TCO à la souris. version 6.3 : Choix du graphisme du TCO en lignes brisées ou courbes. +version 7.0 : Gestion des signaux belges (avec chevron et réduction de vitesse).