-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathStreamerSettingsPane.java
More file actions
752 lines (583 loc) · 22.6 KB
/
StreamerSettingsPane.java
File metadata and controls
752 lines (583 loc) · 22.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
package Array.layoutFX;
import org.controlsfx.control.PopOver;
import Array.HydrophoneLocator;
import Array.HydrophoneLocators;
import Array.PamArray;
import Array.Streamer;
import Array.sensors.ArrayParameterType;
import Array.sensors.ArraySensorFieldType;
import Array.streamerOrigin.HydrophoneOriginMethod;
import Array.streamerOrigin.HydrophoneOriginMethods;
import Array.streamerOrigin.HydrophoneOriginSystem;
import Array.streamerOrigin.OriginDialogComponent;
import Array.streamerOrigin.OriginSettings;
import PamController.PamController;
import PamController.SettingsPane;
import PamUtils.LatLong;
import PamguardMVC.PamDataBlock;
import javafx.geometry.Pos;
import javafx.scene.Node;
import pamViewFX.PamGuiManagerFX;
import pamViewFX.fxGlyphs.PamGlyphDude;
import pamViewFX.fxNodes.PamBorderPane;
import pamViewFX.fxNodes.PamButton;
import pamViewFX.fxNodes.PamGridPane;
import pamViewFX.fxNodes.PamHBox;
import pamViewFX.fxNodes.PamVBox;
import pamViewFX.validator.PamValidator;
import javafx.scene.control.ComboBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.ColumnConstraints;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Pane;
import javafx.scene.layout.Priority;
import javafx.scene.layout.Region;
import net.synedra.validatorfx.Validator;
/**
* A JavaFX settings pane for a streamer.
*
* @author Jamie Macaulay
*
*/
public class StreamerSettingsPane extends SettingsPane<Streamer> {
private final static double MAX_TEXTFIELD_WIDTH = 80;
public PamBorderPane mainPane;
/**
* Combo Box which shows which origin methods are available.
*/
private ComboBox<HydrophoneOriginSystem> originMethod;
/**
* The origin pane;
*/
private PamBorderPane originPane;
/**
* The default streamer
*/
public Streamer defaultStreamer;
/**
* The current array
*/
private PamArray currentArray;
/**
* The current origin methods
*/
private HydrophoneOriginMethod currentOriginMethod;
/*
* The current origin method pane.
*/
private Pane currentOriginComponent;
/**
* Interpolation panel
*/
private InterpChoicePane interpPane;
private TextField xPos;
private Validator validator = new PamValidator();
private TextField yPos;
private TextField zPos;
private TextField zPosErr;
private TextField xPosErr;
private Label depthLabel;
private TextField yPosErr;
private Label depthLabel2;
private TextField heading;
private TextField roll;
private TextField pitch;
private ComboBox localiserMethod;
private SensorSourcePane[] sensorComponents;
private Label depthSensorLabel;
/**
* Button for extra origin parameters.
*/
private PamButton originButton;
public StreamerSettingsPane() {
super(null);
mainPane = new PamBorderPane();
mainPane.setCenter(getStreamerPane());
}
/**
* Create the streamer pane
* @return get the pane.
*/
private Pane getStreamerPane(){
String reciever = PamController.getInstance().getGlobalMediumManager().getRecieverString();
Label label = new Label("Geo-reference Position");
PamGuiManagerFX.titleFont2style(label);
//holds advanced setings for new origin methods.
originPane = new PamBorderPane();
PopOver popOver = new PopOver();
popOver.setContentNode(originPane);
originMethod = new ComboBox<HydrophoneOriginSystem>();
originButton = new PamButton();
originButton.setGraphic(PamGlyphDude.createPamIcon("mdi2c-crosshairs-gps"));
originButton.setOnAction((a)->{
popOver.show(originButton);
});
originMethod.setMaxWidth(Double.MAX_VALUE);
PamHBox originHolder = new PamHBox();
originHolder.setSpacing(5);
originHolder.setAlignment(Pos.CENTER_LEFT);
originHolder.getChildren().addAll(originMethod,originButton);
originHolder.setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(originMethod, Priority.ALWAYS);
int n = HydrophoneOriginMethods.getInstance().getCount();
for (int i = 0; i < n; i++) {
originMethod.getItems().add(HydrophoneOriginMethods.getInstance().getMethod(i));
}
Label hydroMovementLabel = new Label(reciever +" Movement Model");
//listener for when a new origin method is called.
originMethod.setOnAction((action)->{
newOriginMethod();
});
interpPane = new InterpChoicePane();
Label inteprlabel = new Label("Interpolation");
PamGuiManagerFX.titleFont2style(inteprlabel);
PamHBox interpBox = new PamHBox();
interpBox.setSpacing(5);
Label interpMethodLabel = new Label("Method");
Region spacer = new Region();
spacer.prefWidthProperty().bind(originButton.widthProperty());
interpBox.getChildren().addAll(interpMethodLabel, interpPane, spacer);
interpBox.setAlignment(Pos.CENTER_LEFT);
interpBox.setMaxWidth(Double.MAX_VALUE);
interpPane.setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(interpPane, Priority.ALWAYS);
//add all stuff to the holder
PamVBox holder = new PamVBox();
holder.getChildren().addAll(label, originHolder, hydroMovementLabel, createLocatorPane(), inteprlabel, interpBox);
holder.setSpacing(5);
return holder;
}
/**
* Create the locator pane.
* @return the pane containing controls.
*/
public Pane createLocatorPane() {
localiserMethod = new ComboBox<>();
int n = HydrophoneLocators.getInstance().getCount();
for (int i = 0; i < n; i++) {
localiserMethod.getItems().add(HydrophoneLocators.getInstance().getSystem(i));
}
localiserMethod.setMaxWidth(Double.MAX_VALUE);
PamHBox loclaiserMethodHolder = new PamHBox();
loclaiserMethodHolder.setSpacing(5);
loclaiserMethodHolder.setAlignment(Pos.CENTER_LEFT);
Label spacer = new Label();
spacer.prefWidthProperty().bind(originButton.widthProperty());
loclaiserMethodHolder.getChildren().addAll(localiserMethod, spacer);
loclaiserMethodHolder.setMaxWidth(Double.MAX_VALUE);
HBox.setHgrow(localiserMethod, Priority.ALWAYS);
//hydrophone position and
PamGridPane positionPane = new PamGridPane();
positionPane.setHgap(5);
positionPane.setVgap(5);
ColumnConstraints rc = new ColumnConstraints(Region.USE_COMPUTED_SIZE, Region.USE_COMPUTED_SIZE, MAX_TEXTFIELD_WIDTH);
//Orientation pane.
//create data sources for sensors.
ArraySensorFieldType[] sensorFields = ArraySensorFieldType.values();
sensorComponents = new SensorSourcePane[sensorFields.length];
//EnableOrientation eo = new EnableOrientation();
for (int i = 0; i < sensorFields.length; i++) {
sensorComponents[i] = new SensorSourcePane(sensorFields[i], true, sensorFields[i] != ArraySensorFieldType.HEIGHT);
sensorComponents[i].setOnAction((e)->{
enableOrientationPane();
});
}
PamButton button = new PamButton("Sensors");
button.setGraphic(PamGlyphDude.createPamIcon("mdi2c-compass-outline", PamGuiManagerFX.iconSize));
PopOver popOver = new PopOver(createSensorPane());
popOver.setDetachable(true);
button.setOnAction((a)->{
popOver.show(button);
});
//this sets all text fields to the correct width - but of naff hack but what grid pane needs to work.
for (int i=1; i<5; i++) {
positionPane.getColumnConstraints().add(rc);
}
xPos=new TextField();
xPos.setMaxWidth(MAX_TEXTFIELD_WIDTH);
HydrophoneSettingsPane.addTextValidator(xPos, "x position", validator);
yPos=new TextField();
yPos.setMaxWidth(MAX_TEXTFIELD_WIDTH);
HydrophoneSettingsPane.addTextValidator(yPos, "y position", validator);
zPos=new TextField();
zPos.setMaxWidth(MAX_TEXTFIELD_WIDTH);
HydrophoneSettingsPane.addTextValidator(zPos, "z position", validator);
depthLabel = new Label("Depth");
depthLabel.setAlignment(Pos.CENTER);
depthSensorLabel = new Label("Depth Sensor");
depthSensorLabel.setAlignment(Pos.CENTER);
xPosErr=new TextField();
xPosErr.setMaxWidth(MAX_TEXTFIELD_WIDTH);
HydrophoneSettingsPane.addTextValidator(xPosErr, "x error", validator);
yPosErr=new TextField();
yPosErr.setMaxWidth(MAX_TEXTFIELD_WIDTH);
HydrophoneSettingsPane.addTextValidator(yPosErr, "y error", validator);
zPosErr=new TextField();
zPosErr.setMaxWidth(MAX_TEXTFIELD_WIDTH);
depthLabel2 = new Label(""); //changes with air or water mode.
depthLabel2.setAlignment(Pos.CENTER);
HydrophoneSettingsPane.addTextValidator(zPosErr, "z error", validator);
int col=0;
int row=0;
Label xLabel = new Label("x");
xLabel.setAlignment(Pos.CENTER);
Label yLabel = new Label("y");
yLabel.setAlignment(Pos.CENTER);
//Orientations
String degsLab = LatLong.deg + " ";
col=1;
positionPane.add(xLabel, col++, row);
positionPane.add(yLabel, col++, row);
positionPane.add(depthLabel, col++, row);
col++;
positionPane.add(depthSensorLabel, col++, row);
col=0;
row++;
Label positionLabel = new Label("Position");
positionPane.add(positionLabel, col++, row);
positionPane.add(xPos, col++, row);
positionPane.add(yPos, col++, row);
positionPane.add(zPos, col++, row);
positionPane.add(new Label("(m)"), col++, row);
positionPane.add(sensorComponents[ArraySensorFieldType.HEIGHT.ordinal()].getPane(), col++, row);
col=0;
row++;
Label errLabel = new Label("Error");
positionPane.add(errLabel, col++, row);
positionPane.add(xPosErr, col++, row);
positionPane.add(yPosErr, col++, row);
positionPane.add(zPosErr, col++, row);
positionPane.add(new Label("(m)"), col++, row);
//Orientation
col=1;
row++;
Label headingLabel = new Label("Heading");
headingLabel.setAlignment(Pos.CENTER);
Label pitchLabel = new Label("Pitch");
pitchLabel.setAlignment(Pos.CENTER);
Label rolllabel = new Label("Roll");
rolllabel.setAlignment(Pos.CENTER);
positionPane.add(headingLabel, col++, row);
positionPane.add(pitchLabel, col++, row);
positionPane.add(rolllabel, col++, row);
row++;
heading = new TextField();
heading.setMaxWidth(MAX_TEXTFIELD_WIDTH);
HydrophoneSettingsPane.addTextValidator(heading, "heading", validator);
pitch = new TextField();
pitch.setMaxWidth(MAX_TEXTFIELD_WIDTH);
HydrophoneSettingsPane.addTextValidator(pitch, "pitch", validator);
roll = new TextField();
roll.setMaxWidth(MAX_TEXTFIELD_WIDTH);
HydrophoneSettingsPane.addTextValidator(roll, "roll", validator);
col=0;
Label orientation = new Label("Orientation");
positionPane.add(orientation, col++, row);
positionPane.add(heading, col++, row);
positionPane.add(pitch, col++, row);
positionPane.add(roll, col++, row);
positionPane.add(new Label(degsLab), col++, row);
positionPane.add(button, col++, row);
PamVBox holder= new PamVBox();
holder.setSpacing(5);
holder.getChildren().addAll(loclaiserMethodHolder, positionPane);
return holder;
}
/**
* Enables or disables controls in the orientation pane.
*/
private void enableOrientationPane() {
for (int i=0; i<sensorComponents.length; i++) {
if (sensorComponents[i]==null || sensorComponents[i].getParameterType()==null) continue;
boolean enable = sensorComponents[i].getParameterType().equals(ArrayParameterType.FIXED);
switch (sensorComponents[i].getSensorType()) {
case HEADING:
heading.setDisable(!enable);
break;
case HEIGHT:
break;
case PITCH:
pitch.setDisable(!enable);
break;
case ROLL:
roll.setDisable(!enable);
break;
default:
break;
}
}
}
/**
* Create a pane to set where sensor data comes from
* @return the sensor pane.
*/
private Pane createSensorPane() {
PamBorderPane pane = new PamBorderPane();
//hydrophone position and
PamGridPane positionPane = new PamGridPane();
positionPane.setHgap(5);
positionPane.setVgap(5);
int col=0;
int row=0;
positionPane.add(new Label("Heading"), col++, row);
positionPane.add(sensorComponents[ArraySensorFieldType.HEADING.ordinal()].getPane(), col++, row);
row++;
col=0;
positionPane.add(new Label("Pitch"), col++, row);
positionPane.add(sensorComponents[ArraySensorFieldType.PITCH.ordinal()].getPane(), col++, row);
row++;
col=0;
positionPane.add(new Label("Roll"), col++, row);
positionPane.add(sensorComponents[ArraySensorFieldType.ROLL.ordinal()].getPane(), col++, row);
Label orientLabel = new Label("Orientation Data");
PamGuiManagerFX.titleFont2style(orientLabel);
pane.setTop(orientLabel);
pane.setCenter(positionPane);
return pane;
}
/**
* Create a new origin method.
*/
public void newOriginMethod() {
int methInd = originMethod.getSelectionModel().getSelectedIndex();
if (methInd < 0) {
return;
}
HydrophoneOriginSystem currentSystem = HydrophoneOriginMethods.getInstance().getMethod(this.originMethod.getSelectionModel().getSelectedIndex());
currentOriginMethod = currentSystem.createMethod(currentArray, defaultStreamer);
try {
OriginSettings os = defaultStreamer.getOriginSettings(currentOriginMethod.getClass());
if (os != null) {
currentOriginMethod.setOriginSettings(os);
}
}
catch (Exception e) {
// will throw if it tries to set the wrong type of settings.
e.printStackTrace();
}
OriginDialogComponent mthDialogComponent = currentOriginMethod.getDialogComponent();
if (mthDialogComponent == null) {
originPane.getChildren().clear();
currentOriginComponent = null;
this.originButton.setDisable(true);
}
else {
this.originButton.setDisable(false);
Pane newComponent = mthDialogComponent.getSettingsPane();
if (currentOriginComponent != newComponent) {
originPane.setCenter(newComponent);
currentOriginComponent = newComponent;
mthDialogComponent.setParams();
}
}
enableControls();
}
private void enableControls() {
if (currentOriginMethod != null) {
System.out.println("Enable: selected interp: " + interpPane.getSelectedInterpType());
interpPane.setAllowedValues(currentOriginMethod.getAllowedInterpolationMethods());
System.out.println("Enable controls: " + interpPane.getSelectedInterpType());
if (interpPane.getSelectedInterpType()<0) {
interpPane.setSelection(0);
}
}
enableOrientationPane();
}
@Override
public Streamer getParams(Streamer currParams) {
// System.out.println("GETPARAMS: " + currParams);
double zCoeff = PamController.getInstance().getGlobalMediumManager().getZCoeff();
try {
defaultStreamer.setX(Double.valueOf(xPos.getText()));
defaultStreamer.setY(Double.valueOf(yPos.getText()));
defaultStreamer.setZ(zCoeff*Double.valueOf(zPos.getText()));
defaultStreamer.setDx(Double.valueOf(xPosErr.getText()));
defaultStreamer.setDy(Double.valueOf(yPosErr.getText()));
defaultStreamer.setDz(Double.valueOf(zPosErr.getText()));
}
catch (NumberFormatException e) {
System.err.println("Streamer getParams: There is a problem with one of the position parameters in the streamer panel");
return null;
}
defaultStreamer.setStreamerName(currParams.getStreamerName());
int im = interpPane.getSelectedInterpType();
System.out.println("Streamer gwetParams: Origin interpolator: " + interpPane.getSelectedInterpType());
if (im < 0) {
System.err.println("Streamer getParams: There is an index problem with the interpolation selection streamer panel: index = " + im);
}
currentArray.setOriginInterpolation(im);
// try {
// streamer.setBuoyId1(Integer.valueOf(buoyId.getText()));
// }
// catch (NumberFormatException e) {
// streamer.setBuoyId1(null);
// }
HydrophoneLocator locator = HydrophoneLocators.getInstance().
getSystem(localiserMethod.getSelectionModel().getSelectedIndex()).getLocator(currentArray, defaultStreamer);
if (originPane != null) {
// MasterLocator masterLocator = currentArray.getMasterLocator();
// int streamerIndex = currentArray.indexOfStreamer(streamer);
// if (streamerIndex < 0) {
// streamerIndex = currentArray.getNumStreamers();
// }
// masterLocator.setHydrophoneLocator(streamerIndex, locator);
if (currentOriginMethod == null) {
System.err.println("Streamer getParams: No hydrophoneorigin method selected in streamer panel");
}
}
OriginDialogComponent mthDialogComponent = currentOriginMethod.getDialogComponent();
if (mthDialogComponent != null) {
if (mthDialogComponent.getParams() == false) {
System.err.println("Streamer: The origin settings pane returned false suggesting paramters are not correct.");
return null;
}
}
// defaultStreamer.setEnableOrientation(enableOrientation.isSelected());
// if (enableOrientation.isSelected()) {
defaultStreamer.setHeading(getDoubleValue(heading));
defaultStreamer.setPitch(getDoubleValue(pitch));
defaultStreamer.setRoll(getDoubleValue(roll));
// }
if (!heading.isDisable() && defaultStreamer.getHeading() == null) {
System.err.println("Streamer getParams: You must enter a fixed value for the streamer heading");
}
if (!pitch.isDisable() && defaultStreamer.getPitch() == null) {
System.err.println("Streamer getParams: You must enter a fixed value for the streamer pitch");
}
if (!roll.isDisable() && defaultStreamer.getRoll() == null) {
System.err.println("Streamer getParams: You must enter a fixed value for the streamer roll");
}
/**
* We may have large lists of the streamers which we meant to use the
* orientation data from or not. The enable orientation check box will enable or
* disable orientation for ALL streamers which are loaded into memory.
*/
// System.out.println("CURRENTORIGINMETHOD: " + currentOriginMethod);
// System.out.println("LOCATORMETHOD: " + locator);
defaultStreamer.setHydrophoneOrigin(currentOriginMethod);
defaultStreamer.setHydrophoneLocator(locator);
defaultStreamer.setOriginSettings(currentOriginMethod.getOriginSettings());
defaultStreamer.setLocatorSettings(locator.getLocatorSettings());
ArraySensorFieldType[] sensorFields = ArraySensorFieldType.values();
for (int i = 0; i < sensorFields.length; i++) {
ArrayParameterType fieldType = sensorComponents[i].getParameterType();
defaultStreamer.setOrientationTypes(sensorFields[i], fieldType);
if (fieldType == ArrayParameterType.SENSOR) {
PamDataBlock dataBlock = sensorComponents[i].getDataBlock();
defaultStreamer.setSensorDataBlocks(sensorFields[i], dataBlock == null ? null : dataBlock.getLongDataName());
}
}
return defaultStreamer;
}
@Override
public void setParams(Streamer input) {
if (input==null) {
System.out.print("Streamer setParams: The input streamer is null");
}
this.defaultStreamer=input;
// origin methods
// MasterLocator masterLocator = currentArray.getMasterLocator();
// int streamerIndex = currentArray.indexOfStreamer(streamer);
HydrophoneLocator hLocator = defaultStreamer.getHydrophoneLocator();
if (hLocator != null) {
int locatorIndex = HydrophoneLocators.getInstance().indexOfClass(hLocator.getClass());
localiserMethod.getSelectionModel().select(locatorIndex);
HydrophoneOriginMethod originMethod = defaultStreamer.getHydrophoneOrigin();
if (originMethod != null) {
int originIndex = HydrophoneOriginMethods.getInstance().indexOfClass(originMethod.getClass());
this.originMethod.getSelectionModel().select(originIndex);
}
}
else {
localiserMethod.getSelectionModel().select(0);
}
//streamerName.setText(defaultStreamer.getStreamerName());
xPos.setText(String.valueOf(defaultStreamer.getX()));
yPos.setText(String.valueOf(defaultStreamer.getY()));
zPos.setText(String.valueOf(PamController.getInstance().getGlobalMediumManager().getZCoeff()*defaultStreamer.getZ()));
xPosErr.setText(String.valueOf(defaultStreamer.getDx()));
yPosErr.setText(String.valueOf(defaultStreamer.getDy()));
zPosErr.setText(String.valueOf(defaultStreamer.getDz()));
// if (streamer.getBuoyId1() != null) {
// buoyId.setText(streamer.getBuoyId1().toString());
// }
// else {
// buoyId.setText("");
// }
HydrophoneOriginMethod mth = defaultStreamer.getHydrophoneOrigin();
if (mth==null) {
originMethod.getSelectionModel().select(0);
newOriginMethod();
mth = currentOriginMethod;
//defaultStreamer.setHydrophoneOrigin(HydrophoneOriginMethods.getInstance().getMethod(0).createMethod(currentArray, defaultStreamer));
}
OriginDialogComponent mthDialogComponent = mth.getDialogComponent();
if (mthDialogComponent != null) {
System.out.println("Streamer setParams: Set origin component: ");
mthDialogComponent.setParams();
}
// System.out.println("Streamer setParams: Set orientation: " + defaultStreamer.getHeading() + " " + defaultStreamer.getPitch() + " " + defaultStreamer.getRoll());
heading .setText(orientation2Text(defaultStreamer.getHeading()));
pitch .setText(orientation2Text(defaultStreamer.getPitch()));
roll .setText(orientation2Text(defaultStreamer.getRoll()));
System.out.println("Streamer setParams: Origin interpolator: " + currentArray.getOriginInterpolation() + " " + currentOriginMethod.getAllowedInterpolationMethods());
if (currentArray.getOriginInterpolation()<0 || currentArray.getOriginInterpolation()>=currentOriginMethod.getAllowedInterpolationMethods()) {
System.err.println("Streamer setParams: Origin interpolator value of " + currentArray.getOriginInterpolation() + " not allowed for origin method - setting to first allowed method:");
interpPane.setSelection(0);
}
else {
interpPane.setSelection(currentArray.getOriginInterpolation());
}
System.out.println("Streamer setParams: selected interp: " + interpPane.getSelectedInterpType());
ArraySensorFieldType[] sensorFields = ArraySensorFieldType.values();
for (int i = 0; i < sensorFields.length; i++) {
ArrayParameterType fieldType = defaultStreamer.getOrientationTypes(sensorFields[i]);
String fieldDataBlock = defaultStreamer.getSensorDataBlocks(sensorFields[i]);
sensorComponents[i].setParameterType(fieldType);
if (fieldType == ArrayParameterType.SENSOR && fieldDataBlock != null) {
sensorComponents[i].setDataBlock(PamController.getInstance().getDataBlockByLongName(fieldDataBlock));
}
}
setRecieverLabels() ;
enableControls();
}
private String orientation2Text(Double ang) {
if (ang == null) return String.valueOf(0.0);
else return String.format("%3.1f", ang);
}
@Override
public String getName() {
return "Streamer Pane";
}
@Override
public Node getContentNode() {
return mainPane;
}
@Override
public void paneInitialized() {
}
public void setRecieverLabels() {
String recieverDepthString = PamController.getInstance().getGlobalMediumManager().getZString();
depthLabel.setText(recieverDepthString );
depthSensorLabel.setText(recieverDepthString + " Sensor");
}
private Double getDoubleValue(TextField textField) {
String txt = textField.getText();
if (txt == null || txt.length() == 0) {
return null;
}
Double val;
try {
val = Double.valueOf(txt);
return val;
}
catch (NumberFormatException e) {
System.err.println("Invalid orientation information: " + txt);
return null;
}
}
public void setCurrentArray(PamArray currentArray2) {
this.currentArray=currentArray2;
}
}