|
|
|
@ -1,25 +1,11 @@
|
|
|
|
|
package launcher;
|
|
|
|
|
|
|
|
|
|
import javafx.application.Application;
|
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
|
import javafx.fxml.FXMLLoader;
|
|
|
|
|
import javafx.fxml.Initializable;
|
|
|
|
|
import javafx.scene.Group;
|
|
|
|
|
import javafx.scene.Parent;
|
|
|
|
|
import javafx.scene.Scene;
|
|
|
|
|
import javafx.scene.layout.BorderPane;
|
|
|
|
|
import javafx.scene.layout.StackPane;
|
|
|
|
|
import javafx.scene.text.Text;
|
|
|
|
|
import javafx.stage.Stage;
|
|
|
|
|
import model.*;
|
|
|
|
|
import view.CapteurView;
|
|
|
|
|
import view.ImageCtrlView;
|
|
|
|
|
import view.ThermostatView;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.net.URL;
|
|
|
|
|
import java.util.Random;
|
|
|
|
|
import java.util.ResourceBundle;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
public class Launch extends Application {
|
|
|
|
|
public static void main(String[] args) {
|
|
|
|
@ -28,11 +14,16 @@ public class Launch extends Application {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
public void start(Stage primaryStage) throws IOException, InterruptedException {
|
|
|
|
|
Capteur captorS = new Capteur(1,"Capteur Simple");
|
|
|
|
|
StrategyRandom captorS = new StrategyRandom(1,"Capteur Simple");
|
|
|
|
|
CapteurIntervalle captorI = new CapteurIntervalle(2,"Capteur Intervalle",0.0,10.0);
|
|
|
|
|
CapteurRealiste captorR = new CapteurRealiste(3,"Capteur Realiste", 5.0, 10.0);
|
|
|
|
|
CapteurCPU captorC = new CapteurCPU(4,"Capteur CPU");
|
|
|
|
|
CapteurVirtuel CapteurV = new CapteurVirtuel(5,"CapteurVirtuel");
|
|
|
|
|
CapteurVirtuel captorV = new CapteurVirtuel(5,"CapteurVirtuel");
|
|
|
|
|
|
|
|
|
|
captorV.addCapteur(captorS,1);
|
|
|
|
|
captorV.addCapteur(captorI,1);
|
|
|
|
|
captorV.addCapteur(captorC,1);
|
|
|
|
|
captorV.addCapteur(captorR,1);
|
|
|
|
|
|
|
|
|
|
// FXML NOT WORKING
|
|
|
|
|
/*Stage thermostatStage = new Stage();
|
|
|
|
@ -44,15 +35,16 @@ public class Launch extends Application {
|
|
|
|
|
Thread t = new Thread() {
|
|
|
|
|
public void run() {
|
|
|
|
|
while (true) {
|
|
|
|
|
captorS.genTemp();
|
|
|
|
|
captorI.genTemp();
|
|
|
|
|
captorR.genTemp();
|
|
|
|
|
captorC.genTemp();
|
|
|
|
|
captorV.genTemp();
|
|
|
|
|
try {
|
|
|
|
|
System.out.println(captorS.getNom() + ": " + captorS.getTemp().getValue() + " °C");
|
|
|
|
|
System.out.println(captorI.getNom() + ": " + captorI.getTemp().getValue() + " °C");
|
|
|
|
|
System.out.println(captorR.getNom() + ": " + captorR.getTemp().getValue() + " °C");
|
|
|
|
|
System.out.println(captorC.getNom() + ": " + captorC.getTemp().getValue() + " °C");
|
|
|
|
|
System.out.println(captorV.getNom() + ": " + captorV.getTemp().getValue() + " °C");
|
|
|
|
|
for (Map.Entry<CapteurAbstrait, Integer> entry : captorV.getCapteurs().entrySet()) {
|
|
|
|
|
CapteurAbstrait c = entry.getKey();
|
|
|
|
|
c.genTemp();
|
|
|
|
|
System.out.println(c.getNom() + ": " + c.getTemp().getValue() + " °C");
|
|
|
|
|
System.out.println(c.getNom() + ": " + c.getTemp().getValue() + " °C");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sleep(4000);
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|