auto-sync
This commit is contained in:
parent
03a511a340
commit
d967f24d95
|
@ -121,16 +121,16 @@ public class EngineReport implements TimeAxisTranslator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int timeToScreen(int time, int width, ZoomProvider zoomProvider) {
|
||||
double translated = (time - minTime) * zoomProvider.getZoomValue() / getDuration();
|
||||
public int timeToScreen(int time, int width) {
|
||||
double translated = (time - minTime) * 1.0 / getDuration();
|
||||
return (int) (width * translated);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double screenToTime(int screenX, int screenWidth, ZoomProvider zoomProvider) {
|
||||
public double screenToTime(int screenX, int screenWidth) {
|
||||
// / SYS_TICKS_PER_MS / 1000
|
||||
double time = 1.0 * screenX * getDuration() / screenWidth / zoomProvider.getZoomValue() + minTime;
|
||||
int x2 = timeToScreen((int) time, screenWidth, zoomProvider);
|
||||
double time = 1.0 * screenX * getDuration() / screenWidth + minTime;
|
||||
// int x2 = timeToScreen((int) time, screenWidth, zoomProvider);
|
||||
// FileLog.rlog("screenToTime " + (screen - x2));
|
||||
return (int) time;
|
||||
}
|
||||
|
|
|
@ -5,9 +5,9 @@ package com.rusefi.waves;
|
|||
* (c) Andrey Belomutskiy
|
||||
*/
|
||||
public interface TimeAxisTranslator {
|
||||
int timeToScreen(int time, int width, ZoomProvider zoomProvider);
|
||||
int timeToScreen(int time, int width);
|
||||
|
||||
double screenToTime(int screenX, int screenWidth, ZoomProvider zoomProvider);
|
||||
double screenToTime(int screenX, int screenWidth);
|
||||
|
||||
int getMaxTime();
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package com.rusefi.waves.test;
|
||||
|
||||
import com.rusefi.waves.EngineReport;
|
||||
import com.rusefi.waves.ZoomProvider;
|
||||
import org.junit.Test;
|
||||
|
||||
import static junit.framework.Assert.assertEquals;
|
||||
|
@ -21,6 +20,6 @@ public class EngineReportTest {
|
|||
assertEquals(14679, wr.getMinTime());
|
||||
assertEquals(43849, wr.getMaxTime());
|
||||
|
||||
assertEquals(59, wr.timeToScreen(18134, 500, ZoomProvider.DEFAULT));
|
||||
assertEquals(59, wr.timeToScreen(18134, 500));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,7 +38,7 @@ import static com.rusefi.ui.storage.PersistentConfiguration.getConfig;
|
|||
* @see EngineSnifferPanel
|
||||
*/
|
||||
public class Launcher {
|
||||
public static final int CONSOLE_VERSION = 20170104;
|
||||
public static final int CONSOLE_VERSION = 20170106;
|
||||
public static final boolean SHOW_STIMULATOR = false;
|
||||
private static final String TAB_INDEX = "main_tab";
|
||||
protected static final String PORT_KEY = "port";
|
||||
|
|
|
@ -39,7 +39,7 @@ public class EngineSnifferStatusPanel {
|
|||
/**
|
||||
* Time which corresponds to the mouse cursor screen location
|
||||
*/
|
||||
double time = translator.screenToTime(x, s.getWidth(), zoomProvider);
|
||||
double time = translator.screenToTime(x, s.getWidth());
|
||||
timeLabel.setText("" + String.format("%.5f sec", time));
|
||||
|
||||
String text = time2rpm == null ? "n/a" : time2rpm.getCrankAngleByTimeString(time);
|
||||
|
|
|
@ -35,7 +35,6 @@ public class UpDownImage extends JPanel {
|
|||
public static final Color ENGINE_CYCLE_COLOR = Color.green;
|
||||
|
||||
private long lastUpdateTime;
|
||||
private ZoomProvider zoomProvider = ZoomProvider.DEFAULT;
|
||||
private EngineReport wr;
|
||||
private StringBuilder revolutions;
|
||||
private final String name;
|
||||
|
@ -80,7 +79,6 @@ public class UpDownImage extends JPanel {
|
|||
}
|
||||
|
||||
public void setZoomProvider(ZoomProvider zoomProvider) {
|
||||
this.zoomProvider = zoomProvider;
|
||||
}
|
||||
|
||||
public UpDownImage(EngineReport wr, String name) {
|
||||
|
@ -113,13 +111,13 @@ public class UpDownImage extends JPanel {
|
|||
public TimeAxisTranslator createTranslator() {
|
||||
return new TimeAxisTranslator() {
|
||||
@Override
|
||||
public int timeToScreen(int time, int width, ZoomProvider zoomProvider) {
|
||||
return UpDownImage.this.wr.timeToScreen(time, width, zoomProvider);
|
||||
public int timeToScreen(int time, int width) {
|
||||
return UpDownImage.this.wr.timeToScreen(time, width);
|
||||
}
|
||||
|
||||
@Override
|
||||
public double screenToTime(int screen, int width, ZoomProvider zoomProvider) {
|
||||
return UpDownImage.this.wr.screenToTime(screen, width, zoomProvider);
|
||||
public double screenToTime(int screen, int width) {
|
||||
return UpDownImage.this.wr.screenToTime(screen, width);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -134,7 +132,7 @@ public class UpDownImage extends JPanel {
|
|||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TimeAxisTranslator " + zoomProvider;
|
||||
return "TimeAxisTranslator";
|
||||
}
|
||||
};
|
||||
}
|
||||
|
@ -212,7 +210,7 @@ public class UpDownImage extends JPanel {
|
|||
|
||||
g2.setStroke(new BasicStroke());
|
||||
for (int time : time2rpm.keySet()) {
|
||||
int x = translator.timeToScreen(time, d.width, zoomProvider);
|
||||
int x = translator.timeToScreen(time, d.width);
|
||||
g2.setColor(ENGINE_CYCLE_COLOR);
|
||||
g2.drawLine(x, 0, x, d.height);
|
||||
|
||||
|
@ -252,14 +250,14 @@ public class UpDownImage extends JPanel {
|
|||
|
||||
for (int ms = fromMs; ms <= toMs; ms++) {
|
||||
int tick = ms * EngineReport.mult;
|
||||
int x = translator.timeToScreen(tick, d.width, zoomProvider);
|
||||
int x = translator.timeToScreen(tick, d.width);
|
||||
g2.drawLine(x, 0, x, d.height);
|
||||
}
|
||||
}
|
||||
|
||||
private void paintUpDown(Dimension d, EngineReport.UpDown upDown, Graphics g) {
|
||||
int x1 = translator.timeToScreen(upDown.upTime, d.width, zoomProvider);
|
||||
int x2 = translator.timeToScreen(upDown.downTime, d.width, zoomProvider);
|
||||
int x1 = translator.timeToScreen(upDown.upTime, d.width);
|
||||
int x2 = translator.timeToScreen(upDown.downTime, d.width);
|
||||
|
||||
int y = (int) (0.2 * d.height);
|
||||
|
||||
|
@ -321,7 +319,6 @@ public class UpDownImage extends JPanel {
|
|||
@Override
|
||||
public String toString() {
|
||||
return "UpDownImage{" +
|
||||
"zoomProvider=" + zoomProvider +
|
||||
"} " + super.toString();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue