Skip to content

Commit

Permalink
[Feature] Added Camera Type to Deploy GUI (#28)
Browse files Browse the repository at this point in the history
* Passed in camera type so things aren't hard coded

* Added the option to set the camera type from the gui

* Undo those formatting changes since I'm not touchin the file

* Update LoggerDeployApplication.java

* Make this memory free why don't you
  • Loading branch information
PotatoPeeler3000 authored Nov 13, 2024
1 parent 830a107 commit 4a53f19
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 8 deletions.
15 changes: 10 additions & 5 deletions src/main/java/us/ihmc/publisher/logger/ui/CameraBean.java
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
package us.ihmc.publisher.logger.ui;

import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleIntegerProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.property.SimpleStringProperty;
import us.ihmc.robotDataLogger.CameraConfiguration;
import us.ihmc.robotDataLogger.CameraType;

public class CameraBean
{

public final ObjectProperty<CameraType> camera_type = new SimpleObjectProperty<>(CameraType.CAPTURE_CARD_MAGEWELL);
public final SimpleStringProperty camera_name = new SimpleStringProperty();
public final SimpleIntegerProperty camera_id = new SimpleIntegerProperty();
public final SimpleIntegerProperty camera_input = new SimpleIntegerProperty();
Expand All @@ -17,13 +19,17 @@ public CameraBean(byte id)
this.camera_id.set(id);
camera_name.set("");
}

public CameraBean(CameraConfiguration config)
{
camera_id.set(config.getCameraId());
camera_input.set(Integer.valueOf(config.getIdentifierAsString()));
camera_name.set(config.getNameAsString());
}

public CameraType getCamera_type()
{
return camera_type.get();
}

public String getCamera_name()
Expand All @@ -40,13 +46,12 @@ public int getCamera_input()
{
return camera_input.get();
}

public void pack(CameraConfiguration camera)
{
camera.setType(CameraType.CAPTURE_CARD);
camera.setType(getCamera_type());
camera.setName(getCamera_name());
camera.setCameraId((byte) getCamera_id());
camera.setIdentifier(String.valueOf(getCamera_input()));

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
import javafx.scene.control.TableColumn;
import javafx.scene.control.TableView;
import javafx.scene.control.TextField;
import javafx.scene.control.cell.ComboBoxTableCell;
import javafx.scene.control.cell.PropertyValueFactory;
import javafx.scene.control.cell.TextFieldTableCell;
import javafx.stage.FileChooser;
Expand Down Expand Up @@ -60,6 +61,9 @@ public class LoggerDeployController implements Initializable
@FXML
TableView<CameraBean> camera_table;

@FXML
TableColumn<CameraBean, CameraType> camera_type_column;

@FXML
TableColumn<CameraBean, String> camera_name_col;

Expand Down Expand Up @@ -127,6 +131,14 @@ public void initialize(URL location, ResourceBundle resources)

camera_table.setEditable(true);

ObservableList<CameraType> cameraOptionsList = FXCollections.observableArrayList(CameraType.values);
camera_type_column.setCellFactory(ComboBoxTableCell.forTableColumn(cameraOptionsList));
camera_type_column.setCellValueFactory(new PropertyValueFactory<CameraBean, CameraType>("camera_type"));
camera_type_column.setOnEditCommit(e ->
{
e.getRowValue().camera_type.set(e.getNewValue());
});

camera_id_col.setCellValueFactory(new PropertyValueFactory<CameraBean, Integer>("camera_id"));

camera_name_col.setCellFactory(TextFieldTableCell.forTableColumn());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,9 +114,10 @@
<children>
<TableView fx:id="camera_table" prefHeight="480.0" prefWidth="1234.0" VBox.vgrow="ALWAYS">
<columns>
<TableColumn fx:id="camera_id_col" prefWidth="244.5" text="ID"/>
<TableColumn fx:id="camera_name_col" prefWidth="318.0" text="Name"/>
<TableColumn fx:id="camera_input_col" prefWidth="193.0" text="Input Number"/>
<TableColumn fx:id="camera_type_column" prefWidth="250.0" text="Type"/>
<TableColumn fx:id="camera_id_col" prefWidth="50.0" text="ID"/>
<TableColumn fx:id="camera_name_col" prefWidth="325.0" text="Name"/>
<TableColumn fx:id="camera_input_col" prefWidth="125.0" text="Input Number"/>
</columns>
</TableView>
<HBox prefHeight="100.0" prefWidth="200.0" spacing="5.0">
Expand Down

0 comments on commit 4a53f19

Please sign in to comment.