1
1
package multichannel ;
2
2
3
+ import java .io .FileNotFoundException ;
4
+ import java .io .PrintWriter ;
5
+ import java .io .UnsupportedEncodingException ;
3
6
import java .util .ArrayList ;
4
7
5
8
import org .eclipse .swt .SWT ;
@@ -486,23 +489,15 @@ protected void PositionPolyLine(int[] l1) {
486
489
487
490
protected void paintControl (PaintEvent e ) {
488
491
489
- // long start = System.currentTimeMillis();
490
-
491
492
for (int c = 0 ; c < this .chan .length ; c ++) {
492
493
493
- // if (chan[c].tailSize <= 0) {
494
- // chan[c].stack.popNegate(0);
495
- // continue;
496
- // }
497
-
498
494
// Go calculate the line
499
495
Object [] result = calculate (c );
500
496
int [] l1 = (int []) result [0 ];
501
497
int [] l2 = (int []) result [1 ];
502
498
503
499
PositionPolyLine (l1 );
504
500
PositionPolyLine (l2 );
505
- // System.out.print(System.currentTimeMillis() - start + "-");
506
501
507
502
// Draw it
508
503
GC gc = e .gc ;
@@ -532,20 +527,15 @@ protected void paintControl(PaintEvent e) {
532
527
}
533
528
534
529
} else {
535
- // long time = System.nanoTime();
536
530
gc .drawPolyline (l1 );
537
531
gc .drawPolyline (l2 );
538
- // System.out.println(System.nanoTime() - time + " nanoseconds");
539
532
}
540
533
541
534
// Connects the head with the tail
542
535
if (isConnect (c ) && !isFade (c ) && this .chan [c ].originalTailSize == TAILSIZE_MAX && l1 .length > 0 && l2 .length > 0 ) {
543
536
gc .drawLine (l2 [l2 .length - 2 ], l2 [l2 .length - 1 ], l1 [0 ], l1 [1 ]);
544
537
}
545
538
}
546
-
547
- // System.out.println(System.currentTimeMillis() - start + " milliseconds for all channels");
548
-
549
539
}
550
540
551
541
public Color getForeground (int channel ) {
@@ -570,11 +560,6 @@ private Object[] calculate(int channel) {
570
560
int [] line2 = null ;
571
561
int splitPos = 0 ;
572
562
573
- // for (int progress = 0; progress < getProgression(c); progress++) {
574
-
575
- // if (chan[c].stack.isEmpty() && chan[c].stackListeners != null)
576
- // notifyListeners(c);
577
-
578
563
splitPos = this .chan [c ].tailSize * 4 ;
579
564
580
565
if (!isSteady (c ))
@@ -585,9 +570,6 @@ private Object[] calculate(int channel) {
585
570
line1 = new int [this .chan [c ].tailSize * 4 ];
586
571
line2 = new int [this .chan [c ].tailSize * 4 ];
587
572
588
- // chan[c].tail[chan[c].tailSize] = transform(c, chan[c].width,
589
- // chan[c].height, chan[c].stack.popNegate(0));
590
-
591
573
for (int i = 0 ; i < this .chan [c ].tailSize ; i ++) {
592
574
593
575
int posx = this .chan [c ].cursor - this .chan [c ].tailSize + i ;
@@ -1095,4 +1077,21 @@ public void dispose() {
1095
1077
super .dispose ();
1096
1078
}
1097
1079
1080
+ public void saveData (String fileName ) {
1081
+
1082
+ try (PrintWriter writer = new PrintWriter (fileName , "UTF-8" );) { //$NON-NLS-1$
1083
+ writer .println ("chan1;chan2;chan3;chan4;chan5;chan6;nothing" ); //$NON-NLS-1$
1084
+ for (int curvalue = 0 ; curvalue < this .chan [0 ].tail .length ; curvalue ++) {
1085
+ for (int channel = 0 ; channel < this .chan .length ; channel ++) {
1086
+ writer .print (this .chan [channel ].tail [curvalue ]);
1087
+ writer .print (';' );
1088
+ }
1089
+ writer .println ();
1090
+ }
1091
+ } catch (FileNotFoundException | UnsupportedEncodingException e ) {
1092
+ // TODO Auto-generated catch block
1093
+ e .printStackTrace ();
1094
+ }
1095
+ }
1096
+
1098
1097
}
0 commit comments