changes value representation in waves

This commit is contained in:
Eyck Jentzsch 2023-03-19 11:23:25 +01:00
parent 354c4a4390
commit 361a18b38e
2 changed files with 13 additions and 4 deletions

View File

@ -224,17 +224,23 @@ public class SignalPainter extends TrackPainter {
label=last.toString();
break;
default:
label="h'"+last.toHexString();
label=/*"h'"+*/last.toHexString();
}
Point bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height);
if (xBegin < area.x) {
xBegin = area.x;
width = xEnd - xBegin;
}
Point bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label), height);
String ext = "";
while(width<bb.x && label.length()>1) {
label = label.substring(0, label.length()-1);
ext="+";
bb = new Point(DUMMY_PANEL.getFontMetrics(tmpAwtFont).stringWidth(label +ext), height);
}
if (width > (bb.x+1)) {
Rectangle old = proj.getClipping();
proj.setClipping(xBegin + 3, yOffsetT, xEnd - xBegin - 5, yOffsetB - yOffsetT);
proj.drawText(label, xBegin + 3, yOffsetM - bb.y / 2 - 1);
proj.drawText(label+ext, xBegin + 3, yOffsetM - bb.y / 2 - 1);
proj.setClipping(old);
}
} else {

View File

@ -11,6 +11,7 @@
package com.minres.scviewer.database;
import java.math.BigInteger;
import java.util.Arrays;
/**
* The Class BitVector.
@ -168,7 +169,9 @@ public class BitVector implements IEvent {
}
res[i] = Character.forDigit(digit, 16); // ((digit < 10) ? '0' + digit : 'a' + digit -10)
}
return new String(res);
int idx=0;
while(res[idx]=='0' && idx<(res.length-1)) idx++;
return new String( Arrays.copyOfRange(res, idx, res.length));
}
/**