#include "classes/gui.inc"
(*Program ma pokazac dzialanie algorytmow geometrycznych *)
(* o ktorych mowilam na wykladzie*)
-
signal ERROR_exec;
CONST
BEGIN
While GUI_KeyPressed=/= 0 DO OD;
END waitt;
-
UNIT clear_all : procedure;
begin
call GUI_Rect(my_ecranMinX, my_ecranMinY, my_ecranMaxX,
call GUI_Rect(my_EcranMinX, MaxY-2*sz,
my_EcranMaxX,MaxY-5,c_DarkGrey,c_DarkGrey);
end clear_all;
-
UNIT clear : PROCEDURE(x0,y0,x1,y1,c1,c2: integer);
(* wymaz wszystko w prostokacie (x0,y0)-(y1,y1) *)
(* Zostaw ekran w kolorze c2*)
BEGIN
pref GRAPHICS block
-
(*-----------------------------------------------------------------------*)
-
(* M E N U *)
(*-----------------------------------------------------------------------*)
unit option : class(nb : integer);
call clear(minX+5,minY+sz+3,maxX-5,maxY-2*sz-1,c_white,c_lightGrey);
call ENDRUN
fi;
-
others call comment(" ERROR press YES to continue or NO to stop?");
when 2 : call comment("Wczytanie danych do problemu otoczki.");
call WczytajDane(il_punktow,TAB);
when 3 : call comment("Dane do problemu przeciec odcinkow");
-
when 4 : call comment("Tu ma byc informacja o algorytmie");
esac;
Nom(3) := "ODCINKI";
Nom(4) := "HELP";
end OPTIONS_MAIN;
-
unit OPTIONS_OTOCZKA : option class;
unit virtual Action : procedure(j : integer);
var x: integer, boo : boolean;
od;
case i
when 1 : il_punktow := il_punktow+10;
-
call GUI_Rect(pminX+150,pminY+10,pminX+180,pminY+25, c_green,c_green);
call GUI_writeInt(pminX+150,pminY+10,il_punktow, c_darkGrey,c_green);
when 2 : il_punktow := il_punktow-10;
call comment("");
call clear_all;
end WczytajDane;
-
(*-------------------------------------------------------------*)
UNIT PokazPunkty : procedure(il_punktow:integer, TAB:arrayof punkt);
var i : integer, pp : punkt;
call pp.rysuj
od;
end PokazPunkty;
-
UNIT WylosujPunkty : procedure(il_punktow:integer; inout Tab:arrayof punkt);
var pp : punkt;
begin
od;
call comment("");
end WylosujPunkty;
-
unit INFO : procedure(il,ilb : integer);
begin
call comment("");
call STOP_IKONA.write_i;
end INFO;
(*--------------------------------------------------------------*)
-
Unit GRAHAM : procedure(il_punktow: integer, TAB : arrayof punkt);
UNIT SORTUJ : procedure(p0:punkt);
unit mniejsze : function(p,q:punkt) : boolean;
result := true
fi;
end mniejsze;
-
unit pokaz : procedure(c,k:integer);
var i : integer;
begin
od;
call GUI_Line (p0.x,p0.y, Tab(k).x,Tab(k).y, c)
end pokaz;
-
unit poprawHeap: procedure(k:integer);
var i,j : integer, v : punkt;
begin
call GUI_MousePressed(xx,yy,k);
od;
END SORTUJ;
-
var c, kk,i, lewy,prawy,gora,dol : integer , pp : punkt,
Wielokat : arrayof punkt;
begin
lewy:=1; prawy :=1;
call STOP_IKONA.write_i;
call continue_IKONA.write_i;
-
for i :=2 to il_punktow do
if TAB(i).y>Tab(dol).y then dol:=i
else
(*posortuj tablice Tab ze wzgledu na katy *)
call SORTUJ(WIELOKAT(1));
(* Rysuj boki otoczki *)
-
end GRAHAM;
-
UNIT JARVIS : procedure(n:integer,TAB:arrayof punkt);
BEGIN
END JARVIS;
-
UNIT TROJKATY : procedure(n:integer,TAB:arrayof punkt);
var Wielokat : arrayof punkt, i,j,k,x,kk :integer;
BEGIN
od
od;
END TROJKATY;
-
UNIT NarysujWielokat : procedure(c,n:integer,T: arrayof punkt);
var i : integer;
BEGIN
od;
call GUI_Line(T(1).x,T(1).y,T(n).x,T(n).y,c);
END NarysujWielokat;
-
UNIT WYPISZ_INFO : procedure(cz,b,il_cz,il_b, ocena : integer);
BEGIN
END WYPISZ_INFO;
-
unit Insert: procedure(pp: punkt,Tab : arrayof punkt, il : integer);
(* doloaczanie punktu pp do uporzadkowanej tablicy Tab o il-elementach *)
var j : integer;
od;
Tab(j+1) := pp;
end Insert;
-
unit punkt : class(x,y,c: integer);
var boo : boolean;
unit mniejsze : function( p : punkt) : boolean;
begin
result := (y< p.y or (y=p.y and x< p.x))
end mniejsze;
-
unit naLewo : function(p1,p2: punkt):boolean;
(*(x,y) jest na lewo (na ekranie ) od odcinka p1,p2 *)
begin
result := true
else result := false fi
end naLewo;
-
unit rysuj : procedure;
begin
call GUI_Ellipse(x,y,5,5,0,360,c,c)
begin
call GUI_Line(L(nr-1).x, L(nr-1).y, L(nr).x, L(nr).y, c_blue);
end WYMAZ_KONIEC;
-
UNIT WNETRZE : procedure(n: integer, WIELOKAT: arrayof punkt;output k:integer);
var i, j : integer, boo : boolean, pp: punkt;
begin
fi
od;
end WNETRZE;
-
UNIT NaLewo : procedure(p1,p2:punkt; output cz,b : integer);
var i : integer;
begin
end NaLewo;
-
UNIT chromosom : class(x,y, u,w,ocena: integer);
begin
end chromosom;
-
(*--------------------------------------------------------------*)
UNIT ODCINKI : procedure;
END Odcinki;
-
UNIT ALG_2 : procedure(ilCZ, ilB : integer);
var POKOLENIE : arrayof chromosom,
ch : chromosom,
(*--------------------------------------------------------------*)
-
VAR TAB : arrayof punkt, il_punktow, il_porownan: integer,
OK_ikona,YES_ikona,NO_ikona, STOP_IKONA,
EXIT_IKONA, CONTINUE_IKONA : IKONA,
STOP_IKONA := new IKONA(c_green,590,430,635,460,3,"STOP");
CONTINUE_IKONA :=
new IKONA(c_green,450,430,550,460,3,"CONTINUE");
-
(* Strona tytulowa *)
CALL GUI_Rect(minX+1,minY+1,maxX-2,maxY-2,c_black,c_lightGrey);
menu_main.ICONES(4).sub_menu :=
new menu(minX,maxX,minY,maxY,new OPTIONS_help(3));
-
menu_main.ICONES(2).sub_menu :=
new menu(minX,maxX,minY,maxY,new OPTIONS_OTOCZKA(4));
-
-
attach(menu_main);
END GEOMETRIA;
-
\0\0
\ No newline at end of file