1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519
| unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, StdCtrls, Buttons, jpeg, Spin;
type
TForm1 = class(TForm)
Timer1: TTimer;
Timer2: TTimer;
Timer3: TTimer;
Timer4: TTimer;
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Image2: TImage;
Image4: TImage;
Image1: TImage;
Image3: TImage;
Button5: TButton;
Button6: TButton;
Button7: TButton;
Edit1: TEdit;
Edit2: TEdit;
Edit3: TEdit;
Label1: TLabel;
Shape1: TShape;
Shape2: TShape;
Shape3: TShape;
Shape4: TShape;
Shape5: TShape;
Shape6: TShape;
procedure timer1timer(sender:tobject);
procedure Button9Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
//faire tourner la ligne (utiliser case pour symétrie)
var
Form1: TForm1;
i,n1,n2,n3,p,q,s,m1,m2,m3,w,etape:integer;
ct1,ct2,ct3,ct4,cvs:real;
Val1,val2,val3:real;
nboite,mouvement,mouvement2:integer;
a:integer=0;
tet:extended=0;
xon,yon:integer;
t:integer=0;
cart: array of integer;
const
x0:integer=200;
y0:integer=300;
r:integer=100;
implementation
procedure tform1.timer1timer(sender:tobject);
begin
with form1.image1.canvas do
begin
fillrect(clientrect);
begin
//traitement en marche
if mouvement=1 then
a:=a;tet:=tet;
//traitement en arrêt
if mouvement=0 then
a:=0;
if mouvement=0 then
tet:=0;
end;
//pièce
brush.Color := clsilver ;
polygon([point(0,393),point(113,279),point(1270,279),point(1270,1000),point(0,1000)]);
polyline([point(113,279),point(113,0)]);
//tapis
brush.Color := rgb(255,255,200); //couleur de la partie inférieur du tapis
polygon([point(0,217),point(309,217)]); //dessin de la partie inférieure du tapis
polygon([point(998,217),point(1270,217)]);
brush.Color := rgb(255,255,255);//couleur du tapis
brush.Color := clbtnshadow;
polygon([point(0,195),point(1270,195),point(1270,120),point(0,120)]); //dessin du tapis
tet:=(tet+(pi*6)/180); // gain de 6 degrès par tic d'horloge
a:=(a+1) mod 62; //déplacement des trait du tapis allant jusqu'à 62
for i:=0 to 19 do // for permettant de dessiner les rondins et les traits
begin
brush.Color := clolive;
ellipse(15+(i+1)*62,195,35+(i+1)*62,217); //rondins
polyline([point(0+a+i*62,195),point(75+a+i*62,120)]); // dessin des trait du tapis
polyline([point(24+(i+1)*62,206),point(24+(i+1)*62+round(10*cos(tet)),206+round(10*sin(tet)))]);//dessin des traits des rondins
end;
//guide de colis fond (A)
brush.Color := rgb(255,255,255);
polygon([point(292,314),point(397,314),point(397,286),point(505,197),point(321,197)]);
//guide de colis fond(B)
brush.Color := rgb(255,255,255);
polygon([point(531,314),point(639,314),point(639,286),point(741,197),point(555,197)]);
//guide de colis fond(C)
brush.Color := rgb(255,255,255);
polygon([point(769,314),point(877,314),point(878,286),point(976,197),point(789,197)]);
//pieds du tapis
brush.Color := clhotlight;
polygon([point(73,397),point(84,397),point(84,217),point(73,217)]);
polygon([point(129,333),point(140,333),point(140,217),point(129,217)]);
polygon([point(1095,397),point(1105,397),point(1105,217),point(1095,217)]);
polygon([point(1154,333),point(1165,333),point(1165,217),point(1154,217)]);
//bras tourniquet
//(A)
polygon([point(440,120),point(463,120),point(463,84),point(440,84)]);
polygon([point(463,110),point(588,110),point(588,96),point(463,96)]);
//bras tourniquet
//(B)
polygon([point(677,120),point(700,120),point(700,84),point(677,84)]);
polygon([point(700,110),point(825,110),point(825,96),point(700,96)]);
//bras tourniquet
//(C)
polygon([point(914,120),point(937,120),point(937,84),point(914,84)]);
polygon([point(937,110),point(1058,110),point(1058,96),point(937,96)]);
//capteur
brush.Color := rgb(255,255,255);
polygon([point(296,120),point(306,120),point(306,89),point(296,89)]);
polygon([point(288,89),point(316,89),point(316,54),point(288,54)]);
brush.Color := rgb(0+w,0+w,0+w);
polygon([point(288,79),point(316,79),point(316,66),point(288,66)]);
// fond du cube1
brush.Color := rgb(255,255,255);
polygon([point(194,391),point(360,391),point(427,326),point(261,326)]);
//fond du cube2
brush.Color := rgb(255,255,255);
polygon([point(435,391),point(602,391),point(667,326),point(501,326)]);
//fonc du cube3
brush.Color := rgb(255,255,255);
polygon([point(675,391),point(841,391),point(906,326),point(741,326)]);
//boite
// CARTON n°1
brush.Color := rgb(149,200,222);
polygon([point(-93+n1,179+m1),point(-26+n1,179+m1),point(-26+n1,138+m1),point(-93+n1,138+m1)]);
polygon([point(-93+n1,138+m1),point(-26+n1,138+m1),point(0+n1,110+m1),point(-65+n1,110+m1)]);
polygon([point(-26+n1,138+m1),point(-26+n1,179+m1),point(0+n1,150+m1),point(0+n1,110+m1)]);
if mouvement=2 then
case etape of
0:begin
n1:=n1+1;
if(n1>1)then
etape:=1;
end;
1:begin
n1:=n1+1;
if(n1=455) then
etape:=2;
end;
2:begin
n1:=n1+1;
m1:=m1+1;
if(n1>50)then
etape:=3;
end;
3:begin
n1:=n1+1;
m1:=m1+1;
if(m1>50)then
etape:=4;
end;
4:begin
n1:=n1-2;
m1:=m1+2;
if(n1>350)then
etape:=5;
end;
5:begin
n1:=n1-2;
m1:=m1+2;
if(m1>170)then
etape:=6;
end;
6:begin
m1:=m1+2;
if(m1>300)then
etape:=7;
end;
end;
// CARTON n°2
brush.Color := clteal;
polygon([point(-93+n2,179+m2),point(-26+n2,179+m2),point(-26+n2,138+m2),point(-93+n2,138+m2)]);
polygon([point(-93+n2,138+m2),point(-26+n2,138+m2),point(0+n2,110+m2),point(-65+n2,110+m2)]);
polygon([point(-26+n2,138+m2),point(-26+n2,179+m2),point(0+n2,150+m2),point(0+n2,110+m2)]);
if mouvement=3 then
case etape of
0:begin
n2:=n2+1;
if(n2>1)then
etape:=1;
end;
1:begin
n2:=n2+1;
if(n2=680)then
etape:=2;
end;
2:begin
n2:=n2+1;
m2:=m2+1;
if(n2>50)then
etape:=3;
end;
3:begin
n2:=n2+1;
m2:=m2+1;
if(m2>50)then
etape:=4;
end;
4:begin
n2:=n2-2;
m2:=m2+2;
if(n2>350)then
etape:=5;
end;
5:begin
n2:=n2-2;
m2:=m2+2;
if(m2>155)then
etape:=6;
end;
6:begin
m2:=m2+2;
if(m2>300)then
etape:=7;
end;
end;
// CARTON n°3
brush.Color := clyellow;
polygon([point(-93+n3,179+m3),point(-26+n3,179+m3),point(-26+n3,138+m3),point(-93+n3,138+m3)]);
polygon([point(-93+n3,138+m3),point(-26+n3,138+m3),point(0+n3,110+m3),point(-65+n3,110+m3)]);
polygon([point(-26+n3,138+m3),point(-26+n3,179+m3),point(0+n3,150+m3),point(0+n3,110+m3)]);
if mouvement=4 then
case etape of
0:begin
n3:=n3+1;
if(n3>1)then
etape:=1;
end;
1:begin
n3:=n3+1;
if(n3=900)then
etape:=2;
end;
2:begin
n3:=n3+1;
m3:=m3+1;
if(n3>50)then
etape:=3;
end;
3:begin
n3:=n3+1;
m3:=m3+1;
if(m3>50)then
etape:=4;
end;
4:begin
n3:=n3-2;
m3:=m3+2;
if(n3>270)then
etape:=5;
end;
5:begin
n3:=n3-2;
m3:=m3+2;
if(m3>135)then
etape:=6;
end;
6:begin
m3:=m3+2;
if(m3>300)then
etape:=7;
end;
end;
//guide de colis bord(A)
brush.Color := rgb(255,255,255);
polygon([point(292,286),point(292,314),point(321,197),point(321,155)]);
polygon([point(397,286),point(397,314),point(544,208),point(554,155)]);
//guide de colis bord(B)
brush.Color := rgb(255,255,255);
polygon([point(531,286),point(531,314),point(554,197),point(554,155)]);
polygon([point(639,286),point(639,314),point(790,197),point(790,155)]);
//guide de colis bord(C)
brush.Color := rgb(255,255,255);
polygon([point(769,286),point(769,314),point(789,197),point(790,155)]);
polygon([point(877,286),point(877,314),point(1024,197),point(1024,155)]);
//: cube 1
brush.Color := rgb(149,200,222);
polygon([point(194,391),point(360,391),point(360,525),point(194,525)]);
brush.Color := rgb(149,200,222);
polygon([point(360,525),point(360,391),point(427,326),point(427,458)]);
polygon([point(261,326),point(261,391)]);
//: palette
brush.Color := rgb(226,215,102);
polygon([point(344,549),point(360,549),point(360,525),point(344,525)]);
polygon([point(360,549),point(360,525),point(427,458),point(427,483)]);
polygon([point(194,549),point(206,549),point(206,525),point(194,525)]);
polygon([point(206,549),point(206,525),point(229,525)]);
//: cube 2
brush.Color := clteal;
polygon([point(435,391),point(602,391),point(602,525),point(435,525)]);
brush.Color := clteal;
polygon([point(602,525),point(602,391),point(667,326),point(667,458)]);
polygon([point(501,326),point(501,391)]);
//: palette
brush.Color := rgb(226,215,102);
polygon([point(585,549),point(602,549),point(602,525),point(585,525)]);
polygon([point(602,549),point(602,525),point(667,458),point(667,483)]);
polygon([point(435,549),point(447,549),point(447,525),point(435,525)]);
polygon([point(447,549),point(447,525),point(470,525)]);
//: cube 3
brush.Color := clyellow;
polygon([point(675,391),point(841,391),point(841,525),point(675,525)]);
brush.Color := clyellow;
polygon([point(841,525),point(841,391),point(906,326),point(906,458)]);
polygon([point(741,326),point(741,391)]);
//: palette
brush.Color := rgb(226,215,102);
polygon([point(827,549),point(841,549),point(841,525),point(827,525)]);
polygon([point(841,549),point(841,525),point(906,458),point(906,483)]);
polygon([point(675,549),point(689,549),point(689,525),point(675,525)]);
polygon([point(689,549),point(689,525),point(712,525)]);
//signilisation (A)
brush.Color := rgb(0,0,0);
polygon([point(379,549),point(387,549),point(387,262),point(379,262)]);
//signilisation (B)
brush.Color := rgb(0,0,0);
polygon([point(620,549),point(629,549),point(629,262),point(620,262)]);
//signilisation (C)
brush.Color := rgb(0,0,0);
polygon([point(860,549),point(869,549),point(869,262),point(860,262)]);
brush.color:=clwhite;
end;
end;
{$R *.dfm}
procedure TForm1.Button9Click(Sender: TObject);
begin
form1.close;
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
mouvement :=1;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
mouvement :=0;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
form1.close
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
mouvement2:=0;
mouvement:=mouvement2+1;
if mouvement2>3 then mouvement2:=1;
edit1.Text:= floattostr(val1+1);
val1:=1*p;
p:=1+p;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
mouvement:=3;
edit2.Text:= floattostr(val2+1);
val2:=1*q;
q:=1+q;
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
mouvement:=4;
edit3.Text:= floattostr(val3+1);
val3:=1*s;
s:=1+s;
end;
end. |
Partager