Skip to content

Commit 4fa7fa1

Browse files
committed
feat: layer selection
1 parent c48b2fe commit 4fa7fa1

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

common-tools/clas-qcddat/src/main/java/org/jlab/qcddat/CVTViewer.java

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ public static void main(String[] args) {
7272
private CheckBox showLoc1;
7373
private CheckBox showLoc2;
7474
private CheckBox showLoc3;
75+
private CheckBox[] showLayer = new CheckBox[12];
7576
private CheckBox showSVT;
7677
private CheckBox showBMTC;
7778
private CheckBox showBMTZ;
@@ -110,14 +111,16 @@ private static class HitPoint {
110111
final double z;
111112
final DetectorKind kind;
112113
final int pointloc;
114+
final int layer;
113115
final int mctrue;
114116

115-
HitPoint(double x, double y, double z, DetectorKind kind, int loc, int mct) {
117+
HitPoint(double x, double y, double z, DetectorKind kind, int loc, int layer, int mct) {
116118
this.x = x;
117119
this.y = y;
118120
this.z = z;
119121
this.kind = kind;
120122
this.pointloc = loc;
123+
this.layer = layer;
121124
this.mctrue = mct;
122125
}
123126
}
@@ -273,7 +276,7 @@ private void renderCachedEvent() {
273276
int nOther = 0;
274277

275278
for (HitPoint p : points) {
276-
if (!isVisible(p.kind) || !isVisibleLoc(p.pointloc)) {
279+
if (!isVisible(p.kind) || !isVisibleLoc(p.pointloc) || !isVisibleLayer(p.layer)) {
277280
continue;
278281
}
279282

@@ -407,6 +410,15 @@ private VBox buildLegendPane() {
407410
showLoc2.setOnAction(e -> renderCachedEvent());
408411
showLoc3.setOnAction(e -> renderCachedEvent());
409412

413+
Label layerTitle = new Label("Layer");
414+
layerTitle.setStyle("-fx-font-size: 14px; -fx-font-weight: bold;");
415+
416+
for (int l=0; l<12; l++) {
417+
showLayer[l] = new CheckBox(Integer.toString(l+1));
418+
showLayer[l].setSelected(true);
419+
showLayer[l].setOnAction(e -> renderCachedEvent());
420+
}
421+
410422
Label help = new Label(
411423
"Mouse drag: rotate\n" +
412424
"Scroll / - / +: zoom\n" +
@@ -428,6 +440,10 @@ private VBox buildLegendPane() {
428440
showLoc2,
429441
showLoc3,
430442
new Separator(),
443+
layerTitle,
444+
showLayer[0], showLayer[1], showLayer[2], showLayer[3], showLayer[4], showLayer[5],
445+
showLayer[6], showLayer[7], showLayer[8], showLayer[9], showLayer[10], showLayer[11],
446+
new Separator(),
431447
help
432448
);
433449
box.setPadding(new Insets(12));
@@ -556,6 +572,10 @@ private boolean isVisibleLoc(int loc) {
556572
};
557573
}
558574

575+
private boolean isVisibleLayer(int layer) {
576+
return showLayer[layer-1].isSelected();
577+
}
578+
559579
private List<HitPoint> extractAllThreePoints(DataBank bank) {
560580
List<HitPoint> out = new ArrayList<>();
561581

@@ -568,21 +588,21 @@ private List<HitPoint> extractAllThreePoints(DataBank bank) {
568588
bank.getFloat("x1", i),
569589
bank.getFloat("y1", i),
570590
bank.getFloat("z1", i),
571-
kind, 1, mct
591+
kind, 1, layer, mct
572592
));
573593

574594
out.add(new HitPoint(
575595
bank.getFloat("x2", i),
576596
bank.getFloat("y2", i),
577597
bank.getFloat("z2", i),
578-
kind, 2, mct
598+
kind, 2, layer, mct
579599
));
580600

581601
out.add(new HitPoint(
582602
bank.getFloat("x3", i),
583603
bank.getFloat("y3", i),
584604
bank.getFloat("z3", i),
585-
kind, 3, mct
605+
kind, 3, layer, mct
586606
));
587607
}
588608

0 commit comments

Comments
 (0)