Closedown

This commit is contained in:
root
2017-11-02 08:53:16 +01:00
parent c73f2d0968
commit ccb0d3ff80
16 changed files with 879 additions and 442 deletions

View File

@@ -82,6 +82,7 @@ public class CameraCalibrationDialog extends StandardDialog {
checkMirrorX.setSelected((config.get("mirror_x") ==null) ? Boolean.FALSE: (Boolean)config.get("mirror_x"));
checkMirrorY.setSelected((config.get("mirror_y") ==null) ? Boolean.FALSE: (Boolean)config.get("mirror_y"));
comboRotation.setSelectedIndex((config.get("rotate") == null) ? 0 :(Integer) (config.get("rotate")));
ckCalibrationEnabled.setSelected(calibration!=null);
if (calibration!=null){
spinnerRefWidth.setValue(((Number)calibration.get("reference_marker_width")).doubleValue());
spinnerRefHeight.setValue(((Number)calibration.get("reference_marker_height")).doubleValue());
@@ -221,6 +222,7 @@ public class CameraCalibrationDialog extends StandardDialog {
spinnerLeft = new javax.swing.JSpinner();
spinnerRight = new javax.swing.JSpinner();
buttonFetch = new javax.swing.JButton();
ckCalibrationEnabled = new javax.swing.JCheckBox();
jPanel2 = new javax.swing.JPanel();
checkMirrorX = new javax.swing.JCheckBox();
checkMirrorY = new javax.swing.JCheckBox();
@@ -330,6 +332,8 @@ public class CameraCalibrationDialog extends StandardDialog {
}
});
ckCalibrationEnabled.setText("Enabled");
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@@ -370,7 +374,9 @@ public class CameraCalibrationDialog extends StandardDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(spinnerAngleHor, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addGap(9, 9, 9)
.addComponent(ckCalibrationEnabled)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(buttonFetch)))
.addContainerGap())
);
@@ -405,7 +411,9 @@ public class CameraCalibrationDialog extends StandardDialog {
.addComponent(spinnerAngleVer, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(spinnerRight, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 12, Short.MAX_VALUE)
.addComponent(buttonFetch)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(buttonFetch)
.addComponent(ckCalibrationEnabled))
.addContainerGap())
);
@@ -590,7 +598,7 @@ public class CameraCalibrationDialog extends StandardDialog {
.addComponent(buttonOk)
.addComponent(buttonCancel)
.addComponent(buttonApply))
.addContainerGap(16, Short.MAX_VALUE))
.addContainerGap())
);
}// </editor-fold>//GEN-END:initComponents
@@ -642,24 +650,33 @@ public class CameraCalibrationDialog extends StandardDialog {
int x2 = Math.max(left, right);
int y1 = Math.min(top, bottom);
int y2 = Math.max(top, bottom);
if ((x1!=-1) && (x2!=-1) && (y1!=-1) && (y2!=-1)){
System.out.println("Updating " + cameraName + " configuration");
HashMap calibration = new HashMap();
System.out.println("Updating " + cameraName + " configuration");
HashMap calibration = null;
if (ckCalibrationEnabled.isSelected()){
calibration = new HashMap();
calibration.put("reference_marker", Arrays.asList(new Integer[]{x1, y1, x2, y2}));
calibration.put("reference_marker_width", width);
calibration.put("reference_marker_height", height);
calibration.put("angle_horizontal", angleHor);
calibration.put("angle_vertical", angleVer);
Map<String, Object> config = server.getConfig(cameraName);
config.put("camera_calibration", calibration);
config.put("mirror_x", checkMirrorX.isSelected());
config.put("mirror_y", checkMirrorY.isSelected());
config.put("rotate", comboRotation.getSelectedIndex());
server.setConfig(cameraName, config);
System.out.println("New config: " + config);
SwingUtils.showMessage(this, "Success", "Updated " + cameraName + " configuration");
calibration.put("angle_vertical", angleVer);
}
Map<String, Object> config = server.getConfig(cameraName);
config.put("camera_calibration", calibration);
config.put("mirror_x", checkMirrorX.isSelected());
config.put("mirror_y", checkMirrorY.isSelected());
config.put("rotate", comboRotation.getSelectedIndex());
server.setConfig(cameraName, config);
System.out.println("New config: " + config);
boolean reticle = renderer.getShowReticle();
if (reticle){
renderer.setShowReticle(false);
}
SwingUtils.showMessage(this, "Success", "Updated " + cameraName + " configuration");
if (reticle){
renderer.setShowReticle(true);
}
} catch (Exception ex) {
SwingUtils.showException(this, ex);
@@ -674,6 +691,7 @@ public class CameraCalibrationDialog extends StandardDialog {
private javax.swing.JButton buttonOk;
private javax.swing.JCheckBox checkMirrorX;
private javax.swing.JCheckBox checkMirrorY;
private javax.swing.JCheckBox ckCalibrationEnabled;
private javax.swing.JComboBox comboRotation;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;