unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TVstupy = Record Nazev : String; X,Y,W,H : Integer; end; TBrana = Record Nazev : String; x,y,w,h : Integer; Imput : Array of String; Output : Array of String; end; TVystup = Record Nazev : String; x,y,w,h : Integer; end; TForm1 = class(TForm) XML: TButton; Vybarvy: TButton; OpenDialog1: TOpenDialog; procedure XMLClick(Sender: TObject); Procedure Namaluj; procedure VybarvyClick(Sender: TObject); private { Private declarations } Vstupy : Array of TVstupy; Brany : Array of TBrana; Vystupy : Array of TVystup; public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} Function PrectiCislo(s : string) : Integer; Var i : Integer; Begin i:=0; Repeat i:=i+1; until (Copy(s,i,1)=' ') or (Copy(s,i,1)='/')or (Copy(s,i,1)='>'); If Copy(s,i,1)=' ' then PrectiCislo:=StrToInt(Copy(s,1,i-2)) else PrectiCislo:=StrToInt(Copy(s,1,i-2)); (* Tato funkce zjisti z retezce cislo, tím zpusobem že čte čísla až dokud není znak mezera nebo /*) end; function PrectiNazev(s : String) : String; Var i : Integer; Begin i:=0; Repeat i:=i+1; until Copy(s,i,1)=' '; PrectiNazev:=Copy(s,1,i-2); (* Tato funkce čte jednotlivé znkaky dokud nenarazí na mezeru pak vrátí řetezec*) end; Function Orez(s : String) : String; Var i : Integer; begin i:=0; Repeat i:=i+1; until Copy(s,i,1)='='; Orez:=copy(s,i+2,length(s)-i+2); (*tato funcke ořeže znak až po rovnáse aby usnadnila práci funkcim Prectinazev a precti znak*) end; procedure TForm1.VybarvyClick(Sender: TObject); begin Namaluj; end; procedure TForm1.XMLClick(Sender: TObject); Var f : TextFile; radek : String; i,pocetBran: Integer; begin If OpenDialog1.Execute=False then exit; AssignFile(f,opendialog1.FileName); Reset(f); ReadLn(f); SetLength(vstupy,0); ReadLn(f,radek); Repeat SetLength(Vstupy,Length(vstupy)+1); radek := copy(radek,14,Length(radek)-12); Vstupy[length(vstupy)-1].Nazev:=PrectiNazev(radek); Radek:=Orez(Radek); Vstupy[length(vstupy)-1].X:=PrectiCislo(radek); Radek:=Orez(Radek); Vstupy[length(vstupy)-1].Y:=PrectiCislo(radek); Radek:=Orez(Radek); Vstupy[length(vstupy)-1].W:=PrectiCislo(radek); Radek:=Orez(Radek); Vstupy[length(vstupy)-1].H:=PrectiCislo(radek); ReadLn(f,radek); (*Tady se postupne ulozi data o vstupech pomoci funkci NactiCiso a nactiMeno deje se to dokud neni 4 znak ve slove g coz znamena ze budou nasledovat brany*) until copy(radek,4,1)='g'; i:=1; setLength(brany,0); Repeat If Copy(radek,3,3)='