ScreenPanel

This commit is contained in:
voulot_d
2017-06-08 09:02:03 +02:00
parent d2155f810c
commit e0bf701e24
4 changed files with 56 additions and 47 deletions

View File

@@ -1282,25 +1282,40 @@ public class ScreenPanel extends Panel {
Overlay ov = uo.obj;
//Overlay ov = (Overlay)uo.cls.newInstance();
ov.setCalibration(renderer.getCalibration());
boolean valid = false;
if (ov instanceof Overlays.Polyline) {
double[] x = (uo.channels[0].equals("null")) ? null : getCamtoolDoubleArray(uo.channels[0]);
double[] y = (uo.channels[1].equals("null")) ? null : getCamtoolDoubleArray(uo.channels[1]);
if (x == null) {
x = (renderer.getCalibration() == null) ? Arr.indexesDouble(y.length) : renderer.getCalibration().getAxisX(y.length);
if ((x != null) || (y !=null)) {
if (x == null) {
x = (renderer.getCalibration() == null) ? Arr.indexesDouble(y.length) : renderer.getCalibration().getAxisX(y.length);
}
if (y == null) {
y = (renderer.getCalibration() == null) ? Arr.indexesDouble(x.length) : renderer.getCalibration().getAxisY(x.length);
}
((Overlays.Polyline) ov).updateAbsolute(x, y);
valid = true;
}
if (y == null) {
y = (renderer.getCalibration() == null) ? Arr.indexesDouble(x.length) : renderer.getCalibration().getAxisY(x.length);
}
((Overlays.Polyline) ov).updateAbsolute(x, y);
} else {
PointDouble position = new PointDouble(getCamtoolDouble(uo.channels[0]), getCamtoolDouble(uo.channels[1]));
ov.setAbsolutePosition(position);
if (!(ov instanceof Overlays.Crosshairs)) {
DimensionDouble size = new DimensionDouble(getCamtoolDouble(uo.channels[2]) - position.x, getCamtoolDouble(uo.channels[3]) - position.y);
ov.setAbsoluteSize(size);
Double x = getCamtoolDouble(uo.channels[0]); Double y = getCamtoolDouble(uo.channels[1]);
if ((x != null) && (y !=null)) {
PointDouble position = new PointDouble(x,y);
ov.setAbsolutePosition(position);
if (!(ov instanceof Overlays.Crosshairs)) {
Double x2 = getCamtoolDouble(uo.channels[2]); Double y2 = getCamtoolDouble(uo.channels[3]);
if ((x != null) && (y !=null)) {
DimensionDouble size = new DimensionDouble(x2 - position.x, y2 - position.y);
ov.setAbsoluteSize(size);
valid = true;
}
} else {
valid = true;
}
}
}
ret.add(ov);
if (valid){
ret.add(ov);
}
} catch (Exception ex) {
ex.printStackTrace();
}