Skip to content
Snippets Groups Projects
Commit cabfc8c7 authored by melizzzz's avatar melizzzz
Browse files

mise en place d'icones

parent 5160d82a
No related branches found
No related tags found
No related merge requests found
Pipeline #40650 passed
Showing
with 136 additions and 81 deletions
...@@ -94,12 +94,8 @@ public class Controller { ...@@ -94,12 +94,8 @@ public class Controller {
private ViewElement getViewElement(Square square) { private ViewElement getViewElement(Square square) {
if (!square.getEntities().isEmpty()) { if (!square.getEntities().isEmpty()) {
for (Entity entity : square.getEntities()) { for (Entity entity : square.getEntities()) {
if (entity instanceof Cloud) {
return new ViewElement(((Cloud) entity).getImage());
}else{
} return new ViewElement(entity.getImage());
// Ajoutez ici des cas similaires pour d'autres entités comme Fire, FireFighter, etc.
} }
} }
return new ViewElement(square.getViewColor()); return new ViewElement(square.getViewColor());
......
...@@ -4,6 +4,7 @@ import java.util.ArrayList; ...@@ -4,6 +4,7 @@ import java.util.ArrayList;
import java.util.List; import java.util.List;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import model.firefighterscenario.Cloud;
import util.Position; import util.Position;
public class EmptySquare implements Entity { public class EmptySquare implements Entity {
...@@ -12,6 +13,15 @@ public class EmptySquare implements Entity { ...@@ -12,6 +13,15 @@ public class EmptySquare implements Entity {
private final Color viewColor = Color.WHITE; private final Color viewColor = Color.WHITE;
private int age; private int age;
private final int priotity = -1; private final int priotity = -1;
private static javafx.scene.image.Image cloudImage;
static {
try {
cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/icons/img.png").toExternalForm());
} catch (Exception e) {
e.printStackTrace();
}
}
public EmptySquare(Position p) { public EmptySquare(Position p) {
this.position = p; this.position = p;
...@@ -61,4 +71,9 @@ public class EmptySquare implements Entity { ...@@ -61,4 +71,9 @@ public class EmptySquare implements Entity {
public int getPriority(){ public int getPriority(){
return this.priotity; return this.priotity;
} }
@Override
public javafx.scene.image.Image getImage() {
return cloudImage;
}
} }
package model; package model;
import javafx.scene.image.Image;
import java.util.List; import java.util.List;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
...@@ -21,4 +21,5 @@ public interface Entity { ...@@ -21,4 +21,5 @@ public interface Entity {
public void incrementAge(); public void incrementAge();
public Color getViewColor(); public Color getViewColor();
public int getPriority(); public int getPriority();
public Image getImage();
} }
package model; package model.firefighterscenario;
import java.util.List;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import model.Board;
import model.Entity;
import model.Square;
import util.Position; import util.Position;
import java.util.List;
public class Road implements Entity{ public class Road implements Entity{
private int age; private int age;
private final int PRIORITY = 0;
private final Color VIEW_COLOR = Color.BLACK;
private Position position; private Position position;
private final Color viewColor = Color.GREY; private static javafx.scene.image.Image cloudImage;
private final int priority = 0;
static {
try {
cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/icons/route.png").toExternalForm());
} catch (Exception e) {
e.printStackTrace();
}
}
public Road(Position position){
this.position = position;
}
@Override @Override
public List<Position> nextTurn(Board<Square> board) { public List<Position> nextTurn(Board<Square> board) {
return List.of(); return List.of();
...@@ -19,36 +33,42 @@ public class Road implements Entity{ ...@@ -19,36 +33,42 @@ public class Road implements Entity{
@Override @Override
public Position getPosition() { public Position getPosition() {
return null; return this.position;
} }
@Override @Override
public void setPosition(Position p) { public void setPosition(Position p) {
this.position = p;
} }
@Override @Override
public int getAge() { public int getAge() {
return 0; return age;
} }
@Override @Override
public void setAge(int age) { public void setAge(int age) {
this.age = age;
} }
@Override @Override
public void incrementAge() { public void incrementAge() {
this.age = age + 1;
} }
@Override @Override
public Color getViewColor() { public Color getViewColor() {
return null; return this.VIEW_COLOR;
} }
@Override @Override
public int getPriority() { public int getPriority() {
return 0; return this.PRIORITY;
} }
@Override
public javafx.scene.image.Image getImage() {
return cloudImage;
}
} }
...@@ -18,6 +18,15 @@ public class AirTanker implements Entity{ ...@@ -18,6 +18,15 @@ public class AirTanker implements Entity{
private int age; private int age;
private Position position; private Position position;
private int priority = 3; private int priority = 3;
private static javafx.scene.image.Image cloudImage;
static {
try {
cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/icons/avion.png").toExternalForm());
} catch (Exception e) {
e.printStackTrace();
}
}
public AirTanker(Position position, Board<Square> b, int age) { public AirTanker(Position position, Board<Square> b, int age) {
this.age = age; this.age = age;
...@@ -163,5 +172,8 @@ public class AirTanker implements Entity{ ...@@ -163,5 +172,8 @@ public class AirTanker implements Entity{
return Objects.hash(position, age); return Objects.hash(position, age);
} }
@Override
public javafx.scene.image.Image getImage() {
return cloudImage;
}
} }
...@@ -21,7 +21,7 @@ public class Cloud implements Entity{ ...@@ -21,7 +21,7 @@ public class Cloud implements Entity{
static { static {
try { try {
cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/nuage.png").toExternalForm()); cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/icons/nuage.png").toExternalForm());
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
...@@ -115,7 +115,7 @@ public class Cloud implements Entity{ ...@@ -115,7 +115,7 @@ public class Cloud implements Entity{
return this.priority; return this.priority;
} }
@Override
public javafx.scene.image.Image getImage() { public javafx.scene.image.Image getImage() {
return cloudImage; return cloudImage;
} }
......
...@@ -18,6 +18,15 @@ public class Fire implements Entity { ...@@ -18,6 +18,15 @@ public class Fire implements Entity {
private final Color viewColor = Color.RED; private final Color viewColor = Color.RED;
private int age; private int age;
private final int priority = 1; private final int priority = 1;
private static javafx.scene.image.Image cloudImage;
static {
try {
cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/icons/flamme.png").toExternalForm());
} catch (Exception e) {
e.printStackTrace();
}
}
public Fire(Position position) { public Fire(Position position) {
this.position = position; this.position = position;
...@@ -132,4 +141,9 @@ public class Fire implements Entity { ...@@ -132,4 +141,9 @@ public class Fire implements Entity {
return Objects.hash(position, age); return Objects.hash(position, age);
} }
@Override
public javafx.scene.image.Image getImage() {
return cloudImage;
}
} }
...@@ -19,6 +19,15 @@ public class FireFighter implements Entity { ...@@ -19,6 +19,15 @@ public class FireFighter implements Entity {
private final Color viewColor = Color.BLUE; private final Color viewColor = Color.BLUE;
private final int priority = 1; private final int priority = 1;
protected List<Position> lastThreePosition; protected List<Position> lastThreePosition;
private static javafx.scene.image.Image cloudImage;
static {
try {
cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/icons/sapeur-pompier.png").toExternalForm());
} catch (Exception e) {
e.printStackTrace();
}
}
public FireFighter(Position position, Board<Square> b) { public FireFighter(Position position, Board<Square> b) {
this.position = position; this.position = position;
...@@ -220,4 +229,8 @@ public class FireFighter implements Entity { ...@@ -220,4 +229,8 @@ public class FireFighter implements Entity {
} }
public int getPriority(){ return this.priority;} public int getPriority(){ return this.priority;}
@Override
public javafx.scene.image.Image getImage() {
return cloudImage;
}
} }
...@@ -26,6 +26,7 @@ public class FireFighterScenario extends EntityScenario implements Board<Square> ...@@ -26,6 +26,7 @@ public class FireFighterScenario extends EntityScenario implements Board<Square>
private Map<EntityFactory, Integer> initialMap; private Map<EntityFactory, Integer> initialMap;
public FireFighterScenario(int columns, int rows) { public FireFighterScenario(int columns, int rows) {
this.matrix = new Matrix<Square>(columns, rows); this.matrix = new Matrix<Square>(columns, rows);
initScenario(matrix); initScenario(matrix);
......
...@@ -11,6 +11,16 @@ import util.PositionUtil; ...@@ -11,6 +11,16 @@ import util.PositionUtil;
public class MotorizedFireFighter extends FireFighter { public class MotorizedFireFighter extends FireFighter {
private final Color viewColor = Color.CYAN; private final Color viewColor = Color.CYAN;
private static javafx.scene.image.Image cloudImage;
static {
try {
cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/icons/camion.png").toExternalForm());
} catch (Exception e) {
e.printStackTrace();
}
}
public MotorizedFireFighter(Position position, Board<Square> b) { public MotorizedFireFighter(Position position, Board<Square> b) {
super(position, b); super(position, b);
...@@ -109,4 +119,8 @@ public class MotorizedFireFighter extends FireFighter { ...@@ -109,4 +119,8 @@ public class MotorizedFireFighter extends FireFighter {
lastThreePosition.add(this.getPosition()); lastThreePosition.add(this.getPosition());
} }
@Override
public javafx.scene.image.Image getImage() {
return cloudImage;
}
} }
\ No newline at end of file
...@@ -13,6 +13,15 @@ public class Mountain implements Entity{ ...@@ -13,6 +13,15 @@ public class Mountain implements Entity{
Position position; Position position;
private int age; private int age;
private final Color viewColor = Color.CHOCOLATE; private final Color viewColor = Color.CHOCOLATE;
private static javafx.scene.image.Image cloudImage;
static {
try {
cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/icons/montagne.png").toExternalForm());
} catch (Exception e) {
e.printStackTrace();
}
}
public Mountain(Position p ){ public Mountain(Position p ){
this.position = p; this.position = p;
...@@ -64,4 +73,9 @@ public class Mountain implements Entity{ ...@@ -64,4 +73,9 @@ public class Mountain implements Entity{
public int getPriority() { public int getPriority() {
return this.priority; return this.priority;
} }
@Override
public javafx.scene.image.Image getImage() {
return cloudImage;
}
} }
package model.firefighterscenario;
import java.util.List;
import javafx.scene.paint.Color;
import model.Board;
import model.Entity;
import model.Square;
import util.Position;
public class Road implements Entity{
private int age;
private final int PRIORITY = 0;
private final Color VIEW_COLOR = Color.BLACK;
private Position position;
public Road(Position position){
this.position = position;
}
@Override
public List<Position> nextTurn(Board<Square> board) {
return List.of();
}
@Override
public Position getPosition() {
return this.position;
}
@Override
public void setPosition(Position p) {
this.position = p;
}
@Override
public int getAge() {
return age;
}
@Override
public void setAge(int age) {
this.age = age;
}
@Override
public void incrementAge() {
this.age = age + 1;
}
@Override
public Color getViewColor() {
return this.VIEW_COLOR;
}
@Override
public int getPriority() {
return this.PRIORITY;
}
}
...@@ -14,6 +14,16 @@ public class Rockery implements Entity{ ...@@ -14,6 +14,16 @@ public class Rockery implements Entity{
private int age; private int age;
private int burn; private int burn;
private final Color viewColor = Color.LIMEGREEN; private final Color viewColor = Color.LIMEGREEN;
private static javafx.scene.image.Image cloudImage;
static {
try {
cloudImage = new javafx.scene.image.Image(Cloud.class.getResource("/view/icons/rochers.png").toExternalForm());
} catch (Exception e) {
e.printStackTrace();
}
}
public Rockery(Position p ){ public Rockery(Position p ){
this.position = p; this.position = p;
...@@ -78,4 +88,9 @@ public class Rockery implements Entity{ ...@@ -78,4 +88,9 @@ public class Rockery implements Entity{
public void resetBurn() { public void resetBurn() {
this.burn = 0; this.burn = 0;
} }
@Override
public javafx.scene.image.Image getImage() {
return cloudImage;
}
} }
src/main/resources/view/icons/camion.png

23.6 KiB

src/main/resources/view/icons/img.png

356 B

0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment