diff --git a/Notice d'utilisation des signaux_complexes_GL_V8.36.pdf b/Notice d'utilisation des signaux_complexes_GL_V8.38.pdf similarity index 79% rename from Notice d'utilisation des signaux_complexes_GL_V8.36.pdf rename to Notice d'utilisation des signaux_complexes_GL_V8.38.pdf index 98e6e2f..a522e21 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V8.36.pdf and b/Notice d'utilisation des signaux_complexes_GL_V8.38.pdf differ diff --git a/Signaux_complexes_GL.cfg b/Signaux_complexes_GL.cfg index bcc5ab2..8d97c47 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 454559d..5ccec48 100644 --- a/Signaux_complexes_GL.dof +++ b/Signaux_complexes_GL.dof @@ -17,8 +17,8 @@ M=0 N=1 O=0 P=1 -Q=1 -R=1 +Q=0 +R=0 S=0 T=0 U=0 diff --git a/Signaux_complexes_GL.map b/Signaux_complexes_GL.map index aacb15b..17825b9 100644 --- a/Signaux_complexes_GL.map +++ b/Signaux_complexes_GL.map @@ -1,8 +1,8 @@ Start Length Name Class - 0001:00000000 001A254CH .text CODE - 0002:00000000 00002C7CH .data DATA - 0002:00002C7C 045DE035H .bss BSS + 0001:00000000 001A397CH .text CODE + 0002:00000000 00002C54H .data DATA + 0002:00002C54 045E204DH .bss BSS Detailed map of segments @@ -76,29 +76,29 @@ Detailed map of segments 0001:00095228 00000128 C=CODE S=.text G=(none) M=WinSock ACBP=A9 0001:00095350 00003A78 C=CODE S=.text G=(none) M=ScktComp ACBP=A9 0001:00098DC8 000008EA C=CODE S=.text G=(none) M=OleServer ACBP=A9 - 0001:000996B4 000005A0 C=CODE S=.text G=(none) M=MSCommLib_TLB ACBP=A9 - 0001:00099C54 00000040 C=CODE S=.text G=(none) M=MMSystem ACBP=A9 - 0001:00099C94 00000038 C=CODE S=.text G=(none) M=Nb30 ACBP=A9 - 0001:00099CCC 00000A18 C=CODE S=.text G=(none) M=MaskUtils ACBP=A9 - 0001:0009A6E4 00002108 C=CODE S=.text G=(none) M=Mask ACBP=A9 - 0001:0009C7EC 0000924C C=CODE S=.text G=(none) M=Grids ACBP=A9 - 0001:000A5A38 00001980 C=CODE S=.text G=(none) M=UnitPilote ACBP=A9 - 0001:000A73B8 00000574 C=CODE S=.text G=(none) M=Importation ACBP=A9 - 0001:000A792C 00013B38 C=CODE S=.text G=(none) M=UnitAnalyseSegCDM ACBP=A9 - 0001:000BB464 00002D20 C=CODE S=.text G=(none) M=UnitConfigTCO ACBP=A9 - 0001:000BE184 00000D10 C=CODE S=.text G=(none) M=Unit_Pilote_aig ACBP=A9 - 0001:000BEE94 00004DD8 C=CODE S=.text G=(none) M=UnitConfigCellTCO ACBP=A9 - 0001:000C3C6C 00045748 C=CODE S=.text G=(none) M=UnitTCO ACBP=A9 - 0001:001093B4 00003160 C=CODE S=.text G=(none) M=UnitSR ACBP=A9 - 0001:0010C514 000028D4 C=CODE S=.text G=(none) M=UnitCDF ACBP=A9 - 0001:0010EDE8 00001833 C=CODE S=.text G=(none) M=verif_version ACBP=A9 - 0001:0011061C 000011D0 C=CODE S=.text G=(none) M=UnitPareFeu ACBP=A9 - 0001:001117EC 00043384 C=CODE S=.text G=(none) M=UnitConfig ACBP=A9 - 0001:00154B70 00002BC8 C=CODE S=.text G=(none) M=UnitDebug ACBP=A9 - 0001:00157738 00000D2C C=CODE S=.text G=(none) M=UnitSimule ACBP=A9 - 0001:00158464 00002678 C=CODE S=.text G=(none) M=Unitplace ACBP=A9 - 0001:0015AADC 000475E0 C=CODE S=.text G=(none) M=UnitPrinc ACBP=A9 - 0001:001A20BC 0000048D C=CODE S=.text G=(none) M=Signaux_complexes_GL ACBP=A9 + 0001:000996B4 00000598 C=CODE S=.text G=(none) M=MSCommLib_TLB ACBP=A9 + 0001:00099C4C 00000040 C=CODE S=.text G=(none) M=MMSystem ACBP=A9 + 0001:00099C8C 00000038 C=CODE S=.text G=(none) M=Nb30 ACBP=A9 + 0001:00099CC4 00000A18 C=CODE S=.text G=(none) M=MaskUtils ACBP=A9 + 0001:0009A6DC 00002108 C=CODE S=.text G=(none) M=Mask ACBP=A9 + 0001:0009C7E4 0000924C C=CODE S=.text G=(none) M=Grids ACBP=A9 + 0001:000A5A30 00001980 C=CODE S=.text G=(none) M=UnitPilote ACBP=A9 + 0001:000A73B0 00000574 C=CODE S=.text G=(none) M=Importation ACBP=A9 + 0001:000A7924 00014800 C=CODE S=.text G=(none) M=UnitAnalyseSegCDM ACBP=A9 + 0001:000BC124 00002D20 C=CODE S=.text G=(none) M=UnitConfigTCO ACBP=A9 + 0001:000BEE44 00000D10 C=CODE S=.text G=(none) M=Unit_Pilote_aig ACBP=A9 + 0001:000BFB54 00004DD8 C=CODE S=.text G=(none) M=UnitConfigCellTCO ACBP=A9 + 0001:000C492C 00045854 C=CODE S=.text G=(none) M=UnitTCO ACBP=A9 + 0001:0010A180 00003160 C=CODE S=.text G=(none) M=UnitSR ACBP=A9 + 0001:0010D2E0 000028D4 C=CODE S=.text G=(none) M=UnitCDF ACBP=A9 + 0001:0010FBB4 00001833 C=CODE S=.text G=(none) M=verif_version ACBP=A9 + 0001:001113E8 000011D0 C=CODE S=.text G=(none) M=UnitPareFeu ACBP=A9 + 0001:001125B8 00043720 C=CODE S=.text G=(none) M=UnitConfig ACBP=A9 + 0001:00155CD8 00002BC8 C=CODE S=.text G=(none) M=UnitDebug ACBP=A9 + 0001:001588A0 00000D2C C=CODE S=.text G=(none) M=UnitSimule ACBP=A9 + 0001:001595CC 00002678 C=CODE S=.text G=(none) M=Unitplace ACBP=A9 + 0001:0015BC44 000478A8 C=CODE S=.text G=(none) M=UnitPrinc ACBP=A9 + 0001:001A34EC 0000048D C=CODE S=.text G=(none) M=Signaux_complexes_GL ACBP=A9 0002:00000000 000000CC C=DATA S=.data G=DGROUP M=System ACBP=A9 0002:000000CC 00000020 C=DATA S=.data G=DGROUP M=SysInit ACBP=A9 0002:000000EC 00000254 C=DATA S=.data G=DGROUP M=SysUtils ACBP=A9 @@ -125,12 +125,12 @@ Detailed map of segments 0002:00001250 00000030 C=DATA S=.data G=DGROUP M=ComObj ACBP=A9 0002:00001280 0000002C C=DATA S=.data G=DGROUP M=OleCtrls ACBP=A9 0002:000012AC 00000908 C=DATA S=.data G=DGROUP M=jpeg ACBP=A9 - 0002:00001BB4 00000080 C=DATA S=.data G=DGROUP M=MSCommLib_TLB ACBP=A9 - 0002:00001C34 00000009 C=DATA S=.data G=DGROUP M=MaskUtils ACBP=A9 - 0002:00001C40 00000004 C=DATA S=.data G=DGROUP M=Mask ACBP=A9 - 0002:00001C44 00000006 C=DATA S=.data G=DGROUP M=Grids ACBP=A9 - 0002:00001C4C 000000D4 C=DATA S=.data G=DGROUP M=UnitTCO ACBP=A9 - 0002:00001D20 0000060D C=DATA S=.data G=DGROUP M=UnitPrinc ACBP=A9 + 0002:00001BB4 00000058 C=DATA S=.data G=DGROUP M=MSCommLib_TLB ACBP=A9 + 0002:00001C0C 00000009 C=DATA S=.data G=DGROUP M=MaskUtils ACBP=A9 + 0002:00001C18 00000004 C=DATA S=.data G=DGROUP M=Mask ACBP=A9 + 0002:00001C1C 00000006 C=DATA S=.data G=DGROUP M=Grids ACBP=A9 + 0002:00001C24 000000D4 C=DATA S=.data G=DGROUP M=UnitTCO ACBP=A9 + 0002:00001CF8 0000060D C=DATA S=.data G=DGROUP M=UnitPrinc ACBP=A9 0002:00003000 00000664 C=BSS S=.bss G=DGROUP M=System ACBP=A9 0002:00003664 00000010 C=BSS S=.bss G=DGROUP M=SysInit ACBP=A9 0002:00003674 00000004 C=BSS S=.bss G=DGROUP M=Types ACBP=A9 @@ -208,20 +208,20 @@ Detailed map of segments 0002:00003E60 00000004 C=BSS S=.bss G=DGROUP M=Grids ACBP=A9 0002:00003E64 00000010 C=BSS S=.bss G=DGROUP M=UnitPilote ACBP=A9 0002:00003E74 00000010 C=BSS S=.bss G=DGROUP M=Importation ACBP=A9 - 0002:00003E84 000118A0 C=BSS S=.bss G=DGROUP M=UnitAnalyseSegCDM ACBP=A9 - 0002:00015724 00000014 C=BSS S=.bss G=DGROUP M=UnitConfigTCO ACBP=A9 - 0002:00015738 00000014 C=BSS S=.bss G=DGROUP M=Unit_Pilote_aig ACBP=A9 - 0002:0001574C 00000014 C=BSS S=.bss G=DGROUP M=UnitConfigCellTCO ACBP=A9 - 0002:00015760 00418704 C=BSS S=.bss G=DGROUP M=UnitTCO ACBP=A9 - 0002:0042DE64 00000010 C=BSS S=.bss G=DGROUP M=UnitSR ACBP=A9 - 0002:0042DE74 00000014 C=BSS S=.bss G=DGROUP M=UnitCDF ACBP=A9 - 0002:0042DE88 00000018 C=BSS S=.bss G=DGROUP M=verif_version ACBP=A9 - 0002:0042DEA0 00000004 C=BSS S=.bss G=DGROUP M=UnitPareFeu ACBP=A9 - 0002:0042DEA4 000004FC C=BSS S=.bss G=DGROUP M=UnitConfig ACBP=A9 - 0002:0042E3A0 0000002C C=BSS S=.bss G=DGROUP M=UnitDebug ACBP=A9 - 0002:0042E3CC 0000000C C=BSS S=.bss G=DGROUP M=UnitSimule ACBP=A9 - 0002:0042E3D8 00000008 C=BSS S=.bss G=DGROUP M=Unitplace ACBP=A9 - 0002:0042E3E0 041B2C54 C=BSS S=.bss G=DGROUP M=UnitPrinc ACBP=A9 + 0002:00003E84 000148B0 C=BSS S=.bss G=DGROUP M=UnitAnalyseSegCDM ACBP=A9 + 0002:00018734 00000014 C=BSS S=.bss G=DGROUP M=UnitConfigTCO ACBP=A9 + 0002:00018748 00000014 C=BSS S=.bss G=DGROUP M=Unit_Pilote_aig ACBP=A9 + 0002:0001875C 00000014 C=BSS S=.bss G=DGROUP M=UnitConfigCellTCO ACBP=A9 + 0002:00018770 00418700 C=BSS S=.bss G=DGROUP M=UnitTCO ACBP=A9 + 0002:00430E70 00000010 C=BSS S=.bss G=DGROUP M=UnitSR ACBP=A9 + 0002:00430E80 00000014 C=BSS S=.bss G=DGROUP M=UnitCDF ACBP=A9 + 0002:00430E94 00000018 C=BSS S=.bss G=DGROUP M=verif_version ACBP=A9 + 0002:00430EAC 00000004 C=BSS S=.bss G=DGROUP M=UnitPareFeu ACBP=A9 + 0002:00430EB0 000004FC C=BSS S=.bss G=DGROUP M=UnitConfig ACBP=A9 + 0002:004313AC 0000002C C=BSS S=.bss G=DGROUP M=UnitDebug ACBP=A9 + 0002:004313D8 0000000C C=BSS S=.bss G=DGROUP M=UnitSimule ACBP=A9 + 0002:004313E4 00000008 C=BSS S=.bss G=DGROUP M=Unitplace ACBP=A9 + 0002:004313EC 041B3C60 C=BSS S=.bss G=DGROUP M=UnitPrinc ACBP=A9 Bound resource files @@ -247,4 +247,4 @@ Signaux_complexes_GL.res Signaux_complexes_GL.drf -Program entry point at 0001:001A23CC +Program entry point at 0001:001A37FC diff --git a/UnitAnalyseSegCDM.dfm b/UnitAnalyseSegCDM.dfm index 7974e19..07bc989 100644 --- a/UnitAnalyseSegCDM.dfm +++ b/UnitAnalyseSegCDM.dfm @@ -1,6 +1,6 @@ object FormAnalyseCDM: TFormAnalyseCDM - Left = 206 - Top = 0 + Left = 212 + Top = 69 AutoScroll = False Caption = 'Fen'#234'tre r'#233'seau CDM' ClientHeight = 648 diff --git a/UnitAnalyseSegCDM.pas b/UnitAnalyseSegCDM.pas index 703afc0..82f326b 100644 --- a/UnitAnalyseSegCDM.pas +++ b/UnitAnalyseSegCDM.pas @@ -107,6 +107,10 @@ type Adevie2B : char ; // états d'une TJD (2 ou 4, 4 par défaut) EtatTJD : integer; + // si l'aiguillage provient d'une traversée double jonction + bdj : boolean; + adrCDM : integer; // adresse de la bjd dans cdm + IndexSeg : integer; // end; @@ -140,6 +144,7 @@ type location : integer; // ?? en % adresse : integer; status : integer; + OnDevicePort : integer; end; Tsegment = @@ -157,13 +162,13 @@ type // turnout curve xc0,yc0,DeltaDev2,xc,yc : integer; // pour signaux complexes - adresse,adresse2,duree : integer; + adresse,adresse2,duree,adr_CDM : integer; end; var Segment : array of Tsegment; nInter,nPeriph,nSeg,nPort,nligne,XminiCDM,XmaxiCDM,YminiCDM,YmaxiCDM,NAig_CDM,Ndet_CDM, - DernAdrAig,SeqAdrCroisement,nb_det,IndexClic,xAig,yAig,cadre,largeur_voie, + DernAdrAig,SeqAdrCroisement,nb_det,IndexClic,xAig,yAig,cadre,largeur_voie,dernierSeg, largeurTrain,HauteurTrain : integer; lignes : TStrings; reducX,reducY,ArcTanHautLargTrain : double; @@ -189,16 +194,33 @@ uses Importation; {$R *.dfm} +// +function index_aigCdm(adresse : integer) : integer; +var i : integer; + trouve : boolean; +begin + i:=1; + repeat + trouve:=aig_cdm[i].adresse=adresse; + inc(i); + until trouve or (i>nAig_cdm); + if trouve then result:=i-1 else result:=0; +end; + // cherche, isole et restreint la chaine s qui contient "chercher" -function isole_valeur(var s : string; chercher : string) : string; +function isole_valeur(var s : string; chercher : string;afficheErr : boolean) : string; var i : integer; serr : string; begin i:=pos(chercher,s); - if i=0 then begin - serr:='Erreur : pas de chaine '+chercher+' dans "'+s+'" Segment '+intToSTR(segment[nSeg-1].numero); - Affiche(serr,clred); - AfficheDebug(serr,clred); + if i=0 then + begin + if afficheErr then + begin + serr:='Erreur : pas de chaine '+chercher+' dans "'+s+'" Segment '+intToSTR(segment[nSeg-1].numero); + Affiche(serr,clred); + AfficheDebug(serr,clred); + end; isole_valeur:=''; exit; end; @@ -223,55 +245,57 @@ begin setlength(segment[nSeg-1].Periph,nPeriph); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'periph #'); + s2:=isole_valeur(s,'periph #',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].numero:=i; if debugAnalyse then AfficheDebug('Compile periph '+intToSTR(i),clYellow); - s2:=isole_valeur(s,'obj type'); + s2:=isole_valeur(s,'obj type',true); Segment[nSeg-1].periph[nperiph-1].typ:=s2; inc(nLigne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'father #'); + s2:=isole_valeur(s,'father #',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].pere:=i; inc(nLigne); s:=AnsiLowerCase(lignes[nligne]); inc(nLigne); - s2:=isole_valeur(s,'x='); + s2:=isole_valeur(s,'x=',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].x:=i; - s2:=isole_valeur(s,'y='); + s2:=isole_valeur(s,'y=',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].y:=i; - s2:=isole_valeur(s,'z='); + s2:=isole_valeur(s,'z=',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].z:=i; - s2:=isole_valeur(s,'angle='); + s2:=isole_valeur(s,'angle=',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].angle:=i; s:=AnsiLowerCase(lignes[nligne]); inc(nLigne); - s2:=isole_valeur(s,'bright ='); + s2:=isole_valeur(s,'bright =',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].bRight:=i; - s2:=isole_valeur(s,'bdown ='); + s2:=isole_valeur(s,'bdown =',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].bDown:=i; - s2:=isole_valeur(s,'location ='); + s2:=isole_valeur(s,'location =',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].location:=i; s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'address'); + inc(nLigne); + + s2:=isole_valeur(s,'address',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].Adresse:=i; if (Segment[nSeg-1].periph[nperiph-1].typ='detector') and (i<>0) then @@ -289,9 +313,21 @@ begin end; end; - s2:=isole_valeur(s,'status'); + s2:=isole_valeur(s,'status',true); val(s2,i,erreur); Segment[nSeg-1].periph[nperiph-1].status:=i; + + // peut être suivi de 'On device port' + Segment[nSeg-1].periph[nperiph-1].OnDevicePort:=-1; // marqueur d'invalidité + s:=AnsiLowerCase(lignes[nligne]); + if pos('on device port',s)<>0 then + begin + s2:=isole_valeur(s,'on device port #',true); + inc(nLigne); + val(s2,i,erreur); + Segment[nSeg-1].periph[nperiph-1].OnDevicePort:=i; + end; + end; procedure compile_inter; @@ -306,24 +342,24 @@ begin s:=AnsiLowerCase(lignes[nligne]); inc(nLigne); - s2:=isole_valeur(s,'x='); + s2:=isole_valeur(s,'x=',true); val(s2,i,erreur); Segment[nSeg-1].inter[nInter-1].x:=i; - s2:=isole_valeur(s,'y='); + s2:=isole_valeur(s,'y=',true); val(s2,i,erreur); Segment[nSeg-1].inter[nInter-1].y:=i; - s2:=isole_valeur(s,'z='); + s2:=isole_valeur(s,'z=',true); val(s2,i,erreur); Segment[nSeg-1].inter[nInter-1].z:=i; - s2:=isole_valeur(s,'type:'); + s2:=isole_valeur(s,'type:',true); Segment[nSeg-1].inter[nInter-1].typ:=s2; s:=AnsiLowerCase(lignes[nligne]); inc(nLigne); - s2:=isole_valeur(s,'z='); + s2:=isole_valeur(s,'z=',true); val(s2,i,erreur); Segment[nSeg-1].inter[nInter-1].MirrorZ:=i; end; @@ -345,10 +381,10 @@ begin Segment[nSeg-1].port[nPort-1].numero:=i; if debugAnalyse then AfficheDebug('Compile port '+intToSTR(i),clLime); - s2:=isole_valeur(s,'obj type'); + s2:=isole_valeur(s,'obj type',true); Segment[nSeg-1].port[nPort-1].typ:=s2; // port dummy_port - s2:=isole_valeur(s,'local #'); + s2:=isole_valeur(s,'local #',true); if s2='' then begin Affiche('Erreur structure n°14',clOrange);exit;end; val(s,i,erreur); Segment[nSeg-1].port[nPort-1].local:=i; @@ -356,25 +392,25 @@ begin s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'x='); + s2:=isole_valeur(s,'x=',true); val(s2,i,erreur); Segment[nSeg-1].port[nPort-1].x:=i; - s2:=isole_valeur(s,'y='); + s2:=isole_valeur(s,'y=',true); val(s2,i,erreur); Segment[nSeg-1].port[nPort-1].y:=i; - s2:=isole_valeur(s,'z='); + s2:=isole_valeur(s,'z=',true); val(s2,i,erreur); Segment[nSeg-1].port[nPort-1].z:=i; - s2:=isole_valeur(s,'angle='); + s2:=isole_valeur(s,'angle=',true); val(s2,i,erreur); Segment[nSeg-1].port[nPort-1].angle:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'connect status:'); + s2:=isole_valeur(s,'connect status:',true); Segment[nSeg-1].port[nPort-1].connecte:=s2='connected'; if Segment[nSeg-1].port[nPort-1].typ='dummy_port' then exit; @@ -382,15 +418,16 @@ begin inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'connected to port #'); + s2:=isole_valeur(s,'connected to port #',true); val(s2,i,erreur); Segment[nSeg-1].port[nPort-1].ConnecteAuPort:=i; - s2:=isole_valeur(s,'segment #'); + s2:=isole_valeur(s,'segment #',true); val(s2,i,erreur); Segment[nSeg-1].port[nPort-1].ConnecteAuSeg:=i; end; +// compile le segment, tableau dans lignes[] procedure compile_segment; var i,erreur : integer; s,s2,segType,serr: string; @@ -407,8 +444,8 @@ begin Segment[nSeg-1].nInter:=0; s:=AnsiLowerCase(lignes[nligne]); i:=pos('#',s); - if i=0 then - begin + if i=0 then + begin serr:='Erreur structure n°2'; Affiche(serr,clOrange); AfficheDebug(serr,clOrange); @@ -417,96 +454,142 @@ begin delete(s,1,i); val(s,i,erreur); segment[nSeg-1].numero:=i; + if i>dernierSeg then dernierSeg:=i; if debugAnalyse then AfficheDebug('Compile segment '+intToSTR(i),claqua); delete(s,1,erreur); - s2:=isole_valeur(s,'obj type: '); + s2:=isole_valeur(s,'obj type: ',true); if s2<>'segment' then begin Affiche('Erreur structure n°3',clOrange);exit;end; - s2:=isole_valeur(s,'seg type: '); + s2:=isole_valeur(s,'seg type: ',true); if s2='' then begin Affiche('Erreur structure n°4',clOrange);exit;end; segType:=s2; segment[nSeg-1].typ:=s2; // ARC TURNOUT(champ suppl) inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'module :'); + s2:=isole_valeur(s,'module :',true); inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'nb ports:'); + s2:=isole_valeur(s,'nb ports:',true); val(s2,i,erreur); segment[nSeg-1].nport:=i; s:=lignes[nligne]; - s2:=isole_valeur(s,'nb periphs:'); + s2:=isole_valeur(s,'nb periphs:',true); val(s2,i,erreur); segment[nSeg-1].nperiph:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'zone[0]:'); - s2:=isole_valeur(s,'zone[1]:'); + s2:=isole_valeur(s,'zone[0]:',true); + s2:=isole_valeur(s,'zone[1]:',true); inc(nligne,2); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'xmin ='); + s2:=isole_valeur(s,'xmin =',true); val(s2,i,erreur); segment[nSeg-1].XMin:=i; if ixMaxiCDM then xMaxiCDM:=i; - s2:=isole_valeur(s,'ymax ='); + s2:=isole_valeur(s,'ymax =',true); val(s2,i,erreur); segment[nSeg-1].Ymax:=i; if i>yMaxiCDM then yMaxiCDM:=i; + // champs variables en fonction du type if segType='turntable' then begin inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'start angle:'); + s2:=isole_valeur(s,'start angle:',true); val(s2,i,erreur); segment[nSeg-1].startangle:=i; - s2:=isole_valeur(s,'length:'); + s2:=isole_valeur(s,'length:',true); val(s2,i,erreur); segment[nSeg-1].longueur:=i; - s2:=isole_valeur(s,'lengthdev'); + s2:=isole_valeur(s,'lengthdev',true); val(s2,i,erreur); segment[nSeg-1].lengthdev:=i; inc(nligne,2); // 1 ligne vide s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'xc0:'); + s2:=isole_valeur(s,'xc0:',true); val(s2,i,erreur); segment[nSeg-1].xc0:=i; - s2:=isole_valeur(s,'yc0:'); + s2:=isole_valeur(s,'yc0:',true); val(s2,i,erreur); segment[nSeg-1].yc0:=i; - s2:=isole_valeur(s,'xc:'); + s2:=isole_valeur(s,'xc:',true); val(s2,i,erreur); segment[nSeg-1].xc:=i; - s2:=isole_valeur(s,'yc:'); + s2:=isole_valeur(s,'yc:',true); val(s2,i,erreur); segment[nSeg-1].yc:=i; exit; end; - if (segType='turnout') or (segType='turnout_3way') or (segType='dbl_slip_switch') then + if (segType='turnout') or (segType='turnout_3way') or (segType='dbl_slip_switch') or (segType='dbl_cross_over') then begin inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'adresse ='); + + // en DB_DumpSegmentInfo V3 il y a 3 lignes en plus + s2:=isole_valeur(s,'start angle:',false); + if s2<>'' then + begin + val(s2,i,erreur); + segment[nSeg-1].StartAngle:=i; + + s2:=isole_valeur(s,'arc angle:',true); + val(s2,i,erreur); + segment[nSeg-1].ArcAngle:=i; + + s2:=isole_valeur(s,'radius:',true); + val(s2,i,erreur); + segment[nSeg-1].Rayon:=i; + + inc(nligne); + s:=AnsiLowerCase(lignes[nligne]); + + s:=AnsiLowerCase(lignes[nligne]); + s2:=isole_valeur(s,'length:',true); + val(s2,i,erreur); + segment[nSeg-1].longueur:=i; + + s2:=isole_valeur(s,'lengthdev:',true); + val(s2,i,erreur); + segment[nSeg-1].longueurDev:=i; + + s2:=isole_valeur(s,'deltadev:',true); + val(s2,i,erreur); + segment[nSeg-1].deltadev:=i; + + inc(nligne); + s:=AnsiLowerCase(lignes[nligne]); + + s2:=isole_valeur(s,'curve offset:',true); + val(s2,i,erreur); + segment[nSeg-1].curveoffset:=i; + + inc(nligne); + s:=AnsiLowerCase(lignes[nligne]); + end; + + // V2 + s2:=isole_valeur(s,'adresse =',true); val(s2,i,erreur); segment[nSeg-1].adresse:=i; if i=0 then @@ -519,13 +602,13 @@ begin if (segType='dbl_slip_switch') or (segType='turnout_3way') then begin s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'adresse2 ='); + s2:=isole_valeur(s,'adresse2 =',true); val(s2,i,erreur); segment[nSeg-1].adresse2:=i; if i>DernAdrAig then DernAdrAig:=i; end; - s2:=isole_valeur(s,'duree ='); + s2:=isole_valeur(s,'duree =',true); val(s2,i,erreur); segment[nSeg-1].duree:=i; exit; @@ -538,37 +621,37 @@ begin // les autres aiguillages (TURNOUT_SYM...) inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'start angle:'); + s2:=isole_valeur(s,'start angle:',true); val(s2,i,erreur); segment[nSeg-1].StartAngle:=i; - s2:=isole_valeur(s,'arc angle:'); + s2:=isole_valeur(s,'arc angle:',true); val(s2,i,erreur); segment[nSeg-1].ArcAngle:=i; if segType='crossing' then begin - s2:=isole_valeur(s,'radius:'); + s2:=isole_valeur(s,'radius:',true); val(s2,i,erreur); segment[nSeg-1].Rayon:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'length:'); + s2:=isole_valeur(s,'length:',true); val(s2,i,erreur); segment[nSeg-1].longueur:=i; - s2:=isole_valeur(s,'lengthdev:'); + s2:=isole_valeur(s,'lengthdev:',true); val(s2,i,erreur); segment[nSeg-1].longueurDev:=i; - s2:=isole_valeur(s,'deltadev:'); + s2:=isole_valeur(s,'deltadev:',true); val(s2,i,erreur); segment[nSeg-1].deltadev:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'curve offset:'); + s2:=isole_valeur(s,'curve offset:',true); val(s2,i,erreur); segment[nSeg-1].curveoffset:=i; exit; @@ -576,22 +659,22 @@ begin if segType='turnout_sym' then begin - s2:=isole_valeur(s,'radius:'); + s2:=isole_valeur(s,'radius:',true); val(s2,i,erreur); segment[nSeg-1].Rayon:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'lengthdev:'); + s2:=isole_valeur(s,'lengthdev:',true); val(s2,i,erreur); segment[nSeg-1].longueur:=i; - s2:=isole_valeur(s,'deltadev:'); + s2:=isole_valeur(s,'deltadev:',true); val(s2,i,erreur); segment[nSeg-1].DeltaDev:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'curve offset:'); + s2:=isole_valeur(s,'curve offset:',true); val(s2,i,erreur); segment[nSeg-1].Curveoffset:=i; @@ -599,12 +682,12 @@ begin inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'adresse ='); + s2:=isole_valeur(s,'adresse =',true); val(s2,i,erreur); segment[nSeg-1].adresse:=i; if i>DernAdrAig then DernAdrAig:=i; - s2:=isole_valeur(s,'duree ='); + s2:=isole_valeur(s,'duree =',true); val(s2,i,erreur); segment[nSeg-1].duree:=i; exit; @@ -614,113 +697,106 @@ begin begin inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'radius0:'); + s2:=isole_valeur(s,'radius0:',true); val(s2,i,erreur); segment[nSeg-1].radius0:=i; - s2:=isole_valeur(s,'radius:'); + s2:=isole_valeur(s,'radius:',true); val(s2,i,erreur); segment[nSeg-1].rayon:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'angle0:'); + s2:=isole_valeur(s,'angle0:',true); val(s2,i,erreur); segment[nSeg-1].angle0:=i; - s2:=isole_valeur(s,'angle:'); + s2:=isole_valeur(s,'angle:',true); val(s2,i,erreur); segment[nSeg-1].angle:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'length:'); + s2:=isole_valeur(s,'length:',true); val(s2,i,erreur); segment[nSeg-1].longueur:=i; - s2:=isole_valeur(s,'deltadev0:'); + s2:=isole_valeur(s,'deltadev0:',true); val(s2,i,erreur); segment[nSeg-1].deltadev0:=i; - s2:=isole_valeur(s,'xc0:'); + s2:=isole_valeur(s,'xc0:',true); val(s2,i,erreur); segment[nSeg-1].xc0:=i; - s2:=isole_valeur(s,'yc0:'); + s2:=isole_valeur(s,'yc0:',true); val(s2,i,erreur); segment[nSeg-1].yc0:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'lengthdev:'); + s2:=isole_valeur(s,'lengthdev:',true); val(s2,i,erreur); segment[nSeg-1].lengthdev:=i; - s2:=isole_valeur(s,'deltadev:'); + s2:=isole_valeur(s,'deltadev:',true); val(s2,i,erreur); segment[nSeg-1].deltadev:=i; - s2:=isole_valeur(s,'xc:'); + s2:=isole_valeur(s,'xc:',true); val(s2,i,erreur); segment[nSeg-1].xc:=i; - s2:=isole_valeur(s,'yc:'); + s2:=isole_valeur(s,'yc:',true); val(s2,i,erreur); segment[nSeg-1].yc:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'adresse ='); + s2:=isole_valeur(s,'adresse =',true); val(s2,i,erreur); if i>DernAdrAig then DernAdrAig:=i; segment[nSeg-1].adresse:=i; - s2:=isole_valeur(s,'duree ='); + s2:=isole_valeur(s,'duree =',true); val(s2,i,erreur); segment[nSeg-1].duree:=i; exit; end; - if segType='dbl_cross_over' then - begin - Affiche('Bretelle double jonction non gérée',clred); - AfficheDebug('Bretelle double jonction non gérée',clred); - end; - - if segType='turnout_curved' then begin - s2:=isole_valeur(s,'radius:'); + s2:=isole_valeur(s,'radius:',true); val(s2,i,erreur); segment[nSeg-1].Rayon:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'length:'); + s2:=isole_valeur(s,'length:',true); val(s2,i,erreur); segment[nSeg-1].longueur:=i; - s2:=isole_valeur(s,'deltadev:'); + s2:=isole_valeur(s,'deltadev:',true); val(s2,i,erreur); segment[nSeg-1].DeltaDev:=i; - s2:=isole_valeur(s,'xc0:'); + s2:=isole_valeur(s,'xc0:',true); val(s2,i,erreur); segment[nSeg-1].xc0:=i; - s2:=isole_valeur(s,'yc0:'); + s2:=isole_valeur(s,'yc0:',true); val(s2,i,erreur); segment[nSeg-1].yc0:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'lengthdev:'); + s2:=isole_valeur(s,'lengthdev:',true); val(s2,i,erreur); segment[nSeg-1].longueurDev:=i; - s2:=isole_valeur(s,'deltadev:'); + s2:=isole_valeur(s,'deltadev:',true); val(s2,i,erreur); segment[nSeg-1].DeltaDev2:=i; - s2:=isole_valeur(s,'xc:'); + s2:=isole_valeur(s,'xc:',true); val(s2,i,erreur); segment[nSeg-1].xc:=i; - s2:=isole_valeur(s,'yc:'); + s2:=isole_valeur(s,'yc:',true); val(s2,i,erreur); segment[nSeg-1].yc:=i; @@ -728,18 +804,18 @@ begin inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'adresse ='); + s2:=isole_valeur(s,'adresse =',true); val(s2,i,erreur); segment[nSeg-1].adresse:=i; if i>DernAdrAig then DernAdrAig:=i; - s2:=isole_valeur(s,'duree ='); + s2:=isole_valeur(s,'duree =',true); val(s2,i,erreur); segment[nSeg-1].duree:=i; exit; end; - s2:=isole_valeur(s,'radius:'); + s2:=isole_valeur(s,'radius:',true); val(s2,i,erreur); segment[nSeg-1].Rayon:=i; inc(nligne); @@ -747,32 +823,32 @@ begin if segment[nseg-1].typ='turnout' then begin - s2:=isole_valeur(s,'length:'); + s2:=isole_valeur(s,'length:',true); val(s2,i,erreur); segment[nSeg-1].longueur:=i; - s2:=isole_valeur(s,'lengthdev:'); + s2:=isole_valeur(s,'lengthdev:',true); val(s2,i,erreur); segment[nSeg-1].longueurDev:=i; - s2:=isole_valeur(s,'deltadev:'); + s2:=isole_valeur(s,'deltadev:',true); val(s2,i,erreur); segment[nSeg-1].DeltaDev:=i; inc(nligne); s:=AnsiLowerCase(lignes[nligne]); - s2:=isole_valeur(s,'curve offset:'); + s2:=isole_valeur(s,'curve offset:',true); val(s2,i,erreur); segment[nSeg-1].CurveOffset:=i; end; if (SegType='arc') or (Segtype='curve') then begin - s2:=isole_valeur(s,'lxc:'); + s2:=isole_valeur(s,'lxc:',true); val(s2,i,erreur); segment[nSeg-1].lXc:=i; - s2:=isole_valeur(s,'lyc:'); + s2:=isole_valeur(s,'lyc:',true); val(s2,i,erreur); segment[nSeg-1].lYc:=i; end; @@ -1569,6 +1645,7 @@ begin Canvas.Textout(x1,y1,s); end; + // balayer les ports du segment for j:=0 to nPort-1 do begin x1:=segment[i].port[j].X; @@ -1617,16 +1694,20 @@ begin with Canvas do begin pen.width:=largeur_voie; - if (segtype='crossing') or (segType='dbl_slip_switch') then + if (segtype='crossing') or (segType='dbl_slip_switch') then begin if imprime then pen.Color:=ClBlack else begin if coloration_diff then pen.color:=clLime else pen.color:=clWhite; end; - moveto(portsSeg[0].x,portsSeg[0].y); - LineTo(portsSeg[2].x,portsSeg[2].y); - moveto(portsSeg[1].x,portsSeg[1].y); - LineTo(portsSeg[3].x,portsSeg[3].y); + // ne pas afficher crossing si il vient d'une BJD + if ((segtype='crossing') and (segment[i].adr_CDM=0)) or (segType='dbl_slip_switch') then + begin + moveto(portsSeg[0].x,portsSeg[0].y); + LineTo(portsSeg[2].x,portsSeg[2].y); + moveto(portsSeg[1].x,portsSeg[1].y); + LineTo(portsSeg[3].x,portsSeg[3].y); + end; if formAnalyseCDM.CheckAdresses.checked then coords_aff_aig(canvas,i); end else @@ -1772,11 +1853,11 @@ begin end; end; -// renvoie si le segment est de type aiguillage +// renvoie si le segment est de type aiguillage et contient une adresse function segment_aig(s : string) : boolean; begin segment_aig:=(s='turnout') or (s='dbl_slip_switch') or (s='turnout_sym') or - (s='turnout_curved') or (s='turnout_curved_2r') or (s='turnout_3way'); + (s='turnout_curved') or (s='turnout_curved_2r') or (s='turnout_3way') ; end; // trouve l'index du port du segment courant connecté au segment dont l'index est Indexconnecte @@ -1824,13 +1905,15 @@ end; // trouve les index Segment et port contenant le détecteur est detecteur function trouve_IndexSegPortDetecteur(detecteur : integer;var indexSeg,indexPeriph : integer) : boolean; -var i,j,p,np : integer; +var i,j,p,np,ns : integer; trouve : boolean; begin i:=0; trouve:=false; repeat j:=0; + //ns:=segment[i].numero; + //Affiche(intToSTR(ns),clred); np:=segment[i].nperiph; // nombre de périphériques repeat if np>0 then @@ -1894,9 +1977,10 @@ begin j:=0; np:=segment[i].nport; // nombre de ports ns:=segment[i].numero; + //Affiche(intToSTR(ns),clYellow); repeat p:=segment[i].port[j].numero; - //Affiche(intToSTR(p),clwhite); + //Affiche(intToSTR(p),clwhite); trouve:=(port=p) and (seg=ns); inc(j); until (j>np-1) or trouve; @@ -1929,7 +2013,7 @@ begin inc(i); until (i>np-1) or trouve; dec(i); - result:=i; + if trouve then result:=i else result:=-1; end; // trouve les index du port dans la liste des segments @@ -1994,21 +2078,22 @@ end; // fonction récursive -// explore le port,segment jusqu'a trouver une adresse d'aiguillage, de croisement, ou de détecteur +// explore le port,segment jusqu'à trouver une adresse d'aiguillage, de croisement, ou de détecteur +// un détecteur peut être sur un port de l'aiguillage // renvoie l'adresse de l'aiguillage ou du détecteur et dans C le port (P D S ou Z pour un détecteur) function explore_port(seg,port : integer;var c : string) : integer; var i,j,IdSeg,IdPort,NombrePeriph,port1,port2,portSuivant,segSuivant,portLocal, xp,yp,xd,yd,detect,nb_det : integer; typeP,serr : string; sdetect : Tdetect_cdm; + trouveDet : boolean; begin if seg=0 then begin explore_port:=0; exit; // laisser sinon mauvais transfert de variable dans la pile dans l'itération suivante!! end; - trouve_IndexSegPort(seg,port,idSeg,IdPort); - if idseg=-1 then + if not(trouve_IndexSegPort(seg,port,idSeg,IdPort)) then begin serr:='Erreur 1 pas trouvé le port '+intToSTR(port)+' dans la liste des segments'; Affiche(serr,clred); @@ -2018,12 +2103,30 @@ begin exit; end; + + // le port a il t-il des périphériques portant des détecteurs + NombrePeriph:=segment[idSeg].nperiph; + if NombrePeriph<>0 then + begin + i:=0; + repeat + if segment[idSeg].periph[i].typ='detector' then + begin + if segment[idSeg].periph[i].OnDevicePort=Idport then // le port du périphérique correspond au port exploré + begin + result:=segment[idSeg].periph[i].adresse; + c:='Z'; + exit; + end; + end; + inc(i); + until (i>NombrePeriph-1) or (trouveDet); + end; + // trouver le segment contigu connecté au port de connexion segSuivant:=segment[idseg].port[idport].ConnecteAuSeg; portSuivant:=segment[idseg].port[idport].ConnecteAuPort; - trouve_IndexSegPort(segSuivant,portSuivant,idSeg,IdPort); - //Affiche('segsuiv='+intToSTr(segsuivant),clred); - if idSeg=-1 then + if not(trouve_IndexSegPort(segSuivant,portSuivant,idSeg,IdPort)) then begin serr:='Erreur 2 pas trouvé le port '+intToSTR(port)+' dans la liste des segments'; Affiche(serr,clred); @@ -2033,7 +2136,6 @@ begin exit; end; - // remonter au segment pour voir si c'est un aiguillage typeP:=segment[idSeg].typ; @@ -2145,6 +2247,7 @@ begin if (port2<>portSuivant) and (segment[idSeg].port[1].connecte) then i:=explore_port(SegSuivant,port2,c); explore_port:=i; + if typeP='bumper_stop' then c:=''; exit; typeP:=segment[idSeg].typ; @@ -2168,8 +2271,10 @@ end; // stocke les aiguillages et les croisement dans le tableau Aig_CDM procedure remplit_Aig_cdm; - var i,j,NumSegment,IndexSegment,IndexPort, - adresse,adresse2,element,AdrCroisement : integer; +var i,j,NumSegment,IndexSegment,IndexPort,index,index2,g, + adresse,Adr,AdrAig,AdrAig2,adresse2,element,AdrCroisement,adrcrois,adrCDM : integer; + t : tequipement; + trouve : boolean; s,segType,c,serr : string; begin // 1er segment, 1er port @@ -2183,12 +2288,15 @@ begin NAig_CDM:=0; SeqAdrCroisement:=0; inc(DernAdrAig); + + // croisement for i:=0 to nseg-1 do begin segType:=segment[i].typ; if segType='crossing' then begin numSegment:=segment[i].numero; + if formImportation.radioCroisSuite.checked then AdrCroisement:=DernAdrAig+SeqAdrCroisement; if formImportation.radioCroisBase.checked then AdrCroisement:=BaseCroisement+SeqAdrCroisement; @@ -2196,6 +2304,7 @@ begin inc(nAig_CDM); Aig_CDM[nAig_CDM].adresse:=AdrCroisement; Aig_CDM[nAig_CDM].modele:=crois; + Aig_CDM[nAig_CDM].adrCDM:=segment[i].adr_CDM; s:='Segment '+intToSTR(numSegment)+' type='+segtype+' Adresse='+intToSTR(AdrCroisement); inc(SeqAdrCroisement); @@ -2208,7 +2317,7 @@ begin element:=explore_port(numsegment,segment[i].port[j].numero,c); if length(c)=0 then c:='Z'; - case j of // j=numéro de port + case j of // j=numéro de port du croisement (0 à 3) 0 : begin s:=s+'D';Aig_cdm[nAig_cdm].ddroit:=element;if length(c)<>0 then Aig_cdm[nAig_cdm].ddroitB:=c[1];end; 1 : begin s:=s+'S';Aig_cdm[nAig_cdm].dDevie:=element;if length(c)<>0 then Aig_cdm[nAig_cdm].ddevieB:=c[1];end; 2 : begin s:=s+'D';Aig_cdm[nAig_cdm].ADroit:=element;if length(c)<>0 then Aig_cdm[nAig_cdm].aDroitB:=c[1];end; @@ -2219,7 +2328,6 @@ begin if debugAnalyse then afficheDebug(s,clorange); end; - end; end; @@ -2228,6 +2336,7 @@ begin AfficheDebug('Liste des aiguillages',clWhite); AfficheDebug('--------------------------------',clWhite); end; + for i:=0 to nseg-1 do begin segType:=segment[i].typ; @@ -2251,7 +2360,9 @@ begin inc(nAig_CDM); Aig_CDM[nAig_CDM].adresse:=adresse; Aig_CDM[nAig_CDM].temps:=segment[i].duree; + Aig_CDM[nAig_CDM].bdj:=false; + // TJD if (SegType='dbl_slip_switch') then begin adresse2:=segment[i].adresse2; @@ -2280,25 +2391,34 @@ begin Aig_CDM[nAig_CDM].dDevieB:='S'; Aig_CDM[nAig_CDM].etatTJD:=4; end; - end; - if (SegType='turnout') or (SegType='turnout_sym') or (SegType='turnout_curved') or (SegType='turnout_curved_2r') then Aig_CDM[nAig_CDM].modele:=aig; + if (SegType='turnout') or (SegType='turnout_sym') or (SegType='turnout_curved') or (SegType='turnout_curved_2r') then + begin + Aig_CDM[nAig_CDM].modele:=aig; + Aig_CDM[nAig_CDM].adrCDM:=segment[i].adr_CDM; + end; if (SegType='turnout_3way') then begin Aig_CDM[nAig_CDM].modele:=triple; Aig_CDM[nAig_CDM].adrTriple:=segment[i].adresse2; end; + + if (segType='dbl_cross_over') then + begin + Affiche('Anomalie 65 : bretelle double jonction résiduelle adresse='+intToSTR(Aig_CDM[nAig_CDM].adresse),clred); + end; + // remplir les ports de connexion (aig et tjd) for j:=0 to segment[i].nport-1 do begin s:=' Port '+intToSTR(j)+' '; if (SegType<>'dbl_slip_switch') and (Segtype<>'turnout_3way') then case j of - 0 : s:=s+'P'; - 1 : s:=s+'D'; - 2 : s:=s+'S'; + 0 : s:=s+'P'; // le port 0 est la pointe + 1 : s:=s+'D'; // le port 1 est la position droite + 2 : s:=s+'S'; // le port 2 est la position déviée end; if (SegType='dbl_slip_switch') then //or (SegType='crossing') then @@ -2319,7 +2439,7 @@ begin 3 : s:=s+'S2'; end; - // explorer les ports de l'aiguillage + // explorer les ports de l'aiguillage element:=explore_port(numsegment,segment[i].port[j].numero,c); if length(c)=0 then c:='Z'; @@ -2372,6 +2492,122 @@ begin end; end; end; + + // balayer pour voir si il y a des croisement de bjd + // si oui, remplir les champs droits encore manquants des 4 aiguillages créés + for i:=1 to NAig_CDM do + begin + t:=aig_cdm[i].modele; + if (t=crois) and (aig_cdm[i].AdrCDM<>0) then // si c'est un croisement et que son adresse cdm<>0 (c'est une BJD) + begin + // un croisement dispose de 4 ports + adrcrois:=aig_cdm[i].Adresse; // adresse croisement + AdrCDM:=aig_cdm[i].adrCDM; + + // -------extrémités 1 et 2 du croisement + adr:=aig_cdm[i].ADevie; // adresse de l'aiguillage connecté à extr 1 + c:=aig_cdm[i].ADevieB; + + index:=index_aigCDM(adr); + adrAig:=aig_cdm[index].adresse; // adresse du premier aiguillage + + adr:=aig_cdm[i].Ddroit; // adresse de l'aiguillage connecté à extr 2 + c:=aig_cdm[i].DdroitB; + + index2:=index_aigCDM(adr); + adrAig2:=aig_cdm[index2].adresse; // adresse du 2ème aiguillage + + aig_CDM[index].Adroit:=adrAig2; + aig_CDM[index].AdroitB:='D'; + + aig_CDM[index2].Adroit:=adrAig; + aig_CDM[index2].AdroitB:='D'; + + // -------extrémités 3 et 4 du croisement + adr:=aig_cdm[i].ADroit; // adresse de l'aiguillage connecté à extr 3 =1 + c:=aig_cdm[i].ADroitB; + + index:=index_aigCDM(adr); + adrAig:=aig_cdm[index].adresse; // adresse du premier aiguillage =1 + + adr:=aig_cdm[i].Ddevie; // adresse de l'aiguillage connecté à extr 4 = 12 + c:=aig_cdm[i].DdevieB; + + index2:=index_aigCDM(adr); + adrAig2:=aig_cdm[index2].adresse; // adresse du 2ème aiguillage = 12 + + aig_CDM[index].Adroit:=adrAig2; + aig_CDM[index].AdroitB:='D'; + + + aig_CDM[index2].Adroit:=adrAig; + aig_CDM[index2].AdroitB:='D'; + + end; + end; + + // finir balayer les aiguillages pour voir si une extrémité est connectée à une bjd + for i:=1 to NAig_CDM do + begin + t:=aig_cdm[i].modele; + if (t=aig) then // or (t=crois) or (t=tjd) or (t=triple) then + begin + adr:=aig_cdm[i].adresse; + g:=ord(aig_cdm[i].AdroitB); + if (g>=ord('0')) and (g<=ord('9')) then + begin + // rebalayer les aiguillages qui ont une adresseCDM<>0 et dont l'adresse est = à celle de l'aiguillage + j:=1; + repeat + trouve:=(aig_cdm[j].Apointe=adr) and (aig_cdm[j].modele=aig); + inc(j); + until (j>NAig_CDM) or trouve; + if trouve then + begin + dec(j); + aig_cdm[i].Adroit:=aig_cdm[j].adresse; + aig_cdm[i].AdroitB:='P'; + end; + end; + + g:=ord(aig_cdm[i].AdevieB); + if (g>=ord('0')) and (g<=ord('9')) then + begin + // rebalayer les aiguillages qui ont une adresseCDM<>0 et dont l'adresse est = à celle de l'aiguillage + j:=1; + repeat + trouve:=(aig_cdm[j].Apointe=adr) and (aig_cdm[j].modele=aig); + inc(j); + until (j>NAig_CDM) or trouve; + if trouve then + begin + dec(j); + aig_cdm[i].Adevie:=aig_cdm[j].adresse; + aig_cdm[i].AdevieB:='P'; + end; + end; + + // si c'est la pointe qui est connectée à une bjd + g:=ord(aig_cdm[i].APointeB); + if (g>=ord('0')) and (g<=ord('9')) then + begin + // rebalayer les aiguillages qui ont une adresseCDM<>0 et dont l'adresse est = à celle de l'aiguillage + j:=1; + repeat + trouve:=(aig_cdm[j].Apointe=adr) and (aig_cdm[j].modele=aig); + inc(j); + until (j>NAig_CDM) or trouve; + if trouve then + begin + dec(j); + aig_cdm[i].APointe:=aig_cdm[j].adresse; + aig_cdm[i].APointeB:='P'; + end; + end; + + end; + end; + if nAig_CDM=0 then affiche('Aucun aiguillage avec adresse',clyellow); end; @@ -2445,6 +2681,13 @@ function trouve_seg_suivant(IndexSeg,Indexport : integer;var IndexSegSuiv,Indexp var PortSuiv,NumSegment,ips,SegSuiv,np : integer; ctype : string; begin + //Affiche('trouve le seg suivant au index '+intToSTR(IndexSeg)+' port '+intToSTR(Indexport),clyellow); + if indexSeg<0 then + begin + Affiche('Erreur indexSeg<0',clred); + result:=false; + exit; + end; numSegment:=segment[indexSeg].numero; numport:=segment[indexSeg].port[indexPort].numero; if nivDebug=3 then AfficheDebug('trouve le seg suivant au '+intToSTR(numSegment)+' port '+intToSTR(numport),clyellow); @@ -2522,11 +2765,11 @@ end; // créée la branche depuis un aiguillage dont un des ports est un détecteur -// indexSeg,port : index du segment et port de départ +// indexSeg,port : index du segment et port de départ (0=pointe,1=droit,2=dévié) // AdrAig : adresse de l'aiguillage qui a servi de départ // et remplit la branche (sBranche) procedure cree_branche_aig(indexSeg,Indexport,adrAig,NbreMaxiAigRencontres : integer); -var i,j,k,l,naig,IndexportSuivant,indexSegSuivant,NombrePeriph, +var i,j,k,l,n,nper,nport,naig,IndexportSuivant,indexSegSuivant,NombrePeriph, detecteur,indexElBranche,AdrAigRencontre,numSegment, rien,erreur,det2,nb_det,xp,yp,xd,yd,Adr2,AdrDer,idx : integer; trouve,doublon : boolean; @@ -2538,13 +2781,33 @@ begin AdrAigRencontre:=0; i:=0; Naig:=0; repeat + // trouver le port du détecteur + nper:=Segment[indexSeg].nperiph; // y a t-il des périph (recherche det) + if nper<>0 then + begin + n:=0; + repeat + k:=Segment[indexSeg].periph[n].OnDevicePort; // numéro de port sur lequel est le détecteur + if k=IndexPort then // si le port contenant le det est celui qu'on explore + begin + if Segment[indexSeg].periph[nperiph].typ='detector' then + begin + detecteur:=Segment[indexSeg].periph[nperiph].adresse; + if debugBranche then Affiche('Cet aiguillage porte le détecteur '+intToSTR(detecteur),clYellow); + sBranche:='A'+intToSTR(segment[indexSeg].adresse)+','+intToSTR(detecteur); + end; + end; + inc(n); + until (n>nper-1) or (k<>-1); + end; + if nivdebug=3 then begin numsegment:=segment[indexSeg].numero; NumPort:=segment[indexSeg].port[IndexPort].numero; AfficheDebug(intToSTR(i)+' Trouve suivant au= '+intToSTR(numSegment)+' '+intToSTR(NumPort),clOrange); end; - trouve:=trouve_Seg_suivant(indexSeg,indexport,IndexSegSuivant,IndexportSuivant); // indexSeg=48 + trouve:=trouve_Seg_suivant(indexSeg,indexport,IndexSegSuivant,IndexportSuivant); if not(trouve) then begin s:='Pas de segment suivant à '+intToSTR(numSegment)+' '+intToSTR(NumPort); @@ -2566,6 +2829,7 @@ begin begin AdrAigRencontre:=segment[indexSegSuivant].adresse; if debugBranche then Affichedebug('Aiguillage '+intTostr(adrAigRencontre),clyellow); + if (ctype='dbl_slip_switch') and (segment[indexSegSuivant].adresse2<>0) then begin // dernier élément rencontré @@ -2799,6 +3063,7 @@ var i,NumSegment,rien,indexSeg,IndexPeriph,indexPort,IndexSegSuivant,portSuivant trouve,fg : boolean; label essai_port; begin + sbranche:=''; indexPort:=0; // essayer sur port 0 du détecteur fg:=false; essai_port: @@ -2807,79 +3072,111 @@ begin AfficheDebug('Créée branche détecteur '+intToSTR(detecteur)+' sur port '+intToSTR(indexPort),clOrange); end; trouve:=trouve_IndexSegPortDetecteur(detecteur,indexSeg,indexPeriph); - numSegment:=Segment[indexSeg].numero; - if nivdebug=3 then AfficheDebug('Le segment porteur du détecteur est le '+intToSTR(numSegment)+' Periph '+intToSTR(Segment[indexSeg].periph[indexperiph].numero),clyellow); - - // parcourir les segments jusqu'au prochain aiguillage - i:=0; - repeat - //if trouve then Affiche(intToSTR(numSegment)+' '+intToSTR(indexPeriph),clyellow); - inc(i); - trouve:=trouve_Seg_suivant(indexSeg,indexport,IndexSegSuivant,IndexportSuivant); - if not(trouve) then - begin - s:='Erreur 678 : Pas trouvé d''aiguillage ou de buttoir après le segment / port '+intToSTR(numSegment)+'/'+intToSTR(Segment[indexSeg].port[indexPort].numero); - AfficheDebug(s,clred); - Affiche(s,clred); - sBranche:=''; - exit; - end; - numSegment:=Segment[indexSegSuivant].numero; - portSuivant:=Segment[indexSegSuivant].port[IndexPortSuivant].numero; - if nivdebug=3 then AfficheDebug('Suivant= '+intToSTR(numSegment)+' indexport '+intToSTR(IndexportSuivant),clYellow); - ctype:=segment[IndexSegSuivant].typ; - if ctype='bumper_stop' then - begin - // repartir en sens inverse - if indexPortSuivant=0 then indexPortSuivant:=1 else indexPortSuivant:=0; - portSuivant:=Segment[indexSegSuivant].port[IndexPortSuivant].numero; - end; - // si on rencontre une table, çà revient dans l'autre sens - - trouve:=segment_aig(ctype); // est-ce un aiguillage ??? - - // prépare suivant - if not(trouve) then - begin - IndexSeg:=IndexSegSuivant; - port:=trouve_port_suivant(indexSegSuivant,portSuivant); - trouve_IndexSegPort(Numsegment,port,rien,indexPort); - end; - until (i=50) or trouve; - if not(trouve) then begin - s:='68 : Pas trouvé d''aiguillage à proximité du détecteur '+intToSTR(detecteur); + s:='Erreur 677 : Pas trouvé le segment / port du détecteur '+intToSTR(detecteur); AfficheDebug(s,clred); - Affiche(s,clred); // et donc essayer sur le port 1 !! - if fg then - begin - S:='Pas trouvé d''aguillage de chaque côté du détecteur '+intToSTR(detecteur); - AfficheDebug(s,clred); - Affiche(s,clred); - exit; - end; - indexport:=1; - fg:=true; - goto essai_port; + Affiche(s,clred); + sBranche:=''; + exit; + end; + + + numSegment:=Segment[indexSeg].numero; + ctype:=segment[indexSeg].typ; + if DebugBranche then AfficheDebug('Le segment porteur du détecteur est le '+intToSTR(numSegment)+' Periph '+intToSTR(Segment[indexSeg].periph[indexperiph].numero)+' '+Ctype,clyellow); + { + if segment_aig(ctype) then // cas si c'est déja un aiguillage + begin + IndexSegSuivant:=IndexSeg; + // trouver le port du détecteur + i:=Segment[indexSeg].periph[indexperiph].OnDevicePort; // numéro de port sur lequel est le détecteur + PortSuivant:=Segment[indexSeg].port[i].numero; + sBranche:='A'+intToSTR(segment[indexSeg].adresse)+','+intToSTR(detecteur); + end + else} + begin + // parcourir les segments jusqu'au prochain aiguillage + i:=0; + repeat + //if trouve then Affiche(intToSTR(numSegment)+' '+intToSTR(indexPeriph),clyellow); + inc(i); + trouve:=trouve_Seg_suivant(indexSeg,indexport,IndexSegSuivant,IndexportSuivant); + if not(trouve) then + begin + s:='Erreur 678 : Pas trouvé d''aiguillage ou de buttoir après le segment / port '+intToSTR(numSegment)+'/'+intToSTR(Segment[indexSeg].port[indexPort].numero); + AfficheDebug(s,clred); + Affiche(s,clred); + sBranche:=''; + exit; + end; + numSegment:=Segment[indexSegSuivant].numero; + portSuivant:=Segment[indexSegSuivant].port[IndexPortSuivant].numero; + ctype:=segment[IndexSegSuivant].typ; + + if DebugBranche then AfficheDebug('Seg suivant='+intToSTR(numSegment)+' port='+intToSTR(portSuivant)+' '+ctype+' @='+intToSTR(segment[indexSegSuivant].adresse),clYellow); + + if ctype='bumper_stop' then + begin + // repartir en sens inverse + if indexPortSuivant=0 then indexPortSuivant:=1 else indexPortSuivant:=0; + portSuivant:=Segment[indexSegSuivant].port[IndexPortSuivant].numero; + end; + // si on rencontre une table, çà revient dans l'autre sens + + trouve:=segment_aig(ctype); // est-ce un aiguillage ??? + + // prépare suivant + if not(trouve) then + begin + IndexSeg:=IndexSegSuivant; + port:=trouve_port_suivant(indexSegSuivant,portSuivant); + trouve_IndexSegPort(Numsegment,port,rien,indexPort); + end; + until (i=50) or trouve; + + if not(trouve) then + begin + s:='68 : Pas trouvé d''aiguillage à proximité du détecteur '+intToSTR(detecteur); + AfficheDebug(s,clred); + Affiche(s,clred); // et donc essayer sur le port 1 !! + if fg then + begin + S:='Pas trouvé d''aguillage de chaque côté du détecteur '+intToSTR(detecteur); + AfficheDebug(s,clred); + Affiche(s,clred); + exit; + end; + indexport:=1; + fg:=true; + goto essai_port; + end; + + //partir de IndexSegSuivant, IndexPort + adresse:=segment[IndexSegSuivant].adresse; + sBranche:='A'+intToSTR(Adresse); end; - //partir de IndexSegSuivant, IndexPort - adresse:=segment[IndexSegSuivant].adresse; - sBranche:='A'+intToSTR(Adresse); //convertir le port en index IndexPort:=trouve_IndexPort_Segment(IndexSegSuivant,portSuivant); - - Cree_branche_aig(IndexSegSuivant,IndexPort,adresse,1); // 1 aiguillage rencontré maxi + if IndexPort=-1 then + begin + s:='Pas trouvé index port de '+intToSTR(IndexSegSuivant)+'/'+intToSTR(portSuivant); + AfficheDebug(s,clred); + Affiche(s,clred); + exit; + end; + // Crée branche depuis aiguillage + Cree_branche_aig(IndexSegSuivant,IndexPort,adresse,1) ; // 1 aiguillage rencontré maxi end; // procédure principale de création des branches procedure creee_branches; -var i,j,k,adresse,detecteur,indexSeg,det2,erreur : integer; - trouve : boolean; +var i,j,k,adresse,detecteur,indexSeg,det2,erreur,index : integer; + trouve,bjd : boolean; c : char; s : string; -begin +begin // l'origine d'une branche est la pointe d'un aiguillage connecté à un détecteur ---------- NbreBranches:=0; @@ -2900,16 +3197,20 @@ begin AfficheDebug('Début de branche n°'+intToSTR(NbreBranches+1)+' : aiguillage '+intToSTR(adresse)+' Pointe='+intToSTR(detecteur),clyellow); end; - trouve:=trouve_IdSegment_aig(adresse,indexSeg); - if not(trouve) then afficheDebug('Erreur 417 : Aig '+intToSTR(adresse)+' non trouvé ',clred); - //Affiche(IntToSTR(segment[indexSeg].numero),clYellow); + trouve:=trouve_IdSegment_aig(adresse,indexSeg); // trouve l'aiguillage dans les segments if trouve then begin port:=segment[indexSeg].port[0].numero; // on commence par le port 0 (pointe) de l'aiguillage sBranche:='A'+intToSTR(adresse); + // créée la branche depuis l'aiguillage cree_branche_aig(indexSeg,0,adresse,100); // branche dans sBranche if nivdebug=3 then AfficheDebug(sbranche,clwhite); + end + else + begin + // ne pas afficher de message pour un aiguillage non trouvé en segment s'il s'agit d'un aiguillage créé depuis une bretelle (BDJ) + if aiguillage[i].AdrCDM=0 then afficheDebug('Erreur 417 : Aig '+intToSTR(adresse)+' non trouvé ',clred); end; end; inc(i); // aiguillage suivant @@ -2971,7 +3272,7 @@ begin AfficheDebug('------------------',clyellow); AfficheDebug('Le détecteur '+intToSTR(detecteur)+' est absent des branches, création d''une branche le contenant ',clOrange); end; - cree_branche_det(detecteur); + cree_branche_det(detecteur) ; //if debugBranche then AfficheDebug(sbranche,clWhite); end; end; @@ -3298,11 +3599,26 @@ begin formprinc.Affiche_fenetre_CDM.enabled:=true; end; +// trouve l'adresse signaux complexes du croisement de la BDJ d'adresse CDM adresse +function adr_croisement_cdm(adresse : integer) : integer; +var i : integer; +begin + i:=1; + result:=0; + repeat + if (aig_cdm[i].adrCDM=adresse) and (aig_cdm[i].modele=crois) then + result:=aig_cdm[i].adresse; + inc(i); + until (i>nAig_CDM) ; +end; + // importe la base de données CDM dans la base de données Signaux complexes // et crée les branches procedure Importation; -var i : integer; +var Adr,AdrAig,AdrDet,i,j,n,baseBJD,segId,seg,PeriphId,NumPort : integer; + c : char; + t : tequipement; s: string; begin if MaxAiguillage<>0 then @@ -3318,7 +3634,7 @@ begin end; MaxAiguillage:=0; - + n:=0; Affiche('Importation des aiguillages et des branches',clWhite); // recopier les aiguillages CDM dans signaux_complexes @@ -3340,6 +3656,7 @@ begin Aiguillage[i].DDevie:=Aig_CDM[i].DDevie; Aiguillage[i].DDevieB:=Aig_CDM[i].DDevieB; Aiguillage[i].EtatTJD:=Aig_CDM[i].EtatTJD; + Aiguillage[i].AdrCDM:=aig_cdm[i].adrCDM; Aiguillage[i].posInit:=9; aiguillage[i].InversionCDM:=0; @@ -3369,17 +3686,166 @@ begin for i:=1 to NbreBranches do compile_branche(Branche[i],i); - trier_detecteurs; + trier_detecteurs; Affiche('Importation terminée',clWhite); Affiche('Vérification de la cohérence :',clWhite); if verif_coherence then Affiche('Configuration cohérente',clLime); if debugbranche or debugAnalyse then formDebug.Show; end; +procedure cree_croisement(i,adresse : integer); +begin + inc(nSeg); + inc(DernierSeg); + Affiche('Création croisement Segment '+intToSTR(DernierSeg),clyellow); + setlength(segment,nSeg); + Segment[nSeg-1].nport:=0; + Segment[nSeg-1].nperiph:=0; + Segment[nSeg-1].nInter:=0; + Segment[nSeg-1].adresse:=adresse; + Segment[nSeg-1].adr_CDM:=adresse; + + Segment[nSeg-1].numero:=DernierSeg; + Segment[nSeg-1].typ:='crossing'; + Segment[nSeg-1].nport:=4; + Segment[nSeg-1].nperiph:=0; + + Segment[nSeg-1].XMin:=segment[i].XMin; + Segment[nSeg-1].YMin:=segment[i].YMin; + Segment[nSeg-1].XMax:=segment[i].XMax; + Segment[nSeg-1].YMax:=segment[i].YMax; + + Segment[nSeg-1].StartAngle:=segment[i].StartAngle; + Segment[nSeg-1].ArcAngle:=segment[i].ArcAngle; + Segment[nSeg-1].Rayon:=segment[i].rayon; + + Segment[nSeg-1].longueur:=segment[i].longueur; + Segment[nSeg-1].lengthdev:=segment[i].lengthdev; + Segment[nSeg-1].DeltaDev:=segment[i].deltadev; + Segment[nSeg-1].Curveoffset:=segment[i].Curveoffset; + + // créer les 4 ports + setlength(segment[nSeg-1].port,4); + inc(DernierSeg); + Segment[nSeg-1].port[0].numero:=DernierSeg; + Segment[nSeg-1].port[0].typ:='port'; + Segment[nSeg-1].port[0].local:=0; // port 0 + Segment[nSeg-1].port[0].x:=segment[i].port[2].x; + Segment[nSeg-1].port[0].y:=segment[i].port[2].y; + Segment[nSeg-1].port[0].z:=0; + Segment[nSeg-1].port[0].angle:=0; + Segment[nSeg-1].port[0].connecte:=true; + Segment[nSeg-1].port[0].ConnecteAuPort:=990; // le port 0 est la pointe + Segment[nSeg-1].port[0].ConnecteAuSeg:=990; + + inc(DernierSeg); + Segment[nSeg-1].port[1].numero:=DernierSeg; + Segment[nSeg-1].port[1].typ:='port'; + Segment[nSeg-1].port[1].local:=1; + Segment[nSeg-1].port[1].x:=segment[i].port[3].x; + Segment[nSeg-1].port[1].y:=segment[i].port[3].y; + Segment[nSeg-1].port[1].z:=0; + Segment[nSeg-1].port[1].angle:=0; + Segment[nSeg-1].port[1].connecte:=true; + Segment[nSeg-1].port[1].ConnecteAuPort:=991; // le port 0 est la pointe + Segment[nSeg-1].port[1].ConnecteAuSeg:=991; + + inc(DernierSeg); + Segment[nSeg-1].port[2].numero:=DernierSeg; + Segment[nSeg-1].port[2].typ:='port'; + Segment[nSeg-1].port[2].local:=2; + Segment[nSeg-1].port[2].x:=segment[i].port[1].x; + Segment[nSeg-1].port[2].y:=segment[i].port[1].y; + Segment[nSeg-1].port[2].z:=0; + Segment[nSeg-1].port[2].angle:=0; + Segment[nSeg-1].port[2].connecte:=true; + Segment[nSeg-1].port[2].ConnecteAuPort:=992; // le port 0 est la pointe + Segment[nSeg-1].port[2].ConnecteAuSeg:=992; + + inc(DernierSeg); + Segment[nSeg-1].port[3].numero:=DernierSeg; + Segment[nSeg-1].port[3].typ:='port'; + Segment[nSeg-1].port[3].local:=3; + Segment[nSeg-1].port[3].x:=segment[i].port[0].x; + Segment[nSeg-1].port[3].y:=segment[i].port[0].y; + Segment[nSeg-1].port[3].z:=0; + Segment[nSeg-1].port[3].angle:=0; + Segment[nSeg-1].port[3].connecte:=true; + Segment[nSeg-1].port[3].ConnecteAuPort:=993; // le port 0 est la pointe + Segment[nSeg-1].port[3].ConnecteAuSeg:=993; + +end; + +// crée un aiguillage au seglent nSeg, à partir du segment i +procedure cree_aiguillage(i,adresse,AdrCDM : integer); +begin + inc(nSeg); //index de segment + inc(DernierSeg); //numéro de segment + Affiche('Création aiguillage Segment '+intToSTR(DernierSeg),clyellow); + setlength(segment,nSeg); + Segment[nSeg-1].nport:=0; + Segment[nSeg-1].nperiph:=0; + Segment[nSeg-1].nInter:=0; + + Segment[nSeg-1].numero:=DernierSeg; + Segment[nSeg-1].typ:='turnout'; + Segment[nSeg-1].nport:=3; + Segment[nSeg-1].nperiph:=0; + + Segment[nSeg-1].XMin:=segment[i].XMin; + Segment[nSeg-1].YMin:=segment[i].YMin; + Segment[nSeg-1].XMax:=segment[i].XMax; + Segment[nSeg-1].YMax:=segment[i].YMax; + + Segment[nSeg-1].adresse:=adresse; + Segment[nSeg-1].Adr_Cdm:=AdrCDM; + Segment[nSeg-1].duree:=segment[i].duree; + + // créer les 3 ports + setlength(segment[nSeg-1].port,3); + inc(DernierSeg); + Segment[nSeg-1].port[0].numero:=DernierSeg; + Segment[nSeg-1].port[0].typ:='port'; + Segment[nSeg-1].port[0].local:=0; + Segment[nSeg-1].port[0].x:=0; + Segment[nSeg-1].port[0].y:=0; + Segment[nSeg-1].port[0].z:=0; + Segment[nSeg-1].port[0].angle:=0; + Segment[nSeg-1].port[0].connecte:=true; + Segment[nSeg-1].port[0].ConnecteAuPort:=990; // le port 0 est la pointe + Segment[nSeg-1].port[0].ConnecteAuSeg:=990; + + inc(DernierSeg); + Segment[nSeg-1].port[1].numero:=DernierSeg; + Segment[nSeg-1].port[1].typ:='port'; + Segment[nSeg-1].port[1].local:=1; + Segment[nSeg-1].port[1].x:=0; + Segment[nSeg-1].port[1].y:=0; + Segment[nSeg-1].port[1].z:=0; + Segment[nSeg-1].port[1].angle:=0; + Segment[nSeg-1].port[1].connecte:=true; + Segment[nSeg-1].port[1].ConnecteAuPort:=991; // le port 0 est la pointe + Segment[nSeg-1].port[1].ConnecteAuSeg:=991; + + inc(DernierSeg); + Segment[nSeg-1].port[2].numero:=DernierSeg; + Segment[nSeg-1].port[2].typ:='port'; + Segment[nSeg-1].port[2].local:=2; + Segment[nSeg-1].port[2].x:=0; + Segment[nSeg-1].port[2].y:=0; + Segment[nSeg-1].port[2].z:=0; + Segment[nSeg-1].port[2].angle:=0; + Segment[nSeg-1].port[2].connecte:=true; + Segment[nSeg-1].port[2].ConnecteAuPort:=992; // le port 0 est la pointe + Segment[nSeg-1].port[2].ConnecteAuSeg:=992; + +end; + // compile le fichier Texte de CDM et l'importe procedure Compilation; var s : string; - nombre,position : integer; + nombre,position,adresse,i,j,n,ISegA1,ISegA2,ISegA3,ISegA4,ISegCrois,SegBJD, + IndexSeg,IndexPort,SegConn,PortConn : integer; begin nombre:=Formprinc.FenRich.Lines.Count; if nombre>0 then @@ -3412,6 +3878,7 @@ begin nPeriph:=0; nInter:=0; DernAdrAig:=0; + dernierSeg:=0; xminiCDM:=0;yMiniCDM:=0;xmaxiCDM:=0;yMaxiCDM:=0; NomModuleCDM:=AnsiLowerCase(Lignes[0]+'.cdm'); @@ -3445,17 +3912,266 @@ begin end; inc(nligne); until (nligne>nombre); - //Affiche('fin de la compilation',cllime); + Affiche('fin de la compilation des segments',cllime); + + // balayer les segments pour transformer les bjd en créant 1 croisement et 4 aiguillages dans les segments, puis on supprime la bjd des segments + i:=0; + repeat + if segment[i].typ='dbl_cross_over' then + begin + adresse:=segment[i].adresse; + SegBJD:=segment[i].numero; + s:='La BJD '+intToSTR(adresse)+' a été éclatée en un croisement et 4 aiguillages d''adresse '+intToSTR(DernAdrAig+1)+' a '+intToSTR(DernAdrAig+4); + Affiche(s,clYellow); + if DebugAnalyse then AfficheDebug(s,clYellow); + + ISegCrois:=Nseg; + Cree_croisement(i,adresse); + inc(DernAdrAig); + // si la BJD comporte des périphériques, les réintroduire dans le croisement + n:=segment[i].nperiph; + if n<>0 then + begin + s:='La BJD '+intToSTR(adresse)+' comporte des périphériques, réintégration dans le croisement Segment n°'+intToSTR(Segment[IsegCrois].numero); + Affiche(s,clyellow); + if debugAnalyse then AfficheDebug(s,clyellow); + segment[IsegCrois].nperiph:=n; + setlength(segment[IsegCrois].Periph,n); + segment[IsegCrois].periph:=segment[i].periph; + // mise à jour des champs + for j:=0 to n do + begin + segment[ISegCrois].periph[j].pere:=segment[iSegCrois].numero; + end; + end; + + // créer aiguillage 1 (SO) c'est le port 0 de la BJS depuis l'index i des segments + ISegA1:=Nseg; // dernier index de segment + cree_aiguillage(i,DernAdrAig,adresse); + // remplir les coordonnées x y de chaque port + Segment[iSegA1].port[0].x:=segment[iSegCrois].port[3].x; // SO : port 0 de la bjs + Segment[iSegA1].port[0].y:=segment[iSegCrois].port[3].y; + // port 1 : port droit : milieu + Segment[iSegA1].port[1].x:=(segment[iSegCrois].port[3].x+segment[iSegCrois].port[0].x) div 2; + Segment[iSegA1].port[1].y:=(segment[iSegCrois].port[3].y+segment[iSegCrois].port[0].y) div 2; + // port 2 : port devie : milieu + Segment[iSegA1].port[2].x:=(segment[iSegCrois].port[3].x+segment[iSegCrois].port[1].x) div 2; + Segment[iSegA1].port[2].y:=(segment[iSegCrois].port[3].y+segment[iSegCrois].port[1].y) div 2; + inc(DernAdrAig); + + // créer aiguillage 2 (NO) c'est le port 1 de la BJS depuis l'index i des segments + ISegA2:=Nseg; + cree_aiguillage(i,DernAdrAig,adresse); // créer aiguillage 2 depuis l'index i des segments + Segment[IsegA2].port[0].x:=segment[iSegCrois].port[2].x; // NO : port 1 de la bjs + Segment[IsegA2].port[0].y:=segment[iSegCrois].port[2].y; + // port 1 : port droit : milieu + Segment[IsegA2].port[1].x:=(segment[iSegCrois].port[2].x+segment[iSegCrois].port[1].x) div 2; + Segment[IsegA2].port[1].y:=(segment[iSegCrois].port[2].y+segment[iSegCrois].port[1].y) div 2; + // port 2 : port devie : milieu + Segment[IsegA2].port[2].x:=(segment[iSegCrois].port[2].x+segment[iSegCrois].port[0].x) div 2; + Segment[IsegA2].port[2].y:=(segment[iSegCrois].port[2].y+segment[iSegCrois].port[0].y) div 2; + inc(DernAdrAig); + + // créer aiguillage 3 (NE) c'est le port 3 de la BJS depuis l'index i des segments + ISegA3:=Nseg; + cree_aiguillage(i,DernAdrAig,adresse); // créer aiguillage 3 depuis l'index i des segments + Segment[ISegA3].port[0].x:=segment[iSegCrois].port[1].x; // NE : port 3 de la bjs + Segment[ISegA3].port[0].y:=segment[iSegCrois].port[1].y; + // port 1 : port droit : milieu + Segment[ISegA3].port[1].x:=(segment[iSegCrois].port[1].x+segment[iSegCrois].port[2].x) div 2; + Segment[ISegA3].port[1].y:=(segment[iSegCrois].port[1].y+segment[iSegCrois].port[2].y) div 2; + // port 2 : port devie : milieu + Segment[ISegA3].port[2].x:=(segment[iSegCrois].port[1].x+segment[iSegCrois].port[3].x) div 2; + Segment[ISegA3].port[2].y:=(segment[iSegCrois].port[1].y+segment[iSegCrois].port[3].y) div 2; + inc(DernAdrAig); + + // créer aiguillage 4 (SE) c'est le port 2 de la BJS depuis l'index i des segments + ISegA4:=Nseg; + cree_aiguillage(i,DernAdrAig,adresse); // créer aiguillage 3 depuis l'index i des segments + Segment[ISegA4].port[0].x:=segment[iSegCrois].port[0].x; // NE : port 2 de la bjs + Segment[ISegA4].port[0].y:=segment[iSegCrois].port[0].y; + // port 1 : port droit : milieu + Segment[ISegA4].port[1].x:=(segment[iSegCrois].port[0].x+segment[iSegCrois].port[3].x) div 2; + Segment[ISegA4].port[1].y:=(segment[iSegCrois].port[0].y+segment[iSegCrois].port[3].y) div 2; + // port 2 : port devie : milieu + Segment[ISegA4].port[2].x:=(segment[iSegCrois].port[0].x+segment[iSegCrois].port[2].x) div 2; + Segment[ISegA4].port[2].y:=(segment[iSegCrois].port[0].y+segment[iSegCrois].port[2].y) div 2; + inc(DernAdrAig); + + + // mettre à jour les ports du croisement + // les indices des ports opposés des croisements sont 0-2 et 1-3 + // croisement port 0 connecté à l'aig 1 port 2 (dévié) + // attention les ports opposés de la bjd sont 0-3 et 1-2 + segment[ISegCrois].port[0].ConnecteAuPort:=segment[iSegA1].port[2].numero; + segment[ISegCrois].port[0].ConnecteAuSeg:=segment[ISegA1].numero; + + + + // croisement port 1 connecté à l'aig 2 port 2 (dévié) + segment[ISegCrois].port[1].ConnecteAuPort:=segment[iSegA2].port[2].numero; + segment[ISegCrois].port[1].ConnecteAuSeg:=segment[ISegA2].numero; + + // croisement port 2 connecté à l'aig 3 port 2 (dévié) + segment[ISegCrois].port[2].ConnecteAuPort:=segment[iSegA3].port[2].numero; + segment[ISegCrois].port[2].ConnecteAuSeg:=segment[ISegA3].numero; + + // croisement port 3 connecté à l'aig 4 port 2 (dévié) + segment[ISegCrois].port[3].ConnecteAuPort:=segment[iSegA4].port[2].numero; + segment[ISegCrois].port[3].ConnecteAuSeg:=segment[ISegA4].numero; + + + // aiguillage 1, port 0 (pointe) + segment[ISegA1].port[0].ConnecteAuPort:=segment[i].port[0].ConnecteAuPort; + segment[ISegA1].port[0].ConnecteAuSeg:=segment[i].port[0].ConnecteAuSeg; + // aiguillage 1, port 1 (droit) au port 1 (droit) de l'aig 4 + segment[ISegA1].port[1].ConnecteAuPort:=segment[iSegA4].port[1].numero; + segment[ISegA1].port[1].ConnecteAuSeg:=segment[ISegA4].numero; + // aiguillage 1, port 2 (dévié) au port 0 du croisement + segment[ISegA1].port[2].ConnecteAuPort:=segment[iSegCrois].port[0].numero; + segment[ISegA1].port[2].ConnecteAuSeg:=segment[ISegCrois].numero; + + // aiguillage 2, port 0 (pointe) + segment[ISegA2].port[0].ConnecteAuPort:=segment[i].port[1].ConnecteAuPort;; + segment[ISegA2].port[0].ConnecteAuSeg:=segment[i].port[1].ConnecteAuSeg; + // aiguillage 2, port 1 (droit) au port 1 (droit) de l'aig 3 + segment[ISegA2].port[1].ConnecteAuPort:=segment[iSegA3].port[1].numero; + segment[ISegA2].port[1].ConnecteAuSeg:=segment[ISegA3].numero; + // aiguillage 2, port 2 (dévié) au port 1 du croisement + segment[ISegA2].port[2].ConnecteAuPort:=segment[iSegCrois].port[1].numero; + segment[ISegA2].port[2].ConnecteAuSeg:=segment[ISegCrois].numero; + + // aiguillage 3, port 0 (pointe) extérieur + segment[ISegA3].port[0].ConnecteAuPort:=segment[i].port[3].ConnecteAuPort; + segment[ISegA3].port[0].ConnecteAuSeg:=segment[i].port[3].ConnecteAuSeg; + // aiguillage 3, port 1 (droit) au port 1 (droit) de l'aig 2 + segment[ISegA3].port[1].ConnecteAuPort:=segment[iSegA2].port[1].numero; + segment[ISegA3].port[1].ConnecteAuSeg:=segment[ISegA2].numero; + // aiguillage 3, port 2 (dévié) au port 2 du croisement + segment[ISegA3].port[2].ConnecteAuPort:=segment[iSegCrois].port[2].numero; + segment[ISegA3].port[2].ConnecteAuSeg:=segment[ISegCrois].numero; + + // aiguillage 4, port 0 (pointe) + segment[ISegA4].port[0].ConnecteAuPort:=segment[i].port[2].ConnecteAuPort;; + segment[ISegA4].port[0].ConnecteAuSeg:=segment[i].port[2].ConnecteAuSeg; + // aiguillage 4, port 1 (droit) au port 1 (droit) de l'aig 1 + segment[ISegA4].port[1].ConnecteAuPort:=segment[iSegA1].port[1].numero; + segment[ISegA4].port[1].ConnecteAuSeg:=segment[ISegA1].numero; + // aiguillage 4, port 2 (dévié) au port 3 du croisement + segment[ISegA4].port[2].ConnecteAuPort:=segment[iSegCrois].port[3].numero; + segment[ISegA4].port[2].ConnecteAuSeg:=segment[ISegCrois].numero; + + + if DebugAnalyse then + begin + AfficheDebug('Crois : Seg='+intToSTR(segment[IsegCrois].numero),clOrange); + for j:=0 to 3 do AfficheDebug('port '+intToSTR(j)+'/'+intToSTR(segment[IsegCrois].port[j].numero)+ + ' connecté au Seg '+intToSTR(segment[IsegCrois].port[j].ConnecteAuSeg)+ + ' connecté au port '+intToSTR(segment[IsegCrois].port[j].ConnecteAuPort),clYellow); + + AfficheDebug('Aig1 : Seg='+intToSTR(segment[ISegA1].numero),clOrange); + for j:=0 to 2 do AfficheDebug('port '+intToSTR(j)+'/'+intToSTR(segment[IsegA1].port[j].numero)+ + ' connecté au Seg '+intToSTR(segment[ISegA1].port[j].ConnecteAuSeg)+ + ' connecté au port '+intToSTR(segment[ISegA1].port[j].ConnecteAuPort),clYellow); + + AfficheDebug('Aig2 : Seg='+intToSTR(segment[ISegA2].numero),clOrange); + for j:=0 to 2 do AfficheDebug('port '+intToSTR(j)+'/'+intToSTR(segment[IsegA2].port[j].numero)+ + ' connecté au Seg '+intToSTR(segment[ISegA2].port[j].ConnecteAuSeg)+ + ' connecté au port '+intToSTR(segment[ISegA2].port[j].ConnecteAuPort),clYellow); + + AfficheDebug('Aig3 : Seg='+intToSTR(segment[ISegA3].numero),clOrange); + for j:=0 to 2 do AfficheDebug('port '+intToSTR(j)+'/'+intToSTR(segment[IsegA3].port[j].numero)+ + ' connecté au Seg '+intToSTR(segment[ISegA3].port[j].ConnecteAuSeg)+ + ' connecté au port '+intToSTR(segment[ISegA3].port[j].ConnecteAuPort),clYellow); + + AfficheDebug('Aig4 : Seg='+intToSTR(segment[ISegA4].numero),clOrange); + for j:=0 to 2 do AfficheDebug('port '+intToSTR(j)+'/'+intToSTR(segment[IsegA4].port[j].numero)+ + ' connecté au Seg '+intToSTR(segment[ISegA4].port[j].ConnecteAuSeg)+ + ' connecté au port '+intToSTR(segment[ISegA4].port[j].ConnecteAuPort),clYellow); + end; + + // Le port 0 de la bjd est maintenant représenté par le port 0 de l'aiguillage 1 + SegConn:=segment[i].port[0].ConnecteAuSeg; + PortConn:=segment[i].port[0].ConnecteAuPort; + if not(trouve_IndexSegPort(SegConn,PortConn,IndexSeg,IndexPort)) then // index de l'élément connecté au port 0 de la bjd + begin + s:='Erreur 80 : pas trouvé index Segment/Port de '+intToSTR(SegConn)+'/'+intToSTR(portconn); + AfficheDebug(s,clred); + Affiche(s,clred); + exit; + end; + + segment[IndexSeg].port[IndexPort].ConnecteAuSeg:=segment[ISegA1].numero; + segment[IndexSeg].port[IndexPort].ConnecteAuPort:=segment[ISegA1].port[0].numero; + + // Le port 1 de la bjd est maintenant représenté par le port 0 de l'aiguillage 2 + SegConn:=segment[i].port[1].ConnecteAuSeg; + PortConn:=segment[i].port[1].ConnecteAuPort; + if not(trouve_IndexSegPort(SegConn,PortConn,IndexSeg,IndexPort)) then // index de l'élément connecté au port 0 de la bjd + begin + s:='Erreur 81 : pas trouvé index Segment/Port de '+intToSTR(SegConn)+'/'+intToSTR(portconn); + AfficheDebug(s,clred); + Affiche(s,clred); + exit; + end; + segment[IndexSeg].port[IndexPort].ConnecteAuSeg:=segment[ISegA2].numero; + segment[IndexSeg].port[IndexPort].ConnecteAuPort:=segment[ISegA2].port[0].numero; + + // Le port 2 de la bjd est maintenant représenté par le port 0 de l'aiguillage 4 + SegConn:=segment[i].port[2].ConnecteAuSeg; + PortConn:=segment[i].port[2].ConnecteAuPort; + if not(trouve_IndexSegPort(SegConn,PortConn,IndexSeg,IndexPort)) then // index de l'élément connecté au port 0 de la bjd + begin + s:='Erreur 82 : pas trouvé index Segment/Port de '+intToSTR(SegConn)+'/'+intToSTR(portconn); + AfficheDebug(s,clred); + Affiche(s,clred); + exit; + end; + segment[IndexSeg].port[IndexPort].ConnecteAuSeg:=segment[ISegA4].numero; + segment[IndexSeg].port[IndexPort].ConnecteAuPort:=segment[ISegA4].port[0].numero; + + // Le port 3 de la bjd est maintenant représenté par le port 0 de l'aiguillage 3 + SegConn:=segment[i].port[3].ConnecteAuSeg; + PortConn:=segment[i].port[3].ConnecteAuPort; + if not(trouve_IndexSegPort(SegConn,PortConn,IndexSeg,IndexPort)) then // index de l'élément connecté au port 0 de la bjd + begin + s:='Erreur 83 : pas trouvé index Segment/Port de '+intToSTR(SegConn)+'/'+intToSTR(portconn); + AfficheDebug(s,clred); + Affiche(s,clred); + exit; + end; + segment[IndexSeg].port[IndexPort].ConnecteAuSeg:=segment[ISegA3].numero; + segment[IndexSeg].port[IndexPort].ConnecteAuPort:=segment[ISegA3].port[0].numero; + + end; + + inc(i); + until i>=nSeg; + + // supprimer les segments bjd à voir si 2 bjd adjacentes en index + i:=0; + repeat + if segment[i].typ='dbl_cross_over' then + begin + s:='Suppression bjd '+intToSTR(segment[i].adresse)+' des segments'; + Affiche(s,clOrange); + if DebugAnalyse then AfficheDebug(s,clOrange); + for j:=i to nseg-2 do segment[j]:=segment[j+1]; + dec(nseg); + end; + inc(i); + until i>=nseg-1; Affichage(false); - Affiche('nombre de détecteurs: '+intToSTR(NDet_cdm),clyellow); + Affiche('nombre de détecteurs='+intToSTR(NDet_cdm),clyellow); formAnalyseCDM.Show; formprinc.ButtonAffAnalyseCDM.Visible:=true; Affiche('Compilation terminée. Nombre de segments='+intToSTR(nSeg),clWhite); - remplit_Aig_cdm; - Affiche('nombre d''aiguillages: '+intToSTR(Naig_cdm),clyellow); + remplit_Aig_cdm; //fabrique les aiguillages + Affiche('Nombre d''aiguillages='+intToSTR(Naig_cdm),clyellow); + Affiche('Dernière adresse d''aiguillage='+intToSTR(DernAdrAig),clyellow); // sauvegarde sauve_ficher_cdm; @@ -3534,6 +4250,9 @@ begin premaff:=true; buttonAnime.Visible:=not(diffusion); + reducX:=1; + reducY:=1; // évite la division par 0 + with FwicImage do begin largeurTrain:=Width; // largeur de l'icone du train @@ -3552,7 +4271,7 @@ end; procedure clic_image; var pt : Tpoint; - xSouris,ySouris,x1,y1,x2,y2,i,centreX,centrey,rayon,numero: integer; + xSouris,ySouris,x1,y1,x2,y2,i,j,centreX,centrey,rayon,numero: integer; StartAngle,StopAngle : double; trouve : boolean; debug : boolean; @@ -3566,17 +4285,17 @@ begin canvas:=FormAnalyseCDM.ImageCDM.Canvas; - //index_segment(6713,i); i:=0; repeat numero:=segment[i].numero; debug:=false; - // debug:=(numero=6989) or (numero=6980); + if debug then Affiche('Segment'+inttoSTR(segment[i].numero),clYellow); //Affiche(intToSTR(x1)+' '+intToSTR(y1)+' / '+intToSTR(x2)+' '+intToSTR(y2),clYellow); ctype:=Segment[i].typ; + // aiguillage à 3 ports (turnout) if segment_aig(ctype) and (ctype<>'dbl_slip_switch') then begin x1:=segment[i].port[0].x; @@ -3588,19 +4307,27 @@ begin trouve:=point_Sur_Segment(Xsouris,Ysouris,x1,y1,x2,y2); if trouve then begin - Canvas.Pen.Width:=largeur_voie; - Canvas.pen.Color:=clred; - canvas.MoveTo(x1,y1); - canvas.LineTo(x2,y2); + with canvas do + begin + Pen.Width:=largeur_voie; + pen.Color:=clred; + MoveTo(x1,y1); + LineTo(x2,y2); + TextOut(x1,y1+5,'P0:'+intToSTR(segment[i].port[0].numero)); + TextOut(x2,y2+5,'P1:'+intToSTR(segment[i].port[1].numero)); + end; x1:=(x1+x2) div 2; y1:=(y1+y2) div 2; x2:=segment[i].port[2].x; y2:=segment[i].port[2].y; coords(x2,y2); - canvas.MoveTo(x1,y1); - canvas.LineTo(x2,y2); - + with canvas do + begin + MoveTo(x1,y1); + LineTo(x2,y2); + TextOut(x2,y2+5,'P2:'+intToSTR(segment[i].port[2].numero)); + end; if ctype='turnout_3way' then begin canvas.moveTo(x1,y1); @@ -3651,8 +4378,13 @@ begin y2:=segment[i].port[3].y; coords(x1,y1); coords(x2,y2); - canvas.MoveTo(x1,y1); - canvas.LineTo(x2,y2); + with canvas do + begin + MoveTo(x1,y1); + LineTo(x2,y2); + TextOut(x1,y1+5,'P1:'+intToSTR(segment[i].port[1].numero)); + TextOut(x2,y2+5,'P3:'+intToSTR(segment[i].port[3].numero)); + end; x1:=segment[i].port[0].x; y1:=segment[i].port[0].y; @@ -3660,8 +4392,13 @@ begin y2:=segment[i].port[2].y; coords(x1,y1); coords(x2,y2); - canvas.MoveTo(x1,y1); - canvas.LineTo(x2,y2); + with canvas do + begin + MoveTo(x1,y1); + LineTo(x2,y2); + TextOut(x1,y1+5,'P0:'+intToSTR(segment[i].port[0].numero)); + TextOut(x2,y2+5,'P2:'+intToSTR(segment[i].port[2].numero)); + end; xAig:=x1;yAig:=y1-5; end; @@ -3745,6 +4482,10 @@ begin begin s:=s+#13+'Adr='+intToSTR(x1); if Segment[i].adresse2<>0 then s:=s+'/'+intToSTR(Segment[i].adresse2); + for j:=0 to segment[i].nport-1 do + begin + s:=s+#13+'Port '+intToSTR(j)+' : '+intToSTR(Segment[i].port[j].numero); + end; end; Hint:=s; showHint:=true; diff --git a/UnitConfig.dfm b/UnitConfig.dfm index 179f1c8..987e5d9 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -668,7 +668,7 @@ object FormConfig: TFormConfig Top = 8 Width = 633 Height = 505 - ActivePage = TabSheetCDM + ActivePage = TabSheetAig Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -2405,7 +2405,7 @@ object FormConfig: TFormConfig Width = 137 Height = 21 Style = csDropDownList - ItemHeight = 13 + ItemHeight = 0 TabOrder = 1 OnChange = ComboBoxDecChange end @@ -2512,7 +2512,7 @@ object FormConfig: TFormConfig Width = 137 Height = 21 Style = csDropDownList - ItemHeight = 13 + ItemHeight = 0 TabOrder = 2 OnChange = ComboBoxAspChange end diff --git a/UnitConfig.pas b/UnitConfig.pas index 0898bb9..a3bc4fc 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -1041,6 +1041,8 @@ begin if aiguillage[index].EtatTJD=2 then s:=s+',E2' else s:=s+',E4'; end; + s:=s+',C'+intToSTR(aiguillage[index].AdrCDM); + encode_aig:=s; end; @@ -2669,7 +2671,7 @@ var s,sa,SOrigine: string; aiguillage[maxaiguillage].tjsInt:=adr; c:=#0; if erreur<>0 then c:=enregistrement[erreur]; - if ((c<>'S') and (c<>'D')) then + if ((c<>'S') and (c<>'D')) then begin c:=' ';Affiche('Erreur paramètre L '+sOrigine,clred); end; @@ -2688,7 +2690,7 @@ var s,sa,SOrigine: string; i:=pos(',',enregistrement); if i<>0 then delete(enregistrement,1,i); Val(enregistrement,j,erreur); - aiguillage[maxaiguillage].temps:=j; + aiguillage[maxaiguillage].temps:=j; aiguillage[maxaiguillage].posinit:=position; i:=pos(')',enregistrement); delete(enregistrement,1,i); @@ -2708,6 +2710,17 @@ var s,sa,SOrigine: string; delete(enregistrement,1,virgule); end; + if (length(enregistrement)<>0) then + if enregistrement[1]='C' then + begin + delete(enregistrement,1,1); + Val(enregistrement,adr,erreur); + aiguillage[maxaiguillage].AdrCDM:=adr; + virgule:=pos(',',enregistrement);if virgule=0 then virgule:=length(s)+1; + delete(enregistrement,1,virgule); + end; + + inc(itl); until (enregistrement='') or (itl>3); if itl>4 then begin Affiche('Erreur 400 ligne '+sOrigine,clred);exit;end; @@ -5753,6 +5766,7 @@ begin //Affiche(s,clLime); if s='' then exit; + formconfig.labelInfo.caption:=''; Val(s,Adresse,erreur); // Récupérer l'adresse de l'aiguillage if adresse=0 then exit; @@ -5760,7 +5774,7 @@ begin clicliste:=true; ss:=InttoSTr(Adresse); - formconfig.EditAdrAig.text:= ss; + formconfig.EditAdrAig.text:=ss; if sombre then formConfig.editAdrAig.Color:=couleurfond else FormConfig.EditAdrAig.Color:=clWindow; tjd:=pos('TJD',s)<>0 ; @@ -5877,14 +5891,14 @@ begin end; CheckInverse.checked:=aiguillage[Index_Aig(adresse)].inversionCDM=1; - + 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 + if croi then begin GroupBox21.Visible:=false; GroupBox10.Visible:=false; @@ -5971,6 +5985,11 @@ begin formconfig.EditTempo10.text:=InttoSTr(aiguillage[index].temps); formconfig.EditTempo10.text:=InttoSTr(aiguillage[index].temps); + if aiguillage[index].AdrCDM<>0 then + begin + if croi then s:='Croisement ' else s:='Aiguillage '; + formconfig.labelInfo.caption:=s+'décrivant la BJS '+intToSTR(aiguillage[index].AdrCDM); + end; clicListe:=false; end; @@ -9280,8 +9299,9 @@ begin // et les tjd pour voir si pb de cohérence for Indexaig:=1 to maxaiguillage do begin + modAig:=aiguillage[Indexaig].modele; // tjd ou tjs - if ((aiguillage[Indexaig].modele=tjd) and (aiguillage[Indexaig].EtatTJD=4)) or (aiguillage[Indexaig].modele=tjs) then + if ((modAig=tjd) and (aiguillage[Indexaig].EtatTJD=4)) or (modAig=tjs) then begin if aiguillage[Indexaig].Ddroit<>aiguillage[Indexaig].Ddevie then begin @@ -9296,6 +9316,7 @@ begin ok:=false; end; end; + // vérifier si l'aiguillage est dans les branches inutile {if aiguillage[Indexaig].modele<>rien then begin @@ -9307,100 +9328,119 @@ begin end; end;} - // vérifier si le détecteur sur la position droite est dans les branches - adr:=aiguillage[Indexaig].Adroit; - if (aiguillage[Indexaig].AdroitB='Z') or (aiguillage[Indexaig].AdroitB=#0) then + // exclure les TJD/S + if (modAig<>tjd) and (modAig<>tjs) then begin - trouve_detecteur(adr); - if IndexBranche_trouve=0 then + // vérifier si le détecteur sur la position droite est dans les branches + adr:=aiguillage[Indexaig].Adroit; + if (aiguillage[Indexaig].AdroitB='Z') or (aiguillage[Indexaig].AdroitB=#0) then begin - Affiche('Erreur 21.1: détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clred); - ok:=false; - end - else - begin - AdrAig:=aiguillage[IndexAig].Adresse; - det1br:=brancheN[branche_trouve,indexBranche_trouve-1].Adresse; // adresse avant détecteur - det2br:=brancheN[branche_trouve,indexBranche_trouve+1].Adresse; // adresse après détecteur - if (det1br<>AdrAig) and (det2br<>AdrAig) and (adr<>0) then - begin - Affiche('Erreur 21.2: Le détecteur '+intToSTR(adr)+' est décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais déclaré dans la ',clred); - s:='branche '+intToSTR(Branche_trouve)+' entre'; - if brancheN[branche_trouve,indexBranche_trouve-1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; - s:=s+intToSTR(det1br)+' et '; - if brancheN[branche_trouve,indexBranche_trouve+1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; - s:=s+intToSTR(det2br); - Affiche(s,clred); - ok:=false; - end; - end; - end; - // vérifier si le détecteur sur la position déviée est dans les branches - adr:=aiguillage[Indexaig].Adevie; - if (aiguillage[Indexaig].AdevieB='Z') or (aiguillage[Indexaig].AdevieB=#0) then - begin - trouve_detecteur(adr); - if IndexBranche_trouve=0 then - begin - Affiche('Erreur 22.1: détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clRed); - ok:=false; - end - else - begin - AdrAig:=aiguillage[IndexAig].Adresse; - det1br:=brancheN[branche_trouve,indexBranche_trouve-1].Adresse; // adresse avant détecteur - det2br:=brancheN[branche_trouve,indexBranche_trouve+1].Adresse; // adresse après détecteur - if (det1br<>AdrAig) and (det2br<>AdrAig) and (adr<>0) then - begin - Affiche('Erreur 22.2: Le détecteur '+intToSTR(adr)+' est décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais déclaré dans la ',clred); - s:='branche '+intToSTR(Branche_trouve)+' entre'; - if brancheN[branche_trouve,indexBranche_trouve-1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; - s:=s+intToSTR(det1br)+' et '; - if brancheN[branche_trouve,indexBranche_trouve+1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; - s:=s+intToSTR(det2br); - Affiche(s,clred); - ok:=false; - end; - end; - end; - // vérifier si le détecteur sur la pointe est dans les branches - adr:=aiguillage[Indexaig].Apointe; - if ( ((aiguillage[Indexaig].ApointeB='Z') or (aiguillage[Indexaig].ApointeB=#0)) and (aiguillage[Indexaig].modele=aig) ) then - begin - trouve_detecteur(adr); - if IndexBranche_trouve=0 then - begin - Affiche('Erreur 23.1 : détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clRed); - ok:=false; - end - else - begin - AdrAig:=aiguillage[IndexAig].Adresse; - det1br:=brancheN[branche_trouve,indexBranche_trouve-1].Adresse; // adresse avant détecteur - det2br:=brancheN[branche_trouve,indexBranche_trouve+1].Adresse; // adresse après détecteur - if (det1br<>AdrAig) and (det2br<>AdrAig) and (adr<>0) then - begin - Affiche('Erreur 23.2: Le détecteur '+intToSTR(adr)+' est décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais déclaré dans la ',clred); - s:='branche '+intToSTR(Branche_trouve)+' entre'; - if brancheN[branche_trouve,indexBranche_trouve-1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; - s:=s+intToSTR(det1br)+' et '; - if brancheN[branche_trouve,indexBranche_trouve+1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; - s:=s+intToSTR(det2br); - Affiche(s,clred); - ok:=false; - end; - end; - end; - if (aiguillage[Indexaig].modele=triple) then // aiguillage triple - begin - if (aiguillage[Indexaig].Adevie2B='Z') or (aiguillage[Indexaig].Adevie2B=#0) then - begin - adr:=aiguillage[Indexaig].Adevie2; trouve_detecteur(adr); if IndexBranche_trouve=0 then begin - Affiche('Erreur 5 : détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clRed); + Affiche('Erreur 21.1: détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clred); ok:=false; + end + else + begin + AdrAig:=aiguillage[IndexAig].Adresse; + if indexBranche_Trouve>1 then det1br:=brancheN[branche_trouve,indexBranche_trouve-1].Adresse // adresse avant détecteur + else det1br:=0; + det2br:=brancheN[branche_trouve,indexBranche_trouve+1].Adresse; // adresse après détecteur + if (det1br<>AdrAig) and (det2br<>AdrAig) and (adr<>0) then + begin + Affiche('Erreur 21.2: Le détecteur '+intToSTR(adr)+' est décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais déclaré dans la ',clred); + s:='branche '+intToSTR(Branche_trouve)+' entre'; + if indexBranche_trouve>1 then + if brancheN[branche_trouve,indexBranche_trouve-1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; + s:=s+intToSTR(det1br)+' et '; + if brancheN[branche_trouve,indexBranche_trouve+1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; + s:=s+intToSTR(det2br); + Affiche(s,clred); + ok:=false; + end; + end; + end; + + // vérifier si le détecteur sur la position déviée est dans les branches + + adr:=aiguillage[Indexaig].Adevie; + if (aiguillage[Indexaig].AdevieB='Z') or (aiguillage[Indexaig].AdevieB=#0) then + begin + trouve_detecteur(adr); + if IndexBranche_trouve=0 then + begin + Affiche('Erreur 22.1: détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clRed); + ok:=false; + end + else + begin + AdrAig:=aiguillage[IndexAig].Adresse; + if indexBranche_trouve>1 then det1br:=brancheN[branche_trouve,indexBranche_trouve-1].Adresse // adresse avant détecteur + else det1br:=0; + det2br:=brancheN[branche_trouve,indexBranche_trouve+1].Adresse; // adresse après détecteur + if (det1br<>AdrAig) and (det2br<>AdrAig) and (adr<>0) then + begin + Affiche('Erreur 22.2: Le détecteur '+intToSTR(adr)+' est décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais déclaré dans la ',clred); + s:='branche '+intToSTR(Branche_trouve)+' entre'; + if indexBranche_trouve>1 then + if brancheN[branche_trouve,indexBranche_trouve-1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; + s:=s+intToSTR(det1br)+' et '; + if brancheN[branche_trouve,indexBranche_trouve+1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; + s:=s+intToSTR(det2br); + Affiche(s,clred); + ok:=false; + end; + end; + end; + + // vérifier si le détecteur sur la pointe est dans les branches + adr:=aiguillage[Indexaig].Apointe; + if ( ((aiguillage[Indexaig].ApointeB='Z') or (aiguillage[Indexaig].ApointeB=#0)) and (aiguillage[Indexaig].modele=aig) ) then + begin + trouve_detecteur(adr); + if IndexBranche_trouve=0 then + begin + Affiche('Erreur 23.1 : détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clRed); + ok:=false; + end + else + begin + AdrAig:=aiguillage[IndexAig].Adresse; + if indexBranche_trouve>1 then + begin + det1br:=brancheN[branche_trouve,indexBranche_trouve-1].Adresse; // adresse avant détecteur + model:=brancheN[branche_trouve,indexBranche_trouve-1].Btype; + end + else begin det1br:=0;model:=det;end; + + det2br:=brancheN[branche_trouve,indexBranche_trouve+1].Adresse; // adresse après détecteur + model2:=brancheN[branche_trouve,indexBranche_trouve+1].Btype; + if (det1br<>AdrAig) and (model=det) and (det2br<>AdrAig) and (model2=det) and (adr<>0) then + begin + Affiche('Erreur 23.2: Le détecteur '+intToSTR(adr)+' est décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais déclaré dans la ',clred); + s:='branche '+intToSTR(Branche_trouve)+' entre'; + if indexBranche_trouve>1 then + if brancheN[branche_trouve,indexBranche_trouve-1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; + s:=s+intToSTR(det1br)+' et '; + if brancheN[branche_trouve,indexBranche_trouve+1].BType=aig then s:=s+' l''aiguillage ' else s:=s+' le détecteur '; + s:=s+intToSTR(det2br); + Affiche(s,clred); + ok:=false; + end; + end; + end; + if (aiguillage[Indexaig].modele=triple) then // aiguillage triple + begin + if (aiguillage[Indexaig].Adevie2B='Z') or (aiguillage[Indexaig].Adevie2B=#0) then + begin + adr:=aiguillage[Indexaig].Adevie2; + trouve_detecteur(adr); + if IndexBranche_trouve=0 then + begin + Affiche('Erreur 5 : détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clRed); + ok:=false; + end; end; end; end; @@ -9735,20 +9775,20 @@ begin if c='D' then begin extr:=aiguillage[index2].ADroit; - if adr<>extr then Affiche('Erreur 10.23: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'D différent de '+intToSTR(extr),clred); + if adr<>extr then Affiche('Erreur 10.23: Discordance de déclaration aiguillages '+intToSTR(adr)+'D: '+intToSTR(adr2)+'D différent de '+intToSTR(extr),clred); end; if c='S' then begin extr:=aiguillage[index2].ADevie; - if adr<>extr then Affiche('Erreur 10.24: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); + if adr<>extr then Affiche('Erreur 10.24: Discordance de déclaration aiguillages '+intToSTR(adr)+'D: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); end; if c='P' then begin extr:=aiguillage[index2].APointe; - if adr<>extr then Affiche('Erreur 10.25: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); + if adr<>extr then Affiche('Erreur 10.25: Discordance de déclaration aiguillages '+intToSTR(adr)+'D: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); end; end; - end; + end; end; adr2:=aiguillage[indexaig].Adevie; // adresse de ce qui est connecté sur la position déviée @@ -9773,7 +9813,7 @@ begin begin Affiche('Erreur 10.31: Discordance de déclaration aiguillage '+intToSTR(adr)+': '+intToSTR(adr2),clred); ok:=false; - end; + end; end; // tjs ou tjs à 4 états @@ -9784,7 +9824,7 @@ begin if (adr<>aiguillage[index2].Adevie) and (adr<>aiguillage[index2].ADroit) and (adr<>aiguillage[index3].ADevie) and (adr<>aiguillage[index3].Adroit) then begin - Affiche('Erreur 10.32: Discordance de déclaration aiguillage '+intToSTR(adr)+': '+intToSTR(adr2),clred); + Affiche('Erreur 10.32: Discordance de déclaration aiguillage '+intToSTR(adr)+': '+intToSTR(adr2),clred); ok:=false; end; end; @@ -9799,17 +9839,17 @@ begin if c='S' then begin extr:=aiguillage[index2].ADevie; - if adr<>extr then Affiche('Erreur 10.34: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); + if adr<>extr then Affiche('Erreur 10.34: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); end; if c='P' then begin extr:=aiguillage[index2].APointe; - if adr<>extr then Affiche('Erreur 10.35: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); + if adr<>extr then Affiche('Erreur 10.35: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); end; - end; - end; + end; + end; end; - + adr2:=aiguillage[indexaig].APointe; // adresse de ce qui est connecté sur la pointe c:=aiguillage[indexaig].ApointeB; if (c='D') or (c='S') or (c='P') then @@ -9827,7 +9867,7 @@ begin Affiche('Erreur 10.41: Discordance de déclaration aiguillage '+intToSTR(adr)+': '+intToSTR(adr2),clred); ok:=false; end; - + // tjs ou tjs à 4 états if (((model2=tjs) or (model2=tjd)) and (aiguillage[index2].EtatTJD=4)) then begin @@ -9840,23 +9880,23 @@ begin ok:=false; end; end; - + if (model2=aig) or (model2=triple) then begin if c='D' then begin extr:=aiguillage[index2].ADroit; - if adr<>extr then Affiche('Erreur 10.43: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'D différent de '+intToSTR(extr),clred); + if adr<>extr then Affiche('Erreur 10.43: Discordance de déclaration aiguillages '+intToSTR(adr)+'P: '+intToSTR(adr2)+'D différent de '+intToSTR(extr),clred); end; if c='S' then begin extr:=aiguillage[index2].ADevie; - if adr<>extr then Affiche('Erreur 10.44: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); + if adr<>extr then Affiche('Erreur 10.44: Discordance de déclaration aiguillages '+intToSTR(adr)+'P: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); end; if c='P' then - begin + begin extr:=aiguillage[index2].APointe; - if adr<>extr then Affiche('Erreur 10.45: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); + if adr<>extr then Affiche('Erreur 10.45: Discordance de déclaration aiguillages '+intToSTR(adr)+'P: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); end; end; end; @@ -12356,6 +12396,7 @@ begin adr:=Signaux[ligneClicSig+1].adresse; if Signaux[ligneClicSig+1].contrevoie then Maj_Etat_Signal(adr,clignote_f or bita1_F) else Maj_Etat_Signal(adr,clignote_F); dessine_signal_mx(Signaux[ligneClicSig+1].Img.Canvas,0,0,1,1,Signaux[ligneClicSig+1].adresse,1); // dessine les feux du signal + for adr:=1 to NbreTCO do affiche_tco(adr); end; end; diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 5b0567c..e9fda08 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1,6 +1,6 @@ object FormPrinc: TFormPrinc - Left = 107 - Top = 224 + Left = 112 + Top = 157 Width = 1149 Height = 689 Anchors = [akLeft, akTop, akRight] @@ -19,8 +19,8 @@ object FormPrinc: TFormPrinc OnCreate = FormCreate OnResize = FormResize DesignSize = ( - 1133 - 630) + 1141 + 638) PixelsPerInch = 96 TextHeight = 13 object LabelTitre: TLabel @@ -1429,8 +1429,8 @@ object FormPrinc: TFormPrinc end object StatusBar1: TStatusBar Left = 0 - Top = 608 - Width = 1133 + Top = 616 + Width = 1141 Height = 22 Panels = < item @@ -1480,11 +1480,11 @@ object FormPrinc: TFormPrinc object GrandPanel: TPanel Left = 8 Top = 48 - Width = 1025 + Width = 1057 Height = 476 TabOrder = 3 DesignSize = ( - 1025 + 1057 476) object SplitterV: TSplitter Left = 1 @@ -1520,7 +1520,7 @@ object FormPrinc: TFormPrinc OnMouseDown = FenRichMouseDown end object ScrollBox1: TScrollBox - Left = 504 + Left = 536 Top = 176 Width = 465 Height = 249 @@ -1534,7 +1534,7 @@ object FormPrinc: TFormPrinc TabOrder = 1 end object GroupBox1: TGroupBox - Left = 465 + Left = 497 Top = 21 Width = 265 Height = 52 @@ -1591,7 +1591,7 @@ object FormPrinc: TFormPrinc end end object GroupBox3: TGroupBox - Left = 457 + Left = 489 Top = 104 Width = 265 Height = 129 @@ -1833,7 +1833,7 @@ object FormPrinc: TFormPrinc end end object Panel1: TPanel - Left = 689 + Left = 761 Top = -3 Width = 288 Height = 180 @@ -1980,7 +1980,7 @@ object FormPrinc: TFormPrinc end end object GroupBox2: TGroupBox - Left = 577 + Left = 609 Top = 104 Width = 265 Height = 129 diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 7dbbbe1..2d935ce 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -492,6 +492,7 @@ Taiguillage = record // si modifié en mode config modifie : boolean ; NumBranche,IndexBranche : integer; // index dans les branches + AdrCDM : integer; // adresse de l'aiguillage dans CDM, si c'est une BDJ (bretelle double jonction) end; TtabloDet = array[1..Mtd] of integer; TSignal = record @@ -864,7 +865,9 @@ function InfoSignal(adresse : integer) : string; procedure det_prec_signal(adresse : integer;var tabloDet : TTabloDet); procedure composant(c : tComponent;fond,texte : tColor); procedure maj_couleurs; - +procedure AffTexteIncliBordeTexture(c : TCanvas; x,y : integer; Fonte : tFont; + clBord : TColor; EpBord : integer; PenMode : TPenMode; + Texture : tBitMap; texte : string; AngleDD : longint); implementation @@ -1081,13 +1084,12 @@ begin end; end; -// dessine les feux sur une cible à 2 feux dans le canvas spécifié +// dessine les 2 feux sur la cible dans le canvas spécifié // x,y : offset en pixels du coin supérieur gauche du feu // Acanvas : canvas de destination -// x,y : point d'origine de destination // frX, frY : facteurs de réduction (pour agrandissement) // EtatSignal : état du signal -// orientation à donner au signal : 1= vertical 2=90° à gauche 3=90° à droite +// orientation à donner au signal : 1= vertical 2=90° à gauche 3=90° à droite 4=180° procedure dessine_signal2(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer); var Temp,rayon,xViolet,YViolet,xBlanc,yBlanc, LgImage,HtImage,code,combine : integer; @@ -1116,8 +1118,8 @@ begin if (orientation=3) then begin - //rotation 90° vers la droite des feux - // calcul des facteurs de réduction pour la rotation + // rotation 90° vers la droite des feux + // inversion des facteurs de réduction pour la rotation ech:=frY;frY:=frX;FrX:=ech; Temp:=LgImage-XBlanc;Xblanc:=Yblanc;Yblanc:=Temp; Temp:=LgImage-Xviolet;Xviolet:=Yviolet;Yviolet:=Temp; @@ -1130,8 +1132,8 @@ begin Xviolet:=LgIMage-Xviolet;Yviolet:=HtImage-Yviolet; end; - XBlanc:=round(xBlanc*Frx)+x; YBlanc:=round(Yblanc*Fry)+Y; - XViolet:=round(XViolet*FrX)+x; YViolet:=round(YViolet*FrY)+Y; + XBlanc:=round(xBlanc*Frx)+x; YBlanc:=round(Yblanc*Fry)+y; + XViolet:=round(XViolet*FrX)+x; YViolet:=round(YViolet*FrY)+y; // extinctions if not((code=blanc_cli) and clignotant) then cercle(ACanvas,xBlanc,yBlanc,rayon,GrisF); @@ -1265,7 +1267,6 @@ begin Xcarre:=LgImage-Xcarre;Ycarre:=HtImage-Ycarre; end; - XJaune:=round(Xjaune*Frx)+x; YJaune:=round(Yjaune*Fry)+Y; Xvert:=round(Xvert*FrX)+x; Yvert:=round(Yvert*FrY)+Y; XSem:=round(XSem*FrX)+x; YSem:=round(YSem*FrY)+Y; @@ -1342,7 +1343,6 @@ begin Xblanc:=LgImage-Xblanc;Yblanc:=HtImage-YBlanc; end; - XJaune:=round(Xjaune*Frx)+x; YJaune:=round(Yjaune*Fry)+Y; Xblanc:=round(XBlanc*FrX)+x; YBlanc:=round(YBlanc*FrY)+Y; Xvert:=round(Xvert*FrX)+x; Yvert:=round(Yvert*FrY)+Y; @@ -1473,7 +1473,6 @@ var rayon, XBlanc,Yblanc,xJaune,yJaune,Xsem,YSem,Xvert,YVert,Xcarre,Ycarre,Xral1,Yral1,Xral2,YRal2, Xrap1,Yrap1,Xrap2,Yrap2,Temp,LgImage,HtImage,xt,yt,code,combine : integer; ech : real; - begin rayon:=round(6*frX); code_to_aspect(Etatsignal,code,combine); // et aspect @@ -1538,7 +1537,6 @@ begin Xrap2:=LgImage-Xrap2; Yrap2:=HtImage-Yrap2; end; - XJaune:=round(Xjaune*Frx)+x; YJaune:=round(Yjaune*Fry)+Y; Xblanc:=round(XBlanc*FrX)+x; YBlanc:=round(YBlanc*FrY)+Y; XRal1:=round(XRal1*FrX)+x; YRal1:=round(YRal1*FrY)+Y; @@ -1590,10 +1588,7 @@ begin end; // Ecrire sur un canvas un texte avec un angle, 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 +// 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. @@ -1601,28 +1596,31 @@ procedure AffTexteIncliBordeTexture(C : TCanvas; X,Y : integer; Fonte : tFont; // 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; +// AngleDD = Angle d'inclinaison en Dixièmes de degré. +procedure AffTexteIncliBordeTexture(c : TCanvas; x,y : integer; Fonte : tFont; + clBord : TColor; EpBord : integer; PenMode : TPenMode; + Texture : tBitMap; texte : string; AngleDD : longint); +var dc : Hdc; + lgFont : Logfont; // structure d'attributs de police AncFonte,NouvFonte : Hfont; - AncPen,NouvPen : Hpen; + 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 + zeroMemory(@lgFont,sizeOf(lgFont)); // remplit la structure de 0 + strPCopy(lgFont.lfFaceName,Fonte.Name); // copie la chaîne dans le nom de la fonte depuis le paramètre + lgFont.lfHeight:=Fonte.Height; // la taille + 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 + lgFont.lfEscapement:=AngleDD; // Angle d'inclinaison en dixièmes de degrés NouvFonte:=CreateFontInDirect(lgFont); AncFonte:=SelectObject(dc,NouvFonte); @@ -1672,7 +1670,7 @@ end; procedure dessine_signal20(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation,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,indexTCO,tailleFonte : integer; + AdrAig,IndexAig,vitesse,indexTCO,tailleFonte,xTexte,yTexte : integer; ech : real; inverse,etatChevron,EtatChiffre,codeClignote : boolean; r : Trect; @@ -1697,9 +1695,12 @@ begin x1:=9;y1:=3; x2:=16;y2:=10; x3:=x2+(x2-x1);y3:=y1; - // texte - XChiffre:=14;Ychiffre:=76; - Xfin:=26;yFin:=99; + // effacement du chiffre + XChiffre:=11;Ychiffre:=77; + Xfin:=27;yFin:=102; + // texte du chiffre + xTexte:=xChiffre+2; + yTexte:=yChiffre+1; index:=index_signal(adresse); if Signaux[index].contrevoie then @@ -1714,6 +1715,7 @@ begin x3:=largeur-x3; Xchiffre:=32; Xfin:=44; + Xtexte:=Xchiffre+1; codeclignote:=true; end; @@ -1739,6 +1741,7 @@ begin Temp:=HtImage-y2;Y2:=X2;X2:=Temp; Temp:=HtImage-y3;Y3:=X3;X3:=Temp; Temp:=HtImage-yChiffre;YChiffre:=XChiffre;XChiffre:=Temp; + Temp:=HtImage-yTexte;YTexte:=XTexte;XTexte:=Temp; Temp:=HtImage-yfin;Yfin:=Xfin;Xfin:=Temp; end; @@ -1758,6 +1761,7 @@ begin Temp:=LgImage-X3;X3:=Y3;Y3:=Temp; Temp:=LgImage-XChiffre;XChiffre:=YChiffre;YChiffre:=Temp; Temp:=LgImage-Xfin;Xfin:=Yfin;Yfin:=Temp; + Temp:=LgImage-XTexte;XTexte:=YTexte;YTexte:=Temp; end; if orientation=4 then @@ -1773,6 +1777,7 @@ begin X3:=LgImage-X3;Y3:=HtImage-Y3; XChiffre:=LgImage-XChiffre;YChiffre:=HtImage-YChiffre; XFin:=LgImage-Xfin;Yfin:=HtImage-yFin; + xTexte:=LgImage-XTexte;YTexte:=HtImage-YTexte; end; XJauneBas:=round(XjauneBas*Frx)+x; YJauneBas:=round(YjauneBas*Fry)+Y; @@ -1781,6 +1786,7 @@ begin 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; + xTexte:=round(XTexte*frx)+x; yTexte:=round(yTexte*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; @@ -1864,7 +1870,7 @@ begin IndexAig:=index_aig(adrAig); vitesse:=aiguillage[IndexAig].vitesse div 10; - if orientation=1 then Textout(XChiffre,Ychiffre,intToSTR(vitesse)) + if orientation=1 then Textout(XTexte,YTexte,intToSTR(vitesse)) else begin case orientation of @@ -1872,7 +1878,7 @@ begin 3 : angle:=900; 4 : angle:=1800; end; - AffTexteIncliBordeTexture(Acanvas,Xchiffre,Ychiffre,Acanvas.Font,clYellow,0,pmcopy,nil,intToSTR(vitesse),angle); + AffTexteIncliBordeTexture(Acanvas,XTexte,YTexte,Acanvas.Font,clYellow,0,pmcopy,nil,intToSTR(vitesse),angle); end; end; end @@ -1881,8 +1887,8 @@ 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; + r.Left:=xchiffre;r.Top:=Ychiffre; + r.Right:=Xfin;r.Bottom:=Yfin; Fillrect(r); end; end; @@ -2120,7 +2126,7 @@ begin if adresse>MaxAcc then result:=0 else //result:=Index_Accessoire[adresse]; result:=Tablo_Index_Signal[adresse]; - // vérifier si l'index correspond à un signal + // vérifier si l'adresse correspond if Signaux[result].adresse<>adresse then result:=0; end; @@ -2142,7 +2148,7 @@ function Index_Aig(adresse : integer) : integer; begin if adresse>MaxAcc then result:=0 else result:=tablo_index_aiguillage[adresse]; - // vérifier si l'index correspond à un aiguillage + // vérifier si l'adresse correspond if Aiguillage[result].adresse<>adresse then result:=0; end; @@ -2197,8 +2203,11 @@ begin i:=pos('@',s); if i<>0 then delete(s,1,i); i:=pos('=',s); if i<>0 then delete(s,i,1); i:=pos(' ',s); - if i<>0 then s:=copy(s,1,i-1); - val(s,AdrPilote,erreur); + if i<>0 then + begin + s:=copy(s,1,i-1); + val(s,AdrPilote,erreur); + end; end; end; @@ -10790,10 +10799,10 @@ end; // pos = const_droit=2 ou const_devie=1 procedure Event_Aig(adresse,pos : integer); var s: string; - faire_event,inv : boolean; - prov,index,i,etatact,typ,adr : integer; + faire_event,inv,bjd : boolean; + AdrCDM,prov,index,i,id,etatact,typ,adr : integer; begin - if nivDebug=1 then AfficheDebug('Event Aig '+intToSTR(adresse),clorange); + if AffAigDet then AfficheDebug('Tick='+IntToSTR(tick)+' Event Aig '+intToSTR(adresse)+'='+intToSTR(pos),clorange); index:=index_aig(adresse); if index<>0 then begin @@ -10843,10 +10852,6 @@ begin begin evalue;evalue;evalue; end; - - // Mettre à jour les TCOs - if TCOActive then - for i:=1 to NbreTCO do Maj_TCO(i,Adresse); end; // evt actionneur d'aiguillage @@ -10872,9 +10877,9 @@ begin s:='T'+intToSTR(adresse)+','+intToSTR(pos); if Tablo_periph[i].ScvVis then Affiche(s,clWhite); if Tablo_periph[i].cr then s:=s+#13; - index:=Tablo_periph[i].NumComposant; - if index=1 then Formprinc.MSCommCde1.Output:=s; - if index=2 then Formprinc.MSCommCde2.Output:=s; + id:=Tablo_periph[i].NumComposant; + if id=1 then Formprinc.MSCommCde1.Output:=s; + if id=2 then Formprinc.MSCommCde2.Output:=s; end; end; end; @@ -10885,9 +10890,9 @@ begin s:='T'+intToSTR(adresse)+','+intToSTR(pos); if Tablo_periph[i].ScvVis then Affiche(s,clWhite); if Tablo_periph[i].cr then s:=s+#13; - index:=Tablo_periph[i].NumComposant; - if index=1 then Formprinc.ClientSocketCde1.Socket.SendText(s); - if index=2 then Formprinc.ClientSocketCde2.Socket.SendText(s); + id:=Tablo_periph[i].NumComposant; + if id=1 then Formprinc.ClientSocketCde1.Socket.SendText(s); + if id=2 then Formprinc.ClientSocketCde2.Socket.SendText(s); end; end; end; @@ -10895,6 +10900,23 @@ begin // Serveur envoi au clients Envoi_serveur('T'+intToSTR(adresse)+','+intToSTR(pos)); + // Si aiguillage de bjd + bjd:=false; + begin + for i:=1 to MaxAiguillage do + begin + if (aiguillage[i].AdrCDM=adresse) then + begin + bjd:=true; + aiguillage[i].position:=pos; // stockage de la nouvelle position de l'aiguillage + end; + end; + if bjd then evalue; + end; + + // Mettre à jour les TCOs + if TCOActive then + for i:=1 to NbreTCO do Maj_TCO(i,Adresse); end; // pilote une sortie à 0 à l'interface dont l'adresse est à 1 ou 2 (octet) @@ -11584,7 +11606,7 @@ begin exit; end; - if chaineINT[1]=#$42 then + if chaineINT[1]=#$42 then // accessory decodeur information response 4 octets begin check(chaineINT,4); delete(chaineInt,1,1); @@ -11594,7 +11616,7 @@ begin exit; end; - if chaineINT[1]=#$81 then + if chaineINT[1]=#$81 then // arrêt urgence 3 octets begin check(chaineINT,3); delete(chaineInt,1,3); @@ -11604,43 +11626,43 @@ begin exit; end; - if chaineINT[1]=#$46 then + if chaineINT[1]=#$46 then // non doc begin //FF FD 46 43 40 41 40 40 49 4D non documentée //FF FD 46 43 50 41 50 40 50 54 non documentée // 46 43 40 41 40 40 48 4C // 46 43 50 41 54 40 50 50 + // supprimer jusque FF ou fin de chaine check(chaineINT,8); + i:=0; + repeat + inc(i); + until (i>length(chaineINT)) or (chaineINT[i]=#$FF); + delete(chaineINT,1,i-1); + Affiche('reprise puissance ',clLime); - delete(chaineInt,1,8); Hors_tension:=false; decode_chaine_retro_Xpress:=chaineINT; exit; end; - i:=pos(#$46+#$43+#$50,chaineInt); - if (i<>0) and (length(chaineInt)>=3) then - begin - check(chaineINT,3); - delete(chaineInt,1,3); - Affiche('Reprise msg 2',clOrange); - Hors_tension:=false; - decode_chaine_retro_Xpress:=chaineINT; - exit; - end; - - if chaineInt[1]=#$81 then + if chaineInt[1]=#$81 then // non documentée begin check(chaineINT,2); - delete(chaineInt,1,2); + i:=0; + repeat + inc(i); + until (i>length(chaineINT)) or (chaineINT[i]=#$FF); + delete(chaineINT,1,i-1); + Affiche('Court circuit msg 1',clRed); Hors_tension:=true; decode_chaine_retro_Xpress:=chaineINT; exit; end; - // E3 40 ah al A0 + // E3 40 ah al xor if chaineInt[1]=#$E3 then begin // la loco ah al est pilotée par le PC @@ -11650,6 +11672,7 @@ begin exit; end; + // E4 id speed FcA FcB xor loco information if chaineInt[1]=#$E4 then begin check(chaineINT,6); @@ -11665,7 +11688,13 @@ begin ack:=false; nack:=true; affiche('Erreur 7, chaîne rétrosig. inconnue recue:'+chaine_HEX(chaineINT),clred); - decode_chaine_retro_Xpress:=''; + i:=0; + repeat + inc(i); + until (i>length(chaineINT)) or (chaineINT[i]=#$FF); + delete(chaineINT,1,i-1); + + decode_chaine_retro_Xpress:=chaineINT; end; // procédure appellée après réception sur le port USB ou socket @@ -15501,12 +15530,14 @@ procedure TFormPrinc.Apropos1Click(Sender: TObject); var i,t,t1 : integer; begin Affiche(' ',clyellow); - Affiche('Signaux complexes GL version '+version+sousVersion+' (C) 2022-23 F1IWQ Gily TDR',clWhite); + Affiche('Signaux complexes GL version '+version+sousVersion+' (C) 2022-24 F1IWQ Gily TDR',clWhite); + Affiche('Double cliquez sur un des liens ci-dessous',clWhite); FenRich.SelStart:=length(FenRich.Text); FenRich.SelAttributes.Style:=[fsUnderline]; FenRich.lines.add('https://github.com/f1iwq2/Signaux_complexes_GL'); RE_ColorLine(FenRich,FenRich.lines.count-1,clAqua); + FenRich.SelStart:=length(FenRich.Text); FenRich.SelAttributes.Style:=[fsUnderline]; FenRich.Lines.add('https://github.com/f1iwq2/Signaux_complexes_GL/releases'); @@ -15518,7 +15549,7 @@ begin RE_ColorLine(FenRich,FenRich.lines.count-1,clAqua); Affiche('Ce programme pilote des signaux complexes et les trains de façon autonome ou avec CDM rail ',ClYellow); - Affiche('En fonction des détecteurs mis à 1 ou 0 par des locomotives',ClYellow); + Affiche('en fonction des détecteurs mis à 1 ou 0 par des locomotives',ClYellow); Affiche('en circulation sur le réseau',ClYellow); Affiche('En vert : Trames envoyées à l''interface',ClWhite); Affiche('En blanc : Trames brutes reçues de l''interface',ClWhite); @@ -15705,8 +15736,7 @@ begin end; // cliqué gauche dans la fenetre Fenrich -procedure TFormPrinc.FenRichMouseDown(Sender: TObject; - Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +procedure TFormPrinc.FenRichMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var lc,i : integer; s : string; begin @@ -15728,7 +15758,7 @@ begin lc:=Perform(EM_LINEFROMCHAR,i,0); s:=lines[lc]; end; - if pos('http',s)<>0 then ShellExecute(0,'open',Pchar(s),nil,nil,sw_shownormal); + if pos('http',s)=1 then ShellExecute(0,'open',Pchar(s),nil,nil,sw_shownormal); end; end; @@ -15958,11 +15988,11 @@ begin end; procedure TFormPrinc.Button1Click(Sender: TObject); +var s : string; begin -// placement_trains; - //ouvre_simulation('C:\Program Files (x86)\Borland\Delphi7\Projects\Signaux_complexes_GL\2trains_autonome.txt'); - //ouvre_simulation('C:\Program Files\Borland\Delphi7\Projects\Signaux_complexes_GL\2trains_autonome.txt'); -// ouvre_simulation('C:\temp\Signaux_complexes_GL\2trains_autonome.txt'); + s:=#$46+#$43+#$40+#$41+#$40+#$40+#$49+#$4D+#$FF; + decode_chaine_retro_Xpress(s); + end; procedure affiche_com(s : string;var n : integer); diff --git a/UnitTCO.dfm b/UnitTCO.dfm index 717c0d7..05b8665 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -1,6 +1,6 @@ object FormTCO: TFormTCO - Left = 104 - Top = 226 + Left = 83 + Top = 123 Width = 1212 Height = 661 VertScrollBar.Visible = False @@ -16,6 +16,7 @@ object FormTCO: TFormTCO Menu = MainMenuTCO OldCreateOrder = False Position = poScreenCenter + SnapBuffer = 0 OnActivate = FormActivate OnCreate = FormCreate OnDragOver = FormDragOver @@ -23,8 +24,8 @@ object FormTCO: TFormTCO OnKeyPress = FormKeyPress OnMouseWheel = FormMouseWheel DesignSize = ( - 1204 - 610) + 1196 + 602) PixelsPerInch = 96 TextHeight = 13 object LabelZoom: TLabel @@ -59,7 +60,7 @@ object FormTCO: TFormTCO Left = 10 Top = 15 Width = 687 - Height = 347 + Height = 410 HorzScrollBar.Smooth = True HorzScrollBar.Tracking = True VertScrollBar.Smooth = True @@ -71,12 +72,12 @@ object FormTCO: TFormTCO TabOrder = 1 DesignSize = ( 683 - 343) + 406) object ImageTCO: TImage Left = 120 Top = 41 Width = 486 - Height = 257 + Height = 320 Anchors = [akLeft, akTop, akRight, akBottom] AutoSize = True ParentShowHint = False @@ -106,11 +107,11 @@ object FormTCO: TFormTCO TickMarks = tmTopLeft OnChange = TrackBarZoomChange end - object Panel1: TPanel + object PanelBas: TPanel Left = 2 - Top = 413 + Top = 461 Width = 1143 - Height = 185 + Height = 140 Anchors = [akLeft, akRight, akBottom] Color = clActiveBorder Font.Charset = ANSI_CHARSET @@ -120,12 +121,12 @@ object FormTCO: TFormTCO Font.Style = [] ParentFont = False TabOrder = 2 - OnDragOver = Panel1DragOver + OnDragOver = PanelBasDragOver DesignSize = ( 1143 - 185) + 140) object Label1: TLabel - Left = 216 + Left = 240 Top = 22 Width = 9 Height = 19 @@ -138,7 +139,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label2: TLabel - Left = 272 + Left = 296 Top = 22 Width = 9 Height = 19 @@ -151,7 +152,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label5: TLabel - Left = 440 + Left = 456 Top = 22 Width = 9 Height = 19 @@ -164,7 +165,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label6: TLabel - Left = 216 + Left = 240 Top = 70 Width = 9 Height = 19 @@ -177,7 +178,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label7: TLabel - Left = 272 + Left = 296 Top = 70 Width = 9 Height = 19 @@ -190,7 +191,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label8: TLabel - Left = 328 + Left = 352 Top = 70 Width = 9 Height = 19 @@ -203,7 +204,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label9: TLabel - Left = 384 + Left = 408 Top = 62 Width = 9 Height = 19 @@ -216,7 +217,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label3: TLabel - Left = 328 + Left = 344 Top = 22 Width = 9 Height = 19 @@ -229,7 +230,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label4: TLabel - Left = 384 + Left = 400 Top = 22 Width = 9 Height = 19 @@ -242,7 +243,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label10: TLabel - Left = 208 + Left = 232 Top = 118 Width = 18 Height = 19 @@ -255,7 +256,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label11: TLabel - Left = 272 + Left = 296 Top = 118 Width = 17 Height = 19 @@ -268,7 +269,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label50: TLabel - Left = 680 + Left = 704 Top = 110 Width = 18 Height = 19 @@ -281,7 +282,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label12: TLabel - Left = 488 + Left = 504 Top = 22 Width = 18 Height = 19 @@ -294,7 +295,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label13: TLabel - Left = 552 + Left = 568 Top = 22 Width = 18 Height = 19 @@ -307,7 +308,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label14: TLabel - Left = 608 + Left = 624 Top = 14 Width = 18 Height = 19 @@ -320,7 +321,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label15: TLabel - Left = 664 + Left = 680 Top = 14 Width = 18 Height = 19 @@ -333,7 +334,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label16: TLabel - Left = 432 + Left = 456 Top = 62 Width = 18 Height = 19 @@ -346,7 +347,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label17: TLabel - Left = 488 + Left = 512 Top = 62 Width = 18 Height = 19 @@ -359,7 +360,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label18: TLabel - Left = 544 + Left = 568 Top = 62 Width = 18 Height = 19 @@ -372,7 +373,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label19: TLabel - Left = 608 + Left = 632 Top = 62 Width = 18 Height = 19 @@ -385,7 +386,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label20: TLabel - Left = 664 + Left = 688 Top = 62 Width = 18 Height = 19 @@ -398,7 +399,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label21: TLabel - Left = 728 + Left = 744 Top = 14 Width = 18 Height = 19 @@ -411,7 +412,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label22: TLabel - Left = 784 + Left = 800 Top = 14 Width = 18 Height = 19 @@ -424,7 +425,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label51: TLabel - Left = 720 + Left = 744 Top = 110 Width = 18 Height = 19 @@ -437,7 +438,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label24: TLabel - Left = 728 + Left = 752 Top = 62 Width = 18 Height = 19 @@ -450,7 +451,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label25: TLabel - Left = 792 + Left = 816 Top = 62 Width = 18 Height = 19 @@ -463,7 +464,7 @@ object FormTCO: TFormTCO ParentFont = False end object ImagePalette1: TImage - Left = 232 + Left = 256 Top = 8 Width = 33 Height = 33 @@ -472,7 +473,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette1MouseDown end object ImagePalette2: TImage - Left = 288 + Left = 312 Top = 8 Width = 33 Height = 33 @@ -481,7 +482,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette2MouseDown end object ImagePalette3: TImage - Left = 344 + Left = 360 Top = 8 Width = 33 Height = 33 @@ -490,7 +491,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette3MouseDown end object ImagePalette4: TImage - Left = 400 + Left = 416 Top = 8 Width = 33 Height = 33 @@ -499,7 +500,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette4MouseDown end object ImagePalette5: TImage - Left = 448 + Left = 464 Top = 8 Width = 33 Height = 33 @@ -508,7 +509,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette5MouseDown end object ImagePalette12: TImage - Left = 512 + Left = 528 Top = 8 Width = 33 Height = 33 @@ -517,7 +518,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette12MouseDown end object ImagePalette13: TImage - Left = 576 + Left = 592 Top = 8 Width = 33 Height = 33 @@ -526,7 +527,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette13MouseDown end object ImagePalette14: TImage - Left = 624 + Left = 640 Top = 8 Width = 33 Height = 33 @@ -535,7 +536,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette14MouseDown end object ImagePalette15: TImage - Left = 688 + Left = 704 Top = 8 Width = 33 Height = 33 @@ -544,7 +545,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette15MouseDown end object ImagePalette21: TImage - Left = 752 + Left = 768 Top = 8 Width = 33 Height = 33 @@ -553,7 +554,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette21MouseDown end object ImagePalette22: TImage - Left = 808 + Left = 824 Top = 8 Width = 33 Height = 33 @@ -562,7 +563,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette22MouseDown end object ImagePalette6: TImage - Left = 232 + Left = 256 Top = 56 Width = 33 Height = 33 @@ -571,7 +572,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette6MouseDown end object ImagePalette7: TImage - Left = 288 + Left = 312 Top = 56 Width = 33 Height = 33 @@ -580,7 +581,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette7MouseDown end object ImagePalette9: TImage - Left = 400 + Left = 424 Top = 56 Width = 33 Height = 33 @@ -589,7 +590,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette9MouseDown end object ImagePalette16: TImage - Left = 448 + Left = 472 Top = 56 Width = 33 Height = 33 @@ -598,7 +599,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette16MouseDown end object ImagePalette17: TImage - Left = 504 + Left = 528 Top = 56 Width = 33 Height = 33 @@ -607,7 +608,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette17MouseDown end object ImagePalette18: TImage - Left = 576 + Left = 600 Top = 56 Width = 33 Height = 33 @@ -616,7 +617,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette18MouseDown end object ImagePalette19: TImage - Left = 624 + Left = 648 Top = 56 Width = 33 Height = 33 @@ -625,7 +626,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette19MouseDown end object ImagePalette20: TImage - Left = 688 + Left = 712 Top = 56 Width = 33 Height = 33 @@ -634,7 +635,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette20MouseDown end object ImagePalette24: TImage - Left = 752 + Left = 776 Top = 56 Width = 33 Height = 33 @@ -643,7 +644,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette24MouseDown end object ImagePalette25: TImage - Left = 808 + Left = 832 Top = 56 Width = 33 Height = 33 @@ -652,7 +653,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette25MouseDown end object ImagePalette10: TImage - Left = 232 + Left = 256 Top = 104 Width = 33 Height = 33 @@ -661,7 +662,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette10MouseDown end object ImagePalette11: TImage - Left = 288 + Left = 312 Top = 104 Width = 33 Height = 33 @@ -670,7 +671,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette11MouseDown end object ImagePalette51: TImage - Left = 736 + Left = 760 Top = 104 Width = 33 Height = 33 @@ -682,7 +683,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette51MouseDown end object ImagePalette50: TImage - Left = 696 + Left = 720 Top = 104 Width = 25 Height = 41 @@ -695,7 +696,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette50MouseDown end object ImagePalette8: TImage - Left = 344 + Left = 368 Top = 56 Width = 33 Height = 33 @@ -704,7 +705,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette8MouseDown end object ImagePalette26: TImage - Left = 344 + Left = 368 Top = 104 Width = 33 Height = 33 @@ -713,7 +714,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette26MouseDown end object Label26: TLabel - Left = 320 + Left = 344 Top = 118 Width = 18 Height = 19 @@ -726,7 +727,7 @@ object FormTCO: TFormTCO ParentFont = False end object ImagePalette23: TImage - Left = 496 + Left = 520 Top = 104 Width = 33 Height = 33 @@ -735,7 +736,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette23MouseDown end object Label23: TLabel - Left = 480 + Left = 504 Top = 110 Width = 18 Height = 19 @@ -748,7 +749,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label27: TLabel - Left = 376 + Left = 400 Top = 118 Width = 18 Height = 19 @@ -761,7 +762,7 @@ object FormTCO: TFormTCO ParentFont = False end object ImagePalette27: TImage - Left = 400 + Left = 424 Top = 104 Width = 33 Height = 33 @@ -770,7 +771,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette27MouseDown end object ImagePalette28: TImage - Left = 448 + Left = 472 Top = 104 Width = 33 Height = 33 @@ -779,7 +780,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette28MouseDown end object Label28: TLabel - Left = 432 + Left = 456 Top = 110 Width = 18 Height = 19 @@ -792,7 +793,7 @@ object FormTCO: TFormTCO ParentFont = False end object Label29: TLabel - Left = 536 + Left = 560 Top = 110 Width = 18 Height = 19 @@ -805,7 +806,7 @@ object FormTCO: TFormTCO ParentFont = False end object ImagePalette29: TImage - Left = 552 + Left = 576 Top = 104 Width = 33 Height = 33 @@ -814,7 +815,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette29MouseDown end object Label32: TLabel - Left = 584 + Left = 608 Top = 110 Width = 18 Height = 19 @@ -827,7 +828,7 @@ object FormTCO: TFormTCO ParentFont = False end object ImagePalette32: TImage - Left = 600 + Left = 624 Top = 104 Width = 33 Height = 33 @@ -836,7 +837,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette32MouseDown end object Label33: TLabel - Left = 632 + Left = 656 Top = 110 Width = 18 Height = 19 @@ -849,7 +850,7 @@ object FormTCO: TFormTCO ParentFont = False end object ImagePalette33: TImage - Left = 648 + Left = 672 Top = 104 Width = 33 Height = 33 @@ -858,8 +859,8 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette33MouseDown end object Label34: TLabel - Left = 208 - Top = 150 + Left = 872 + Top = 110 Width = 18 Height = 19 Caption = '34' @@ -871,8 +872,8 @@ object FormTCO: TFormTCO ParentFont = False end object ImagePalette34: TImage - Left = 232 - Top = 144 + Left = 896 + Top = 104 Width = 33 Height = 33 OnDragOver = ImagePalette34DragOver @@ -880,7 +881,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette34MouseDown end object ImagePalette52: TImage - Left = 808 + Left = 832 Top = 104 Width = 33 Height = 33 @@ -892,7 +893,7 @@ object FormTCO: TFormTCO OnMouseDown = ImagePalette52MouseDown end object Label52: TLabel - Left = 776 + Left = 800 Top = 110 Width = 18 Height = 19 @@ -906,88 +907,66 @@ object FormTCO: TFormTCO end object ButtonSauveTCO: TButton Left = 1037 - Top = 64 + Top = 8 Width = 96 Height = 33 - Anchors = [akTop, akRight] + Anchors = [akTop] Caption = 'Sauvegarder TCO' TabOrder = 0 TabStop = False WordWrap = True OnClick = ButtonSauveTCOClick end - object Button1: TButton - Left = 478 - Top = 152 - Width = 57 - Height = 25 - Anchors = [akTop, akRight] - Caption = 'Simu det 1' - TabOrder = 1 - TabStop = False - OnClick = Button1Click - end - object Button2: TButton - Left = 414 - Top = 152 - Width = 57 - Height = 25 - Anchors = [akTop, akRight] - Caption = 'Simu Det 0' - TabOrder = 2 - TabStop = False - OnClick = Button2Click - end object ButtonConfigTCO: TButton Left = 1037 - Top = 104 + Top = 48 Width = 96 Height = 33 - Anchors = [akTop, akRight] + Anchors = [akTop] Caption = 'Configuration TCO' - TabOrder = 3 + TabOrder = 1 TabStop = False OnClick = ButtonConfigTCOClick end object ButtonSimu: TButton - Left = 566 - Top = 152 + Left = 822 + Top = 80 Width = 113 Height = 25 Anchors = [akTop, akRight] Caption = 'Simu canton occup'#233 - TabOrder = 4 + TabOrder = 2 TabStop = False OnClick = ButtonSimuClick end object ButtonMasquer: TButton Left = 1037 - Top = 144 + Top = 88 Width = 96 Height = 33 - Anchors = [akTop, akRight] + Anchors = [akTop] Caption = 'Masquer bandeau' - TabOrder = 5 + TabOrder = 3 TabStop = False WordWrap = True OnClick = ButtonMasquerClick end object GroupBox1: TGroupBox - Left = 16 - Top = 8 - Width = 185 - Height = 169 + Left = 8 + Top = 3 + Width = 225 + Height = 125 Caption = 'Configuration cellule' Font.Charset = ANSI_CHARSET Font.Color = clBackground - Font.Height = -15 + Font.Height = -13 Font.Name = 'Arial Narrow' Font.Style = [] ParentFont = False - TabOrder = 6 + TabOrder = 4 object Label41: TLabel - Left = 8 - Top = 24 + Left = 64 + Top = 20 Width = 103 Height = 16 Caption = 'Adresse de l'#39#233'l'#233'ment: ' @@ -999,8 +978,8 @@ object FormTCO: TFormTCO ParentFont = False end object Label71: TLabel - Left = 8 - Top = 46 + Left = 72 + Top = 36 Width = 93 Height = 16 Caption = 'Image de l'#39#233'l'#233'ment: ' @@ -1012,8 +991,8 @@ object FormTCO: TFormTCO ParentFont = False end object Label230: TLabel - Left = 56 - Top = 72 + Left = 88 + Top = 56 Width = 27 Height = 16 Caption = 'Texte' @@ -1025,8 +1004,8 @@ object FormTCO: TFormTCO ParentFont = False end object Label65: TLabel - Left = 8 - Top = 96 + Left = 40 + Top = 74 Width = 75 Height = 16 Caption = 'position du texte' @@ -1038,13 +1017,13 @@ object FormTCO: TFormTCO ParentFont = False end object ShapeCoulFond: TShape - Left = 160 - Top = 146 + Left = 200 + Top = 98 Width = 18 Height = 18 end object EditAdrElement: TEdit - Left = 144 + Left = 176 Top = 20 Width = 33 Height = 21 @@ -1059,8 +1038,8 @@ object FormTCO: TFormTCO OnClick = EditAdrElementClick end object EditTypeImage: TEdit - Left = 144 - Top = 44 + Left = 176 + Top = 36 Width = 33 Height = 21 Font.Charset = ANSI_CHARSET @@ -1074,8 +1053,8 @@ object FormTCO: TFormTCO OnChange = EditTypeImageChange end object ButtonFonte: TButton - Left = 8 - Top = 72 + Left = 32 + Top = 58 Width = 41 Height = 17 Caption = 'Fonte' @@ -1083,8 +1062,8 @@ object FormTCO: TFormTCO OnClick = ButtonFonteClick end object EditTexte: TEdit - Left = 88 - Top = 70 + Left = 120 + Top = 54 Width = 89 Height = 21 Font.Charset = ANSI_CHARSET @@ -1097,8 +1076,8 @@ object FormTCO: TFormTCO OnChange = EditTexteChange end object ComboRepr: TComboBox - Left = 88 - Top = 96 + Left = 120 + Top = 72 Width = 89 Height = 21 Style = csDropDownList @@ -1122,7 +1101,7 @@ object FormTCO: TFormTCO end object CheckPinv: TCheckBox Left = 8 - Top = 126 + Top = 98 Width = 113 Height = 17 Hint = 'Cocher si l'#39'aiguillage est repr'#233'sent'#233' invers'#233 @@ -1139,8 +1118,8 @@ object FormTCO: TFormTCO OnClick = CheckPinvClick end object ButtonCoulFond: TButton - Left = 80 - Top = 146 + Left = 120 + Top = 98 Width = 81 Height = 18 Caption = 'Couleur de fond' @@ -1156,30 +1135,30 @@ object FormTCO: TFormTCO end object buttonRaz: TButton Left = 931 - Top = 144 + Top = 88 Width = 97 Height = 33 Anchors = [akTop, akRight] Caption = 'Raz des occupations' - TabOrder = 7 + TabOrder = 5 TabStop = False WordWrap = True OnClick = buttonRazClick end object ButtonCalibrage: TButton - Left = 686 - Top = 152 + Left = 862 + Top = 56 Width = 75 Height = 25 Anchors = [akTop, akRight] Caption = 'Calibrage' - TabOrder = 8 + TabOrder = 6 TabStop = False OnClick = ButtonCalibrageClick end object ButtonDessiner: TButton Left = 931 - Top = 104 + Top = 48 Width = 97 Height = 33 Hint = @@ -1189,26 +1168,26 @@ object FormTCO: TFormTCO Caption = 'Dessiner le TCO' ParentShowHint = False ShowHint = True - TabOrder = 9 + TabOrder = 7 TabStop = False OnClick = ButtonDessinerClick end object ButtonAffSC: TButton Left = 931 - Top = 64 + Top = 8 Width = 97 Height = 33 Anchors = [akTop, akRight] Caption = 'Afficher Signaux Complexes' - TabOrder = 10 + TabOrder = 8 TabStop = False WordWrap = True OnClick = ButtonAffSCClick end object RadioGroupSel: TRadioGroup - Left = 959 + Left = 783 Top = 8 - Width = 169 + Width = 138 Height = 49 Anchors = [akTop, akRight] Caption = 'Outil de s'#233'lection' @@ -1221,7 +1200,7 @@ object FormTCO: TFormTCO 'Cellules s'#233'lectionn'#233'es' 'fen'#234'tre d'#233'pla'#231'able') ParentFont = False - TabOrder = 11 + TabOrder = 9 OnClick = RadioGroupSelClick end end @@ -1376,9 +1355,9 @@ object FormTCO: TFormTCO Caption = 'Rafra'#238'chir le TCO' OnClick = Redessine1Click end - object Affichebandeau1: TMenuItem - Caption = 'Affiche bandeau' - OnClick = Affichebandeau1Click + object Bandeau: TMenuItem + Caption = 'Masquer bandeau' + OnClick = BandeauClick end object Affichage1: TMenuItem Caption = 'Affichage' diff --git a/UnitTCO.pas b/UnitTCO.pas index deced51..304013c 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -20,7 +20,7 @@ type Tourner90D: TMenuItem; Pos_vert: TMenuItem; TrackBarZoom: TTrackBar; - Panel1: TPanel; + PanelBas: TPanel; Label1: TLabel; Label2: TLabel; Label5: TLabel; @@ -34,8 +34,6 @@ type Label11: TLabel; Label50: TLabel; ButtonSauveTCO: TButton; - Button1: TButton; - Button2: TButton; LabelZoom: TLabel; ButtonConfigTCO: TButton; Annulercouper: TMenuItem; @@ -145,7 +143,7 @@ type N8: TMenuItem; DessinerleTCO1: TMenuItem; ConfigurationduTCO1: TMenuItem; - Affichebandeau1: TMenuItem; + Bandeau: TMenuItem; Affichage1: TMenuItem; Mosaquehorizontale1: TMenuItem; Mosaqueverticale1: TMenuItem; @@ -308,7 +306,7 @@ type Y: Integer; State: TDragState; var Accept: Boolean); procedure ImagePalette50DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); - procedure Panel1DragOver(Sender, Source: TObject; X, Y: Integer; + procedure PanelBasDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); procedure ImagePalette51DragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); @@ -417,7 +415,7 @@ type procedure DessinerleTCO1Click(Sender: TObject); procedure ConfigurationduTCO1Click(Sender: TObject); procedure Redessine1Click(Sender: TObject); - procedure Affichebandeau1Click(Sender: TObject); + procedure BandeauClick(Sender: TObject); procedure Mosaquehorizontale1Click(Sender: TObject); procedure Mosaqueverticale1Click(Sender: TObject); procedure AfficherSignauxComplexes1Click(Sender: TObject); @@ -432,8 +430,9 @@ type const MaxCellX=150;MaxCellY=70; - licone=35; - hicone=35; + licone=26; // largeur icone du bas 35 + hicone=licone; + Xicones=40; //début de la zone icones maxUndo=30; ZoomMax=(8191 div MaxCellX)-1; // pour ne pas dépasser un canvas de 8191 pixel maxi ZoomMin=15; @@ -554,7 +553,7 @@ var end; rAncien : TRect; - VBm,OldBmp : TBitMap; + OldBmp : TBitMap; PScrollBoxTCO : TScrollBox; // liste des variables par tco @@ -1599,7 +1598,7 @@ begin hauteurCell[indexTCO]:=(LargeurCell[indexTCO] * RatioC) div 10; largeurCelld2[indexTCO]:=largeurCell[indexTCO] div 2; HauteurCelld2[indexTCO]:=HauteurCell[indexTCO] div 2; - Epaisseur:=LargeurCell[indexTCO]*epaisseur_voies div 30; // épaisseur du trait pour PEN + //Affiche(intToSTR(LargeurCell[indexTCO])+' '+intToSTR(epaisseur),clyellow); end; @@ -1750,6 +1749,7 @@ begin Adr:=tco[indextco,x,y].adresse; if adr<>0 then begin + pen.Width:=1; if detecteur[Adr].etat then begin brush.Color:=clAllume[indexTCO]; @@ -1760,8 +1760,8 @@ begin pen.color:=tco[indextco,x,y].CouleurFond; brush.color:=tco[indextco,x,y].CouleurFond; end; - jy1:=y0+(HauteurCell[indexTCO] div 2)-round(6*fryGlob[indexTCO]); // pos Y de la bande sup - jy2:=y0+(HauteurCell[indexTCO] div 2)+round(6*fryGlob[indexTCO]); // pos Y de la bande inf + jy1:=y0+(HauteurCell[indexTCO] div 2)-round(7*fryGlob[indexTCO]); // pos Y de la bande sup + jy2:=y0+(HauteurCell[indexTCO] div 2)+round(7*fryGlob[indexTCO]); // pos Y de la bande inf if avecGrille[indexTCO] then r:=Rect(x0+1,jy1,xf-1,jy2) else r:=Rect(x0,jy1,x0+LargeurCell[indexTCO],jy2) ; FillRect(r); @@ -1773,8 +1773,7 @@ begin 2 : couleur:=couleurTrain[TCO[IndexTCO,x,y].train]; end; pen.color:=couleur; - if testbit(ep,7) or testbit(ep,3) then pen.Width:=epaisseur div 2 else - pen.Width:=epaisseur; + if testbit(ep,7) or testbit(ep,3) then pen.Width:=epaisseur div 2 else pen.Width:=epaisseur; moveTo(x0,yc);LineTo(xf,yc); end; end; @@ -3341,7 +3340,6 @@ begin pen.color:=tco[indextco,x,y].CouleurFond; brush.color:=tco[indextco,x,y].CouleurFond; end; - // if avecGrille then r:=Rect(x0+1,jy1,x0+LargeurCell[indexTCO]-1,jy2) else pen.Width:=epaisseur+3; MoveTo(x0,y0);LineTo(x0+LargeurCell[indexTCO],y0+hauteurCell[indexTCO]); end; @@ -4667,8 +4665,8 @@ begin Brush.Color:=couleur; pen.color:=couleur; end; - jx1:=x0+(LargeurCell[indexTCO] div 2)-round(6*frxGlob[indexTCO]); // pos Y de la bande sup - jx2:=x0+(LargeurCell[indexTCO] div 2)+round(6*frxGlob[indexTCO]); // pos Y de la bande inf + jx1:=x0+(LargeurCell[indexTCO] div 2)-round(7*frxGlob[indexTCO]); // pos Y de la bande sup + jx2:=x0+(LargeurCell[indexTCO] div 2)+round(7*frxGlob[indexTCO]); // pos Y de la bande inf if avecGrille[indexTCO] then r:=Rect(jx1,y0+1,jx2,y0+hauteurCell[indexTCO]-1) else r:=Rect(jx1,y0,jx2,y0+hauteurCell[indexTCO]) ; FillRect(r); @@ -8394,6 +8392,7 @@ begin BImage:=tco[indextco,x,y].BImage; mode:=tco[indextco,x,y].mode; // mode pour la couleur repr:=tco[indextco,x,y].repr; + Epaisseur:=LargeurCell[indexTCO]*epaisseur_voies div 30; Xorg:=(x-1)*LargeurCell[indexTCO]; Yorg:=(y-1)*hauteurCell[indexTCO]; @@ -8498,7 +8497,7 @@ begin end; // autres détecteurs - if ((Bimage=7) or (Bimage=8) or (Bimage=9) or (Bimage=10) or (Bimage=17) or (Bimage=20)) and (adresse<>0) then + if ((Bimage=7) or (Bimage=8) or (Bimage=9) or (Bimage=10) or (Bimage=17) ) and (adresse<>0) then begin // Adresse de l'élément with PCanvasTCO[indexTCO] do begin @@ -8510,6 +8509,22 @@ begin end; end; + // écriture adresse à 90° + if (Bimage=20) and (adresse<>0) then + begin + with PCanvasTCO[indexTCO] do + begin + Brush.Color:=tco[indextco,x,y].CouleurFond; + Font.Name:='Arial'; + Font.Style:=style(tco[indextco,x,y].FontStyle); + Font.Color:=tco[indextco,x,y].coulFonte; + PCanvasTCO[indexTCO].font.Size:=PCanvasTCO[indexTCO].font.Size+1; + //TextOut(xOrg+round(2*frxGlob[indexTCO]),yOrg+round(2*fryGlob[indexTCO]),s); + AffTexteIncliBordeTexture(PCanvasTCO[indexTCO],Xorg,yOrg+round(30*fryGlob[indexTCO]), + PCanvasTCO[indexTCO].Font,clYellow,0,pmcopy,nil,s,910); + end; + end; + // autres détecteurs if (Bimage=18) and (adresse<>0) then begin // Adresse de l'élément @@ -8563,13 +8578,13 @@ begin end; if (Oriente=3) then begin - if inverse then begin xt:=LargeurCell[indexTCO]+round(10*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(16*fryGlob[indexTCO]);end - else begin xt:=LargeurCell[indexTCO]+round(10*frxGlob[indexTCO]);yt:=round(1*fryGlob[indexTCO]);end; + if inverse then begin xt:=round(10*frxGlob[indexTCO]);yt:=round(50*frxGlob[indexTCO]);end + else begin xt:=round(60*frxGlob[indexTCO]);yt:=round(1*frxGlob[indexTCO])end; end; if (oriente=4) then begin - if inverse then begin xt:=LargeurCell[indexTCO]+round(10*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO]-round(16*fryGlob[indexTCO]);end - else begin xt:=round(2*frxGlob[indexTCO]);yt:=round(1*fryGlob[indexTCO]);end; + if inverse then begin xt:=round(40*frxGlob[indexTCO]);yt:=round(40*fryGlob[indexTCO]);end + else begin xt:=round(2*frxGlob[indexTCO]);yt:=round(10*fryGlob[indexTCO]);end; end; end; if (aspect=9) and (Oriente=1) then begin xt:=LargeurCell[indexTCO]-round(25*frxGlob[indexTCO]);yt:=round(60*fryGlob[indexTCO]);end; @@ -8590,7 +8605,6 @@ begin if (aspect=5) and (Oriente=4) and (pied=1) then begin xt:=round(35*frxGlob[indexTCO]);yt:=round(1*frYGlob[indexTCO]);end; if (aspect=5) and (Oriente=4) and (pied=2) then begin xt:=round(3*frxGlob[indexTCO]);yt:=round(1*frYGlob[indexTCO]);end; - if (aspect=4) and (Oriente=1) then begin xt:=1;yt:=hauteurCell[indexTCO]+round(20*fryGlob[indexTCO]);end; if (aspect=4) and (Oriente=2) then begin xt:=round(10*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO];end; if (aspect=4) and (Oriente=3) then begin xt:=round(10*frxGlob[indexTCO]);yt:=-round(14*fryGlob[indexTCO]);end; @@ -8605,12 +8619,11 @@ begin if (aspect=3) and (Oriente=4) and (pied=1) then begin xt:=round(35*frxGlob[indexTCO]);yt:=round(1*frYGlob[indexTCO]);end; if (aspect=3) and (Oriente=4) and (pied=2) then begin xt:=round(3*frxGlob[indexTCO]);yt:=round(1*frYGlob[indexTCO]);end; - if (aspect=2) and (Oriente=1) and (pied=2) then begin xt:=round(-15*frxGlob[indexTCO]);yt:=1;end; // signal à droite if (aspect=2) and (Oriente=1) and (pied=1) then begin xt:=round(45*frxGlob[indexTCO]);yt:=1;end; // signal à gauche if (aspect=2) and (Oriente=2) then begin xt:=round(10*frxGlob[indexTCO]);yt:=hauteurCell[indexTCO];end; // orientation G if (aspect=2) and (Oriente=3) then begin xt:=round(20*frxGlob[indexTCO]);yt:=round(40*fryGlob[indexTCO]);end; // orientation D - if (aspect=2) and (Oriente=4) then begin xt:=round(35*frxGlob[indexTCO]);yt:=round(2*fryglob[indexTCO]);end; // orientation 180 + if (aspect=2) and (Oriente=4) then begin xt:=round(40*frxGlob[indexTCO]);yt:=round(10*fryglob[indexTCO]);end; // orientation 180 // signaux directionnels if (aspect>10) and (aspect<20) and(oriente=1) then begin xt:=1;yt:=hauteurCell[indexTCO]-round(14*fryGlob[indexTCO]);end; @@ -8691,6 +8704,7 @@ begin if pImageTCO[indexTCO]=nil then exit; DimX:=LargeurCell[indexTCO]*NbreCellX[indexTCO]; DimY:=hauteurCell[indexTCO]*NbreCellY[indexTCO]; + Epaisseur:=LargeurCell[indexTCO]*epaisseur_voies div 30; // DimX DimY maxi 8191 pixels pour les bitmap if (dimX>8192) then begin Affiche('Espace TCO X trop grand',clred); exit; end; if (dimY>8192) then begin Affiche('Espace TCO Y trop grand',clred); exit; end; @@ -8833,9 +8847,6 @@ begin Top:=0; Left:=0; end; - VBm:=TbitMap.Create; // masque - Vbm.Width:=100; - Vbm.Height:=100; oldbmp:=Tbitmap.Create; oldbmp.width:=100; oldbmp.Height:=100; @@ -10488,6 +10499,7 @@ begin end; +// positionne l'icone du groupe G2 (signal, quai, action) procedure positionne_icone_G2(IndexTCO : integer;ip : timage;lbl : tlabel;i : integer); const NbElLi=12; var s : string; @@ -10502,7 +10514,7 @@ begin begin width:=licone; height:=hicone; - left:=((i-1) mod NbElLi)*(licone+20)+l+50; + left:=((i-1) mod NbElLi)*(licone+20)+l+xicones; top:= ((i-1) div NbElLi)*(hicone+10)+8; with canvas do begin @@ -10519,53 +10531,53 @@ begin s:=intToSTR(i+17); if i<10 then s:=' '+s; caption:=s; - left:=((i-1) mod NbElLi)*(licone+20)+l+32; + left:=((i-1) mod NbElLi)*(licone+20)+l+xicones-18; top:= ((i-1) div NbElLi)*(hicone+10)+16; end; end; end; -// dessine l'icone d'image ip et la place en x y d'après son index +// positionne l'icone d'image ip et la place en x y d'après son index i procedure positionne_iconeLbIm(IndexTCO : integer;ip : timage;lbl : tlabel;i : integer); const NbElLi=12; var s : string; - l : integer; + l : integer; begin l:=formTCO[1].groupBox1.Width; if (i>=32) and (i<=34) then dec(i,2); if ip<>nil then + begin + with ip do + begin + width:=licone; + height:=hicone; + left:=((i-1) mod NbElLi)*(licone+20)+l+Xicones; + top:= ((i-1) div NbElLi)*(hicone+10)+8; + with canvas do begin - with ip do - begin - width:=licone; - height:=hicone; - left:=((i-1) mod NbElLi)*(licone+20)+l+50; - top:= ((i-1) div NbElLi)*(hicone+10)+8; - with canvas do - begin - Pen.Color:=clFond[IndexTCO]; - Brush.color:=clFond[IndexTCO]; - Rectangle(0,0,licone,hicone); - end; - end; - end; - if lbl<>nil then - begin - with lbl do - begin - if (i=35) or (i=36) or (i=37) then s:=intToSTR(i+15) else - if (i>=30) and (i<=32) then - s:=intToSTR(i+2) - else - s:=intToSTR(i); - if i<10 then s:=' '+s; - caption:=s; - left:=((i-1) mod NbElLi)*(licone+20)+l+32; - top:= ((i-1) div NbElLi)*(hicone+10)+16; - end; + Pen.Color:=clFond[IndexTCO]; + Brush.color:=clFond[IndexTCO]; + Rectangle(0,0,licone,hicone); end; + end; + end; + if lbl<>nil then + begin + with lbl do + begin + if (i=35) or (i=36) or (i=37) then s:=intToSTR(i+15) else + if (i>=30) and (i<=32) then + s:=intToSTR(i+2) + else + s:=intToSTR(i); + if i<10 then s:=' '+s; + caption:=s; + left:=((i-1) mod NbElLi)*(licone+20)+l+Xicones-18; + top:= ((i-1) div NbElLi)*(hicone+10)+16; + end; + end; end; // dessine les icones du tco et les aligne @@ -10577,6 +10589,8 @@ begin // d'abord on positionne les icones with formTCO[indexTCO] do begin + + // groupe 1 les voies, les aiguillages, les TJD for i:=1 to 29 do begin ip:=findComponent('ImagePalette'+intToSTR(i)) as Timage; @@ -10623,7 +10637,7 @@ begin // et puis on les dessine sauv_ep:=epaisseur; - epaisseur:=4; + epaisseur:=3; ancw:=LargeurCell[indexTCO]; AncH:=hauteurCell[indexTCO]; hauteurCell[indexTCO]:=ImagePalette1.Height; @@ -10695,8 +10709,8 @@ begin clLarge:=Width; clHaut:=Height; - panel1.width:=clLarge-20; - Panel1.Top:=clHaut-Panel1.Height-64; // 64=entete de la fenetre + panelBas.width:=clLarge-5; + PanelBas.Top:=clHaut-PanelBas.Height-50; // 50=entete de la fenetre with ScrollBox do begin @@ -10709,16 +10723,16 @@ begin if MasqueBandeauTCO then begin BandeauMasque:=true; - Panel1.Hide; - ScrollBox.Height:=clHaut-32; + PanelBas.Hide; + ScrollBox.Height:=clientHeight; end else begin BandeauMasque:=false; - Panel1.show; - ScrollBox.Height:=ClHaut-Panel1.Height-ScrollBox.Top-64; + PanelBas.show; + ScrollBox.Height:=ClHaut-PanelBas.Height-ScrollBox.Top-54; end; - end; + end; end; procedure TFormTCO.FormActivate(Sender: TObject); @@ -10733,8 +10747,6 @@ begin {initalisation des dimensions du tco - à ne faire qu'une fois} if not(Forminit[indexTCO]) then begin - Button1.Visible:=not(Diffusion); - Button2.Visible:=not(Diffusion); ButtonCalibrage.Visible:=not(diffusion); ButtonSimu.Visible:=not(Diffusion); ImageTemp.Visible:=not(Diffusion); @@ -11427,12 +11439,16 @@ begin l:=image.Width; h:=image.height; + + // ImageTemp <- imageicone StretchBlt(formTCO[indexTCO].ImageTemp.canvas.Handle,0,0,LargeurCell[indexTCO],hauteurCell[indexTCO], // destination avec mise à l'échelle image.Canvas.Handle,0,0,l,h,srccopy); + //dessin_1(indexTCO,formTCO[indexTCO].ImageTemp.Canvas ,1,1,0); + + // OldBMP<-ImageTCO ; sauve le bitmap sous le pointeur de la souris BitBlt(OldBmp.Canvas.Handle,0,0,LargeurCell[indexTCO],hauteurCell[indexTCO],FormTCO[IndexTCO].ImageTCO.Canvas.Handle,offsetSourisX,offsetSourisY,SRCCOPY); - StretchBlt(Vbm.Handle,0,0,LargeurCell[indexTCO],hauteurCell[indexTCO], // destination masque avec mise à l'échelle - image.Canvas.Handle,0,0,l,h,srccopy); + drag:=true; TCODrag:=indexTCO; oldx:=offsetSourisX; @@ -11455,11 +11471,13 @@ begin Accept:=source is TImage; if drag then begin + // canvasTCO<-oldBMP restitue l'ancien en oldx,oldy fond avant le nouveau BitBlt(PImageTCO[indexTCO].canvas.handle,oldx,oldy,LargeurCell[indexTCO],hauteurCell[indexTCO],oldbmp.canvas.handle,0,0,SRCCOPY); // remettre la sauvegarde du bitmap à l'ancienne position souris + // oldbmp(0,0)<-canvasTCO(x1,y1) sauve le nouveau bitmap en x1,y1 BitBlt(oldbmp.canvas.handle,0,0,LargeurCell[indexTCO],hauteurCell[indexTCO],PImageTCO[IndexTCO].canvas.handle,xl,yl,SRCCOPY); // sauvegarder le bitmap actuel sous la souris oldx:=xl; oldy:=yl; - BitBlt(PImageTCO[indexTCO].canvas.handle,xl,yl,LargeurCell[indexTCO],hauteurCell[indexTCO],Vbm.canvas.handle,0,0,SRCAND); // prendre le masque de l'icone vers la souris, ne change rien... - BitBlt(PImageTCO[indexTCO].canvas.handle,xl,yl,LargeurCell[indexTCO],hauteurCell[indexTCO],formTCO[indexTCO].ImageTemp.canvas.handle,0,0,SRCPAINT); // copier l'icone vers la souris + // canvasTCO(x1,y1)<-ImageTemp(0,0) + BitBlt(PImageTCO[indexTCO].canvas.handle,xl,yl,LargeurCell[indexTCO],hauteurCell[indexTCO],formTCO[indexTCO].ImageTemp.canvas.handle,0,0,SRCCOPY); // copier l'icone vers la souris PImageTCO[IndexTCO].Repaint; end; end; @@ -11793,12 +11811,13 @@ begin c:=c.GetParentComponent; // formTCO indexTCO:=index_tco(c); for y:=TamponTCO_Org.y1 to TamponTCO_Org.y2 do // rectangle de la sélection - for x:=TamponTCO_Org.x1 to TamponTCO_Org.x2 do - begin - xPlace:=XclicCell[indexTCO]+x-TamponTCO_Org.x1; // destination - yPlace:=YclicCell[indexTCO]+y-TamponTCO_Org.y1; - if (xPlace<=NbreCellX[indexTCO]) and (yPlace<=NbreCellY[indexTCO]) then tco[indextco,xPlace,yPlace]:=tampontco[x,y]; - end; + for x:=TamponTCO_Org.x1 to TamponTCO_Org.x2 do + begin + xPlace:=XclicCell[indexTCO]+x-TamponTCO_Org.x1; // destination + yPlace:=YclicCell[indexTCO]+y-TamponTCO_Org.y1; + if (xPlace<=NbreCellX[indexTCO]) and (yPlace<=NbreCellY[indexTCO]) then tco[indextco,xPlace,yPlace]:=tampontco[x,y]; + end; + selectionaffichee[indexTCO]:=false; Affiche_TCO(indexTCO); TCO_modifie:=true; ligne_supprime:=0; @@ -12877,21 +12896,23 @@ begin defocusControl(ButtonConfigTCO,true); end; +// dépose un signal procedure TFormTCO.ImagePalette50EndDrag(Sender, Target: TObject; X, Y: Integer); var indexTCO,Xclic,Yclic : integer; begin if not(Target is TImage) then exit; if (x=0) and (y=0) then exit; indexTCO:=index_TCO(sender); + + xclicCell[indexTCO]:=(x div LargeurCell[indexTCO]) +1; + yclicCell[indexTCO]:=(y div LargeurCell[indexTCO]) +1; + xclic:=xclicCell[indexTCO]; yclic:=yclicCell[indexTCO]; BitBlt(formTCO[indexTCO].imageTCO.canvas.handle,oldx,oldy,LargeurCell[indexTCO],hauteurCell[indexTCO],oldbmp.canvas.handle,0,0,SRCCOPY); efface_entoure(indexTCO); TCO_modifie:=true; - Xclic:=X;YClic:=Y; - Xclic:=Xclic div LargeurCell[indexTCO] +1; - Yclic:=Yclic div hauteurCell[indexTCO] +1; stocke_undo(indexTCO,1,XClic,YClic); maj_undo(1); efface_cellule(indexTCO,formTCO[indexTCO].ImageTCO.Canvas,XClic,YClic,PmCopy); @@ -12900,7 +12921,9 @@ begin tco[indextco,XClic,YClic].FeuOriente:=1; tco[indextco,XClic,YClic].PiedFeu:=1; tco[indextco,XClic,YClic].coulFonte:=clWhite; - // ne pas convertir l'adresse sinon evt changement du composant et on écrase l'aspect EditAdrElement.Text:=IntToSTR( tco[indextco,XClicCell,YClicCell].Adresse); + clicTCO:=true; + editAdrElement.Text:=''; + clicTCO:=false; EdittypeImage.Text:=IntToSTR(tco[indextco,XClic,YClic].BImage); Dessin_Signal(indexTCO,formTCO[indexTCO].ImageTCO.Canvas,XClic,YClic); end; @@ -13229,7 +13252,7 @@ end; procedure TFormTCO.ButtonMasquerClick(Sender: TObject); begin - Panel1.Hide; + PanelBas.Hide; ScrollBox.Height:=ClientHeight-32; BandeauMasque:=true; defocusControl(ButtonMasquer,true); @@ -13435,7 +13458,7 @@ end; procedure TFormTCO.ImagePalette51EndDrag(Sender, Target: TObject; X, Y: Integer); begin - end_drag(51,x,y,sender,target); + end_drag(id_Quai,x,y,sender,target); end; @@ -13547,7 +13570,7 @@ begin accept:=true; end; -procedure TFormTCO.Panel1DragOver(Sender, Source: TObject; X, Y: Integer; +procedure TFormTCO.PanelBasDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean); begin accept:=true; @@ -14385,13 +14408,26 @@ begin Affiche_TCO(indexTCO); end; -procedure TFormTCO.Affichebandeau1Click(Sender: TObject); +procedure TFormTCO.BandeauClick(Sender: TObject); var indexTCO : integer; begin indexTCO:=index_TCOMainMenu; - Panel1.Show; - positionne(indexTCO); - BandeauMasque:=false; + if bandeauMasque then + begin + PanelBas.Show; + BandeauMasque:=false; + positionne(indexTCO); + Bandeau.Caption:='Masquer le bandeau'; + exit; + end + else + begin + PanelBas.Hide; + ScrollBox.Height:=ClientHeight; + BandeauMasque:=true; + defocusControl(ButtonMasquer,true); + Bandeau.Caption:='Afficher le bandeau'; + end; end; procedure TFormTCO.Mosaquehorizontale1Click(Sender: TObject); diff --git a/verif_version.pas b/verif_version.pas index 5472445..977df39 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -25,7 +25,7 @@ var verifVersion,notificationVersion : boolean; date_creation,nombre_tel : string; -Const Version='8.37'; // sert à la comparaison de la version publiée +Const Version='8.38'; // 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 55d8789..0dad40b 100644 --- a/versions.txt +++ b/versions.txt @@ -222,4 +222,7 @@ version 8.35 : Correction ajout de signaux et d'aiguillages. version 8.36 : Création d'un mode de fond sombre modifiable pour l'affichage. Amélioration édition des lignes et colonnes du TCO. version 8.37 : Correction des calculs des index des aiguillages et des signaux lors de leur suppression. - Correction présence trains avant signal. \ No newline at end of file + Correction présence trains avant signal. +version 8.38 : Ajout de l'importation depuis le réseau CDM rail des bretelles double jonction, ce qui crée 4 aiguillages et un croisement. + Amélioration du traitement des trames inconnues en XpressNet. +