Search in sources :

Example 1 with SensorData

use of il.ac.technion.cs.smarthouse.simulator.model.SensorData in project Smartcity-Smarthouse by TechnionYP5777.

the class RoomViewController method addSensor.

private void addSensor(final double x, final double y) {
    final TextInputDialog dialog = new TextInputDialog("sensor name");
    dialog.setGraphic(new ImageView(new Image(getClass().getResourceAsStream("Homeicon.png"))));
    dialog.setTitle("Create Sensor");
    dialog.setHeaderText("Config your simulator");
    dialog.setContentText("Please enter sensor name:");
    final Optional<String> result = dialog.showAndWait();
    if (!result.isPresent())
        return;
    final String name = result.get();
    final SensorLabel label = new SensorLabel(x, y, name);
    final SensorData sensor = new SensorData(name, label, location);
    mainController.addSensor(sensor);
    RoomViewController.this.labels.add(label);
    pane.getChildren().add(label);
}
Also used : SensorData(il.ac.technion.cs.smarthouse.simulator.model.SensorData) ImageView(javafx.scene.image.ImageView) Image(javafx.scene.image.Image) TextInputDialog(javafx.scene.control.TextInputDialog)

Aggregations

SensorData (il.ac.technion.cs.smarthouse.simulator.model.SensorData)1 TextInputDialog (javafx.scene.control.TextInputDialog)1 Image (javafx.scene.image.Image)1 ImageView (javafx.scene.image.ImageView)1