|
|
|
@ -1,16 +1,20 @@
|
|
|
|
|
package com.example.jmacro.wjdr;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.core.thread.ThreadUtil;
|
|
|
|
|
import com.example.jmacro.wjdr.base.Legend;
|
|
|
|
|
import com.example.jmacro.wjdr.base.ViewRect;
|
|
|
|
|
import com.example.jmacro.wjdr.tool.PickLegend;
|
|
|
|
|
import com.example.jmacro.wjdr.tool.PickPoint;
|
|
|
|
|
import com.example.jmacro.wjdr.tool.PickRect;
|
|
|
|
|
import com.example.jmacro.wjdr.util.DialogUtil;
|
|
|
|
|
import com.example.jmacro.wjdr.util.TaskUtil;
|
|
|
|
|
import javafx.fxml.FXML;
|
|
|
|
|
import javafx.scene.control.Button;
|
|
|
|
|
import javafx.scene.image.Image;
|
|
|
|
|
import javafx.scene.image.ImageView;
|
|
|
|
|
|
|
|
|
|
import java.awt.*;
|
|
|
|
|
import java.util.concurrent.Semaphore;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* UI控制器
|
|
|
|
@ -30,6 +34,8 @@ public class JMainController {
|
|
|
|
|
@FXML
|
|
|
|
|
private ImageView preview;
|
|
|
|
|
|
|
|
|
|
private Semaphore semaphore = new Semaphore(1);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 采点
|
|
|
|
|
*/
|
|
|
|
@ -99,9 +105,25 @@ public class JMainController {
|
|
|
|
|
boolean stop = JMainService.stop();
|
|
|
|
|
this.start.setDisable(!stop);
|
|
|
|
|
this.stop.setDisable(stop);
|
|
|
|
|
this.preview.setImage(null);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ImageView getPreview() {
|
|
|
|
|
return preview;
|
|
|
|
|
/**
|
|
|
|
|
* 预览
|
|
|
|
|
* @param image
|
|
|
|
|
*/
|
|
|
|
|
public void preview(Image image) {
|
|
|
|
|
try {
|
|
|
|
|
if (!JMainService.getInstance().run){
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
semaphore.acquire();
|
|
|
|
|
preview.setImage(image);
|
|
|
|
|
Thread.sleep(500);
|
|
|
|
|
semaphore.release();
|
|
|
|
|
} catch (InterruptedException e) {
|
|
|
|
|
semaphore.release();
|
|
|
|
|
throw new RuntimeException(e);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|