forked from barais/tpWeb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodel.js
More file actions
40 lines (31 loc) · 865 Bytes
/
Copy pathmodel.js
File metadata and controls
40 lines (31 loc) · 865 Bytes
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
// Implémenter ici les 4 classes du modèle.
// N'oubliez pas l'héritage !
function Forme(epaisseur, couleur){
this.epaisseur = epaisseur;
this.couleur = couleur;
};
function Drawing(){
this.tabforme = [];
this.ajoutForme = function(forme){
this.tabforme.push(forme);
};
this.suppforme = function(id){
this.tabforme.splice(id,1);
};
};
function Rectangle(largeur,hauteur,posx,posy,epaisseur,couleur ){
Forme.call(this,epaisseur, couleur);
this.largeur = largeur;
this.hauteur = hauteur;
this.posx = posx;
this.posy = posy;
};
Rectangle.prototype = new Forme();
function Line(posxA,posyA,posxB,posyB,epaisseur,couleur){
Forme.call(this, epaisseur, couleur);
this.posxA = posxA;
this.posyA = posyA;
this.posxB = posxB;
this.posyB = posyB;
};
Line.prototype = new Forme();