commit 26/05/2025
Tambah Crop Setting
This commit is contained in:
@@ -144,6 +144,7 @@ public class CaptureView {
|
||||
|
||||
@FXML
|
||||
private void TakePhotos(){
|
||||
if (audioTimeline!=null) audioTimeline.stop();
|
||||
String directory = config.getPhotoDirectory();
|
||||
String prefix = RemoveSpaces(medicalRecordID.getText()) ;
|
||||
boolean has_face = Arrays.stream(have_face).anyMatch(AtomicBoolean::get);
|
||||
@@ -194,16 +195,18 @@ public class CaptureView {
|
||||
} else {
|
||||
isTakingPhoto.set(false);
|
||||
//AutoCloseAlert.show("QR Code Not Available", "", "Please scan QR before continue", 5, s -> AutoCloseAlert.show("Scan Barcode", "Silahkan Scan Barcode Anda", "Arahkan kertas barcode ke kamera", 0, null));
|
||||
if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
||||
if (AutoCloseAlert.banner_01!=null){
|
||||
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
||||
}
|
||||
}
|
||||
// if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
||||
// if (AutoCloseAlert.banner_01!=null){
|
||||
// AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
||||
// }
|
||||
// }
|
||||
clear();
|
||||
PlayFileWithoutEvent(audio_scan_barcode);
|
||||
}
|
||||
} else {
|
||||
isTakingPhoto.set(false);
|
||||
AutoCloseAlert.show("Invalid Photo Directory","Photo Directory not set", "Please set photo directory at Setting", 5, s -> AutoCloseAlert.show("Setting", "Setting", "Please set photo directory", 0, null));
|
||||
AutoCloseAlert.show("Invalid Photo Directory","Photo Directory not set", "Please set photo directory at Setting", 5, s -> AutoCloseAlert.show("Setting", "Setting", "Please set photo directory", 0, sx-> clear()));
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -480,6 +483,14 @@ public class CaptureView {
|
||||
|
||||
String[] files = prc.compressed();
|
||||
if (files.length>0){
|
||||
AutoCloseAlert.showpictures(prc.compressed(),3, (s)->{
|
||||
if (AutoCloseAlert.banner_02!=null) {
|
||||
AutoCloseAlert.showbanner(AutoCloseAlert.banner_02, 0, null);
|
||||
|
||||
UploadFiles(prc, prefix);
|
||||
if (runningTask!=null) runningTask.cancel(false);
|
||||
}
|
||||
});
|
||||
PlayFileWithEvent(audio_pengambilan_berhasil, new PlaybackStatus() {
|
||||
@Override
|
||||
public void onPlaybackStarted(String filename) {
|
||||
@@ -488,14 +499,7 @@ public class CaptureView {
|
||||
|
||||
@Override
|
||||
public void onPlaybackFinished(String filename) {
|
||||
AutoCloseAlert.showpictures(prc.compressed(),3, (s)->{
|
||||
if (AutoCloseAlert.banner_02!=null) {
|
||||
AutoCloseAlert.showbanner(AutoCloseAlert.banner_02, 0, null);
|
||||
|
||||
UploadFiles(prc, prefix);
|
||||
if (runningTask!=null) runningTask.cancel(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -561,7 +565,7 @@ public class CaptureView {
|
||||
@FXML
|
||||
public void initialize(){
|
||||
audio_posisikan_muka = ExtractResource("/posisikan_wajah.wav");
|
||||
audio_pengambilan_berhasil = ExtractResource("/pengambilan_berhasil.wav");
|
||||
audio_pengambilan_berhasil = ExtractResource("/pengambilan_berhasil_tunggu_lobby.wav");
|
||||
audio_pengambilan_gagal = ExtractResource("/pengambilan_gagal.wav");
|
||||
audio_scan_barcode = ExtractResource("/scan_barcode.wav");
|
||||
audio_upload_gagal = ExtractResource("/upload_gagal.wav");
|
||||
@@ -611,11 +615,12 @@ public class CaptureView {
|
||||
LoadCameraDetail(cam5, 5, CameraConfigEnum.CameraConfigRight90);
|
||||
|
||||
Platform.runLater(()->{
|
||||
if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
||||
if (AutoCloseAlert.banner_01!=null){
|
||||
AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
||||
}
|
||||
}
|
||||
// if (!Objects.equals(AutoCloseAlert.shownBanner, AutoCloseAlert.banner_01)){
|
||||
// if (AutoCloseAlert.banner_01!=null){
|
||||
// AutoCloseAlert.showbanner(AutoCloseAlert.banner_01,0,null);
|
||||
// }
|
||||
// }
|
||||
clear();
|
||||
|
||||
int indexleft90=-1;
|
||||
int indexleft45=-1;
|
||||
@@ -707,6 +712,8 @@ public class CaptureView {
|
||||
|
||||
}
|
||||
|
||||
Timeline audioTimeline;
|
||||
|
||||
private void clear(){
|
||||
isTakingPhoto.set(false);
|
||||
TextAreaSetText(medicalRecordID,"");
|
||||
@@ -824,7 +831,7 @@ public class CaptureView {
|
||||
|
||||
LiveCamEvent lce = new LiveCamEvent() {
|
||||
|
||||
Timeline audioTimeline;
|
||||
|
||||
|
||||
@Override
|
||||
public void onDetectedQRCode(String barCode) {
|
||||
@@ -850,71 +857,61 @@ public class CaptureView {
|
||||
|
||||
audioTimeline = new Timeline();
|
||||
final int file_duration = 8; // audio_posisikan_muka durasi 7 detik
|
||||
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(0), k1 ->{
|
||||
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(0), k1 -> PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
|
||||
@Override
|
||||
public void onPlaybackStarted(String filename) {
|
||||
anti_bawel.set(true);
|
||||
System.out.println("Peringatan pertama audio_posisikan_muka");
|
||||
}
|
||||
|
||||
PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
|
||||
@Override
|
||||
public void onPlaybackStarted(String filename) {
|
||||
anti_bawel.set(true);
|
||||
System.out.println("Peringatan pertama audio_posisikan_muka");
|
||||
}
|
||||
@Override
|
||||
public void onPlaybackFinished(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackFinished(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
@Override
|
||||
public void onPlaybackFailure(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
})));
|
||||
|
||||
@Override
|
||||
public void onPlaybackFailure(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
});
|
||||
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(file_duration+5), k2 -> PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
|
||||
|
||||
}));
|
||||
@Override
|
||||
public void onPlaybackStarted(String filename) {
|
||||
anti_bawel.set(true);
|
||||
System.out.println("Peringatan kedua audio_posisikan_muka");
|
||||
}
|
||||
|
||||
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(file_duration+5), k2 -> {
|
||||
PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
|
||||
@Override
|
||||
public void onPlaybackFinished(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackStarted(String filename) {
|
||||
anti_bawel.set(true);
|
||||
System.out.println("Peringatan kedua audio_posisikan_muka");
|
||||
}
|
||||
@Override
|
||||
public void onPlaybackFailure(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
})));
|
||||
|
||||
@Override
|
||||
public void onPlaybackFinished(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(3*file_duration+5), k3 -> PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
|
||||
|
||||
@Override
|
||||
public void onPlaybackFailure(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
});
|
||||
}));
|
||||
@Override
|
||||
public void onPlaybackStarted(String filename) {
|
||||
anti_bawel.set(true);
|
||||
System.out.println("Peringatan ketiga audio_posisikan_muka");
|
||||
}
|
||||
|
||||
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(3*file_duration+5), k3 -> {
|
||||
@Override
|
||||
public void onPlaybackFinished(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
|
||||
PlayFileWithEvent(audio_posisikan_muka, new PlaybackStatus() {
|
||||
|
||||
@Override
|
||||
public void onPlaybackStarted(String filename) {
|
||||
anti_bawel.set(true);
|
||||
System.out.println("Peringatan ketiga audio_posisikan_muka");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackFinished(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlaybackFailure(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
});
|
||||
|
||||
}));
|
||||
@Override
|
||||
public void onPlaybackFailure(String filename) {
|
||||
anti_bawel.set(false);
|
||||
}
|
||||
})));
|
||||
audioTimeline.getKeyFrames().add(new KeyFrame(Duration.seconds(5*file_duration+5), k4 ->{
|
||||
PlayFileWithEvent(audio_hubungi_staf_kami, new PlaybackStatus() {
|
||||
@Override
|
||||
@@ -980,7 +977,7 @@ public class CaptureView {
|
||||
TextAreaSetText(PatientName, pr.name);
|
||||
|
||||
if (anti_bawel.get()) return; // sudah ada LiveCamEvent lain yang bunyiin, jadi tidak usah bunyiin lagi
|
||||
if (audioTimeline!=null) audioTimeline.play();
|
||||
if (audioTimeline!=null) audioTimeline.playFromStart();
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -30,11 +30,11 @@ public class MainApplication extends Application {
|
||||
Runtime.getRuntime().addShutdownHook(new Thread(() -> {
|
||||
if (photoCleaner!=null) photoCleaner.Stop();
|
||||
System.out.println("ShutdownHook Checking running threads...");
|
||||
Map<Thread, StackTraceElement[]> allThreads = Thread.getAllStackTraces();
|
||||
for(Thread thread : allThreads.keySet()){
|
||||
System.out.println("Thread: " + thread.getName()+", State: " + thread.getState()+", Daemon: " + thread.isDaemon());
|
||||
thread.interrupt();
|
||||
}
|
||||
// Map<Thread, StackTraceElement[]> allThreads = Thread.getAllStackTraces();
|
||||
// for(Thread thread : allThreads.keySet()){
|
||||
// System.out.println("Thread: " + thread.getName()+", State: " + thread.getState()+", Daemon: " + thread.isDaemon());
|
||||
// thread.interrupt();
|
||||
// }
|
||||
}));
|
||||
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MainApplication extends Application {
|
||||
Screen screen = Screen.getPrimary();
|
||||
Rectangle2D screenbound = screen.getBounds();
|
||||
Scene scene = new Scene(fxmlLoader.load(), screenbound.getWidth(), screenbound.getHeight());
|
||||
stage.setTitle("MultiCam Capture App for ERHA 22052025-004");
|
||||
stage.setTitle("MultiCam Capture App for ERHA 26052025-001");
|
||||
stage.setScene(scene);
|
||||
stage.setResizable(true);
|
||||
stage.setMaximized(true);
|
||||
|
||||
@@ -49,6 +49,137 @@ public class SettingView {
|
||||
@FXML
|
||||
private CheckBox FlipCamera;
|
||||
|
||||
@FXML
|
||||
private TextField Cam1TopCrop;
|
||||
@FXML
|
||||
private TextField Cam1BottomCrop;
|
||||
@FXML
|
||||
private TextField Cam1LeftCrop;
|
||||
@FXML
|
||||
private TextField Cam1RightCrop;
|
||||
|
||||
@FXML
|
||||
private TextField Cam2TopCrop;
|
||||
@FXML
|
||||
private TextField Cam2BottomCrop;
|
||||
@FXML
|
||||
private TextField Cam2LeftCrop;
|
||||
@FXML
|
||||
private TextField Cam2RightCrop;
|
||||
|
||||
@FXML
|
||||
private TextField Cam3TopCrop;
|
||||
@FXML
|
||||
private TextField Cam3BottomCrop;
|
||||
@FXML
|
||||
private TextField Cam3LeftCrop;
|
||||
@FXML
|
||||
private TextField Cam3RightCrop;
|
||||
|
||||
@FXML
|
||||
private TextField Cam4TopCrop;
|
||||
@FXML
|
||||
private TextField Cam4BottomCrop;
|
||||
@FXML
|
||||
private TextField Cam4LeftCrop;
|
||||
@FXML
|
||||
private TextField Cam4RightCrop;
|
||||
|
||||
@FXML
|
||||
private TextField Cam5TopCrop;
|
||||
@FXML
|
||||
private TextField Cam5BottomCrop;
|
||||
@FXML
|
||||
private TextField Cam5LeftCrop;
|
||||
@FXML
|
||||
private TextField Cam5RightCrop;
|
||||
|
||||
@FXML
|
||||
private void ApplyCropClick(){
|
||||
// Apply crop settings for each camera
|
||||
boolean[] all_correct = {true};
|
||||
|
||||
CheckTextField(Cam1TopCrop,all_correct);
|
||||
CheckTextField(Cam1BottomCrop,all_correct);
|
||||
CheckTextField(Cam1LeftCrop,all_correct);
|
||||
CheckTextField(Cam1RightCrop,all_correct);
|
||||
CheckTextField(Cam2TopCrop,all_correct);
|
||||
CheckTextField(Cam2BottomCrop,all_correct);
|
||||
CheckTextField(Cam2LeftCrop,all_correct);
|
||||
CheckTextField(Cam2RightCrop,all_correct);
|
||||
CheckTextField(Cam3TopCrop,all_correct);
|
||||
CheckTextField(Cam3BottomCrop,all_correct);
|
||||
CheckTextField(Cam3LeftCrop,all_correct);
|
||||
CheckTextField(Cam3RightCrop,all_correct);
|
||||
CheckTextField(Cam4TopCrop,all_correct);
|
||||
CheckTextField(Cam4BottomCrop,all_correct);
|
||||
CheckTextField(Cam4LeftCrop,all_correct);
|
||||
CheckTextField(Cam4RightCrop,all_correct);
|
||||
CheckTextField(Cam5TopCrop,all_correct);
|
||||
CheckTextField(Cam5BottomCrop,all_correct);
|
||||
CheckTextField(Cam5LeftCrop,all_correct);
|
||||
CheckTextField(Cam5RightCrop,all_correct);
|
||||
|
||||
if (all_correct[0]){
|
||||
config.setCam1TopCrop(Cam1TopCrop.getText());
|
||||
config.setCam1BottomCrop(Cam1BottomCrop.getText());
|
||||
config.setCam1LeftCrop(Cam1LeftCrop.getText());
|
||||
config.setCam1RightCrop(Cam1RightCrop.getText());
|
||||
config.setCam2TopCrop(Cam2TopCrop.getText());
|
||||
config.setCam2BottomCrop(Cam2BottomCrop.getText());
|
||||
config.setCam2LeftCrop(Cam2LeftCrop.getText());
|
||||
config.setCam2RightCrop(Cam2RightCrop.getText());
|
||||
config.setCam3TopCrop(Cam3TopCrop.getText());
|
||||
config.setCam3BottomCrop(Cam3BottomCrop.getText());
|
||||
config.setCam3LeftCrop(Cam3LeftCrop.getText());
|
||||
config.setCam3RightCrop(Cam3RightCrop.getText());
|
||||
config.setCam4TopCrop(Cam4TopCrop.getText());
|
||||
config.setCam4BottomCrop(Cam4BottomCrop.getText());
|
||||
config.setCam4LeftCrop(Cam4LeftCrop.getText());
|
||||
config.setCam4RightCrop(Cam4RightCrop.getText());
|
||||
config.setCam5TopCrop(Cam5TopCrop.getText());
|
||||
config.setCam5BottomCrop(Cam5BottomCrop.getText());
|
||||
config.setCam5LeftCrop(Cam5LeftCrop.getText());
|
||||
config.setCam5RightCrop(Cam5RightCrop.getText());
|
||||
|
||||
config.Save();
|
||||
} else {
|
||||
ShowAlert(Alert.AlertType.ERROR, "Crop Setting Error", "Crop Setting Error", "Please check your crop settings, some values are invalid");
|
||||
}
|
||||
}
|
||||
|
||||
private void CheckTextField(TextField tf, boolean[] value){
|
||||
if (ValidCropValue(tf)){
|
||||
tf.setStyle("");
|
||||
} else {
|
||||
tf.setStyle("-fx-border-color: red;");
|
||||
value[0] = false;
|
||||
}
|
||||
}
|
||||
|
||||
private boolean ValidCropValue(TextField tf){
|
||||
if (tf != null){
|
||||
double value;
|
||||
String name = tf.getId();
|
||||
try {
|
||||
value = Double.parseDouble(tf.getText());
|
||||
if (value >= 0.0){
|
||||
if (name.contains("Top")){
|
||||
return value <= config.getTopcropmax();
|
||||
} else if (name.contains("Bottom")){
|
||||
return value <= config.getBottomcropmax();
|
||||
} else if (name.contains("Left")){
|
||||
return value <= config.getLeftcropmax();
|
||||
} else if (name.contains("Right")){
|
||||
return value <= config.getRightcropmax();
|
||||
}
|
||||
}
|
||||
} catch (NumberFormatException ignored) {
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
final FileChooser jfc = new FileChooser();
|
||||
@@ -200,6 +331,27 @@ public class SettingView {
|
||||
FlipCamera.setSelected(config.isFlipCamera());
|
||||
|
||||
TextFieldSetText(Sharpness,String.valueOf(config.getSharpnessThreshold()));
|
||||
TextFieldSetText(Cam1TopCrop,String.valueOf(config.getCam1TopCrop()));
|
||||
TextFieldSetText(Cam1BottomCrop,String.valueOf(config.getCam1BottomCrop()));
|
||||
TextFieldSetText(Cam1LeftCrop,String.valueOf(config.getCam1LeftCrop()));
|
||||
TextFieldSetText(Cam1RightCrop,String.valueOf(config.getCam1RightCrop()));
|
||||
TextFieldSetText(Cam2TopCrop,String.valueOf(config.getCam2TopCrop()));
|
||||
TextFieldSetText(Cam2BottomCrop,String.valueOf(config.getCam2BottomCrop()));
|
||||
TextFieldSetText(Cam2LeftCrop,String.valueOf(config.getCam2LeftCrop()));
|
||||
TextFieldSetText(Cam2RightCrop,String.valueOf(config.getCam2RightCrop()));
|
||||
TextFieldSetText(Cam3TopCrop,String.valueOf(config.getCam3TopCrop()));
|
||||
TextFieldSetText(Cam3BottomCrop,String.valueOf(config.getCam3BottomCrop()));
|
||||
TextFieldSetText(Cam3LeftCrop,String.valueOf(config.getCam3LeftCrop()));
|
||||
TextFieldSetText(Cam3RightCrop,String.valueOf(config.getCam3RightCrop()));
|
||||
TextFieldSetText(Cam4TopCrop,String.valueOf(config.getCam4TopCrop()));
|
||||
TextFieldSetText(Cam4BottomCrop,String.valueOf(config.getCam4BottomCrop()));
|
||||
TextFieldSetText(Cam4LeftCrop,String.valueOf(config.getCam4LeftCrop()));
|
||||
TextFieldSetText(Cam4RightCrop,String.valueOf(config.getCam4RightCrop()));
|
||||
TextFieldSetText(Cam5TopCrop,String.valueOf(config.getCam5TopCrop()));
|
||||
TextFieldSetText(Cam5BottomCrop,String.valueOf(config.getCam5BottomCrop()));
|
||||
TextFieldSetText(Cam5LeftCrop,String.valueOf(config.getCam5LeftCrop()));
|
||||
TextFieldSetText(Cam5RightCrop,String.valueOf(config.getCam5RightCrop()));
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user