From d5d6171547c1d7a9075a516c04dfff9afdd1001c Mon Sep 17 00:00:00 2001 From: ori agranat Date: Mon, 9 Dec 2019 22:34:35 +0200 Subject: [PATCH 1/2] added pipeline popup --- chameleon-client/src/views/Camera.vue | 55 +++++++++++++------ .../src/views/CameraViewes/ThresholdTab.vue | 6 +- .../vision/pipeline/PipelineManager.java | 3 +- .../chameleonvision/web/SocketHandler.java | 21 ++++--- 4 files changed, 55 insertions(+), 30 deletions(-) diff --git a/chameleon-client/src/views/Camera.vue b/chameleon-client/src/views/Camera.vue index 539f585b1..19ff1a24c 100644 --- a/chameleon-client/src/views/Camera.vue +++ b/chameleon-client/src/views/Camera.vue @@ -21,14 +21,13 @@ - - - + @@ -38,7 +37,7 @@ - + @@ -57,12 +56,6 @@ -
- - -
- Duplicate - Cancel + Duplicate + Cancel + + + + + + + Pipeline Name + + + + + + + + Save + Cancel @@ -179,15 +188,26 @@ this.newCameraName = ""; }, toPipelineNameChange() { - this.newPipelineName = this.pipelineList[this.currentPipelineIndex]; - this.isPipelineEdit = true; + this.newPipelineName = this.pipelineList[this.currentPipelineIndex - 1]; + this.isPipelineNameEdit = true; + this.namingDialog = true; + }, + toCreatePipeline() { + this.newPipelineName = "New Pipeline"; + this.isPipelineNameEdit = false; + this.namingDialog = true; }, savePipelineNameChange() { - this.handleInput("changePipelineName", this.newPipelineName); + if (this.isPipelineNameEdit) { + this.handleInput("changePipelineName", this.newPipelineName); + } else { + this.handleInput("addNewPipeline", this.newPipelineName); + } this.discardPipelineNameChange(); }, discardPipelineNameChange() { - this.isPipelineEdit = false; + this.namingDialog = false; + this.isPipelineNameEdit = false; this.newPipelineName = ""; }, duplicatePipeline() { @@ -227,7 +247,8 @@ newCameraName: "", cameraNameError: "", // pipeline edit variables - isPipelineEdit: false, + isPipelineNameEdit: false, + namingDialog: false, newPipelineName: "", duplicateDialog: false, anotherCamera: false, diff --git a/chameleon-client/src/views/CameraViewes/ThresholdTab.vue b/chameleon-client/src/views/CameraViewes/ThresholdTab.vue index f112da5e4..979236692 100644 --- a/chameleon-client/src/views/CameraViewes/ThresholdTab.vue +++ b/chameleon-client/src/views/CameraViewes/ThresholdTab.vue @@ -5,15 +5,15 @@ @input="handleData('saturation')"/> - + colorize Eye drop - + add Expand Selection - + remove Shrink Selection diff --git a/chameleon-server/src/main/java/com/chameleonvision/vision/pipeline/PipelineManager.java b/chameleon-server/src/main/java/com/chameleonvision/vision/pipeline/PipelineManager.java index 8e64e4c82..05f26e3e3 100644 --- a/chameleon-server/src/main/java/com/chameleonvision/vision/pipeline/PipelineManager.java +++ b/chameleon-server/src/main/java/com/chameleonvision/vision/pipeline/PipelineManager.java @@ -163,13 +163,14 @@ public class PipelineManager { savePipelineConfig(pipeline.settings); } - public void addNewPipeline(boolean is3D) { + public void addNewPipeline(boolean is3D, String piplineName) { CVPipeline newPipeline; if (!is3D) { newPipeline = new CVPipeline2d(); } else { newPipeline = new CVPipeline3d(); } + newPipeline.settings.nickname = piplineName; newPipeline.settings.index = pipelines.size(); addPipeline(newPipeline); } diff --git a/chameleon-server/src/main/java/com/chameleonvision/web/SocketHandler.java b/chameleon-server/src/main/java/com/chameleonvision/web/SocketHandler.java index d5884a293..7a2d22a4f 100644 --- a/chameleon-server/src/main/java/com/chameleonvision/web/SocketHandler.java +++ b/chameleon-server/src/main/java/com/chameleonvision/web/SocketHandler.java @@ -103,15 +103,18 @@ public class SocketHandler { sendFullSettings(); break; } + case "addNewPipeline": { +// HashMap data = (HashMap) entry.getValue(); + String pipeName = (String) entry.getValue(); + // TODO: add to UI selection for new 2d/3d + boolean is3d = false; + currentProcess.pipelineManager.addNewPipeline(is3d, pipeName); + sendFullSettings(); + VisionManager.saveCurrentCameraPipelines(); + break; + } case "command": { switch ((String) entry.getValue()) { - case "addNewPipeline": - // TODO: add to UI selection for new 2d/3d - boolean is3d = false; - currentProcess.pipelineManager.addNewPipeline(is3d); - sendFullSettings(); - VisionManager.saveCurrentCameraPipelines(); - break; case "deleteCurrentPipeline": currentProcess.pipelineManager.deleteCurrentPipeline(); sendFullSettings(); @@ -141,10 +144,10 @@ public class SocketHandler { switch (entry.getKey()) {//Pre field value set case "rotationMode": {//Create new CaptureStaticProperties with new width and height, reset crosshair calib ImageRotationMode oldRot = currentPipeline.settings.rotationMode; - ImageRotationMode newRot = ImageRotationMode.class.getEnumConstants()[(Integer)entry.getValue()]; + ImageRotationMode newRot = ImageRotationMode.class.getEnumConstants()[(Integer) entry.getValue()]; CaptureStaticProperties prop = currentCamera.getProperties().getStaticProperties(); int width, height; - if(oldRot.isRotated()!=newRot.isRotated()){ + if (oldRot.isRotated() != newRot.isRotated()) { width = prop.mode.height; height = prop.mode.width; //Creates new video mode with new width and height to create new CaptureStaticProperties and applies it From 7233fff1735bb9aacf7d970ddf286f38536d1be4 Mon Sep 17 00:00:00 2001 From: ori agranat Date: Mon, 9 Dec 2019 22:55:29 +0200 Subject: [PATCH 2/2] added regex test for camera name and pipe name --- chameleon-client/src/views/Camera.vue | 49 ++++++++++++++++++++------- 1 file changed, 37 insertions(+), 12 deletions(-) diff --git a/chameleon-client/src/views/Camera.vue b/chameleon-client/src/views/Camera.vue index 19ff1a24c..c07e33784 100644 --- a/chameleon-client/src/views/Camera.vue +++ b/chameleon-client/src/views/Camera.vue @@ -128,14 +128,16 @@ Pipeline Name - + - Save - Cancel + Save + + Cancel @@ -178,7 +180,7 @@ this.isCameraNameEdit = true; }, saveCameraNameChange() { - if (this.cameraNameError === "") { + if (this.checkCameraName === "") { this.handleInput("changeCameraName", this.newCameraName); this.discardCameraNameChange(); } @@ -198,12 +200,14 @@ this.namingDialog = true; }, savePipelineNameChange() { - if (this.isPipelineNameEdit) { - this.handleInput("changePipelineName", this.newPipelineName); - } else { - this.handleInput("addNewPipeline", this.newPipelineName); + if (this.checkPipelineName === "") { + if (this.isPipelineNameEdit) { + this.handleInput("changePipelineName", this.newPipelineName); + } else { + this.handleInput("addNewPipeline", this.newPipelineName); + } + this.discardPipelineNameChange(); } - this.discardPipelineNameChange(); }, discardPipelineNameChange() { this.namingDialog = false; @@ -262,11 +266,32 @@ }, computed: { checkCameraName() { + let re = new RegExp('^[A-Za-z0-9 _]*[A-Za-z0-9][A-Za-z0-9 _]*$'); if (this.newCameraName !== this.cameraList[this.currentCameraIndex]) { - for (let cam in this.cameraList) { - if (this.newCameraName === this.cameraList[cam]) { - return "Camera by that name already Exists" + if (re.test(this.newCameraName)) { + for (let cam in this.cameraList) { + if (this.newCameraName === this.cameraList[cam]) { + return "Camera by that name already Exists" + } } + } else { + return "Camera name can only contain letters, numbers and spaces" + } + } + return "" + }, + checkPipelineName() { + let re = new RegExp('^[A-Za-z0-9 _]*[A-Za-z0-9][A-Za-z0-9 _]*$'); + if (this.newPipelineName !== this.pipelineList[this.currentPipelineIndex - 1] || this.isPipelineNameEdit === false) { + if (re.test(this.newPipelineName)) { + for (let pipe in this.pipelineList) { + if (this.newPipelineName === this.pipelineList[pipe]) { + return "A pipeline with this name already exists" + } + } + + } else { + return "Pipeline name can only contain letters, numbers, and spaces" } } return ""