Skip to content

Commit b329e77

Browse files
author
Vlad Imshenetskiy
committed
Added support for mouse zoom in / zoom out to 2D plots, drag-n-drop support to OL/CL columns selection, ability to save/load filters in LogStats, multiple log file to LogStats
1 parent b76d1ff commit b329e77

28 files changed

+369
-118
lines changed

.classpath

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,19 @@
22
<classpath>
33
<classpathentry kind="src" path="src"/>
44
<classpathentry kind="src" path="resources"/>
5+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER">
6+
<attributes>
7+
<attribute name="module" value="true"/>
8+
</attributes>
9+
</classpathentry>
510
<classpathentry kind="lib" path="lib/jcommon-1.0.21.jar"/>
6-
<classpathentry kind="lib" path="lib/jfreechart-1.0.17.jar"/>
711
<classpathentry kind="lib" path="lib/log4j-1.2.14.jar"/>
812
<classpathentry kind="lib" path="lib/jmathplot.jar"/>
913
<classpathentry kind="lib" path="lib/quicktable-3.0.jar"/>
1014
<classpathentry kind="lib" path="lib/JTattoo-1.6.11.jar"/>
1115
<classpathentry kind="lib" path="lib/CheckBoxTree_1.0.0.jar"/>
1216
<classpathentry kind="lib" path="lib/jmathio.jar"/>
1317
<classpathentry kind="lib" path="lib/commons-math3-3.6.1.jar"/>
14-
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
18+
<classpathentry kind="lib" path="lib/jfreechart-1.5.3.jar"/>
1519
<classpathentry kind="output" path="bin"/>
1620
</classpath>

.settings/org.eclipse.jdt.core.prefs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ org.eclipse.jdt.core.builder.recreateModifiedClassFileInOutputFolder=ignore
66
org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=
77
org.eclipse.jdt.core.circularClasspath=error
88
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
9+
org.eclipse.jdt.core.classpath.mainOnlyProjectHasTestOnlyDependency=error
910
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
1011
org.eclipse.jdt.core.classpath.outputOverlappingAnotherSource=error
1112
org.eclipse.jdt.core.compiler.maxProblemPerUnit=100
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
eclipse.preferences.version=1
2+
org.eclipse.jdt.launching.PREF_COMPILER_COMPLIANCE_DOES_NOT_MATCH_JRE=warning
23
org.eclipse.jdt.launching.PREF_STRICTLY_COMPATIBLE_JRE_NOT_AVAILABLE=warning

MafScaling.jar

55.4 KB
Binary file not shown.

lib/jfreechart-1.0.17.jar

-1.47 MB
Binary file not shown.

lib/jfreechart-1.5.3.jar

1.53 MB
Binary file not shown.

src/com/vgi/mafscaling/ACompCalc.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,13 +60,13 @@
6060
import org.jfree.chart.renderer.xy.XYDotRenderer;
6161
import org.jfree.chart.renderer.xy.XYLineAndShapeRenderer;
6262
import org.jfree.chart.title.LegendTitle;
63+
import org.jfree.chart.ui.RectangleEdge;
6364
import org.jfree.data.function.Function2D;
6465
import org.jfree.data.function.LineFunction2D;
6566
import org.jfree.data.statistics.Regression;
6667
import org.jfree.data.xy.XYDataset;
6768
import org.jfree.data.xy.XYSeries;
6869
import org.jfree.data.xy.XYSeriesCollection;
69-
import org.jfree.ui.RectangleEdge;
7070
import org.jfree.util.ShapeUtilities;
7171
import org.math.plot.Plot3DPanel;
7272

@@ -446,7 +446,13 @@ protected void createChart(JPanel plotPanel, String xAxisName, String yAxisName)
446446

447447
chartPanel = new ChartPanel(chart, true, true, true, true, true);
448448
chartPanel.setAutoscrolls(true);
449-
chartPanel.setMouseZoomable(false);
449+
chartPanel.setMouseWheelEnabled(true);
450+
chartPanel.restoreAutoBounds();
451+
chartPanel.setZoomInFactor(0.8);
452+
chartPanel.setZoomOutFactor(1.2);
453+
chartPanel.setZoomAroundAnchor(true);
454+
chartPanel.setDomainZoomable(true);
455+
chartPanel.setRangeZoomable(true);
450456

451457
GridBagConstraints gbl_chartPanel = new GridBagConstraints();
452458
gbl_chartPanel.anchor = GridBagConstraints.CENTER;
@@ -465,7 +471,7 @@ protected void createChart(JPanel plotPanel, String xAxisName, String yAxisName)
465471

466472
XYLineAndShapeRenderer lineRenderer = new XYLineAndShapeRenderer();
467473
lineRenderer.setUseFillPaint(true);
468-
lineRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
474+
lineRenderer.setDefaultToolTipGenerator(new StandardXYToolTipGenerator(
469475
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
470476
new DecimalFormat("0.00"), new DecimalFormat("0.00")));
471477

src/com/vgi/mafscaling/AMafScaling.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@
4646
import org.jfree.chart.renderer.xy.XYDotRenderer;
4747
import org.jfree.chart.renderer.xy.XYSplineRenderer;
4848
import org.jfree.chart.title.LegendTitle;
49+
import org.jfree.chart.ui.RectangleEdge;
4950
import org.jfree.data.xy.XYDataset;
5051
import org.jfree.data.xy.XYSeries;
5152
import org.jfree.data.xy.XYSeriesCollection;
52-
import org.jfree.ui.RectangleEdge;
5353
import org.jfree.util.ShapeUtilities;
5454

5555
public abstract class AMafScaling extends FCTabbedPane implements IMafChartHolder, ActionListener {
@@ -96,7 +96,7 @@ public abstract class AMafScaling extends FCTabbedPane implements IMafChartHolde
9696
protected Insets insets1 = new Insets(1, 1, 1, 1);
9797
protected Insets insets2 = new Insets(2, 2, 2, 2);
9898
protected Insets insets3 = new Insets(3, 3, 3, 3);
99-
protected String[] optionButtons = { "Yes", "No", "No to all" };
99+
protected String[] optionButtons = { "Yes", "No" };
100100

101101
public AMafScaling(int tabPlacement, PrimaryOpenLoopFuelingTable table, MafCompare comparer) {
102102
super(tabPlacement);
@@ -259,7 +259,7 @@ protected void createChart(JPanel plotPanel, String y2AxisName) {
259259

260260
XYSplineRenderer lineRenderer = new XYSplineRenderer(3);
261261
lineRenderer.setUseFillPaint(true);
262-
lineRenderer.setBaseToolTipGenerator(new StandardXYToolTipGenerator(
262+
lineRenderer.setDefaultToolTipGenerator(new StandardXYToolTipGenerator(
263263
StandardXYToolTipGenerator.DEFAULT_TOOL_TIP_FORMAT,
264264
new DecimalFormat("0.00"), new DecimalFormat("0.00")));
265265

src/com/vgi/mafscaling/ClosedLoop.java

Lines changed: 13 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1026,6 +1026,7 @@ private boolean getColumnsFilters(String[] elements, boolean isPolfTableMap) {
10261026

10271027
protected void loadLogFile() {
10281028
boolean displayDialog = true;
1029+
boolean isPolfSet = polfTable.isSet();
10291030
boolean isPolfTableMap = polfTable.isMap();
10301031
File[] files = fileChooser.getSelectedFiles();
10311032
for (File file : files) {
@@ -1034,26 +1035,23 @@ protected void loadLogFile() {
10341035
br = new BufferedReader(new InputStreamReader(new FileInputStream(file.getAbsoluteFile()), Config.getEncoding()));
10351036
String line = null;
10361037
String [] elements = null;
1037-
while ((line = br.readLine()) != null && (elements = line.split(Utils.fileFieldSplitter, -1)) != null && elements.length < 2)
1038+
while ((line = br.readLine()) != null && (elements = line.trim().split(Utils.fileFieldSplitter, -1)) != null && elements.length < 2)
10381039
continue;
10391040
getColumnsFilters(elements, isPolfTableMap);
1040-
boolean resetColumns = false;
1041-
if (logClOlStatusColIdx >= 0 || logAfLearningColIdx >= 0 || logAfCorrectionColIdx >= 0 || logAfrColIdx >= 0 ||
1042-
logRpmColIdx >= 0 || logLoadColIdx >=0 || logTimeColIdx >=0 || logMafvColIdx >= 0 || logIatColIdx >= 0 || logMapColIdx >= 0) {
1043-
if (displayDialog) {
1044-
int rc = JOptionPane.showOptionDialog(null, "Would you like to reset column names or filter values?", "Columns/Filters Reset", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, optionButtons, optionButtons[0]);
1045-
if (rc == 0)
1046-
resetColumns = true;
1047-
else if (rc == 2)
1048-
displayDialog = false;
1049-
}
1041+
boolean resetColumns = logClOlStatusColIdx < 0 || logAfLearningColIdx < 0 || logAfCorrectionColIdx < 0 || logAfrColIdx < 0 || logRpmColIdx < 0 ||
1042+
logLoadColIdx < 0 || logTimeColIdx < 0 || logMafvColIdx < 0 || logIatColIdx < 0 || (isPolfSet && isPolfTableMap && logMapColIdx < 0);
1043+
if (false == resetColumns && true == displayDialog) {
1044+
if (JOptionPane.NO_OPTION == JOptionPane.showOptionDialog(null, "Would you like to reset column names or filter values?", "Columns/Filters Reset",
1045+
JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE, null, optionButtons, optionButtons[1]))
1046+
displayDialog = false;
1047+
else
1048+
resetColumns = true;
10501049
}
1051-
1052-
if (resetColumns || logClOlStatusColIdx < 0 || logAfLearningColIdx < 0 || logAfCorrectionColIdx < 0 || logAfrColIdx < 0 ||
1053-
logRpmColIdx < 0 || logLoadColIdx < 0 || logTimeColIdx < 0 || logMafvColIdx < 0 || logIatColIdx < 0 || (isPolfTableMap && logMapColIdx < 0)) {
1050+
if (true == resetColumns) {
10541051
ColumnsFiltersSelection selectionWindow = new CLColumnsFiltersSelection(isPolfTableMap);
10551052
if (!selectionWindow.getUserSettings(elements) || !getColumnsFilters(elements, isPolfTableMap))
10561053
return;
1054+
displayDialog = false;
10571055
}
10581056

10591057
String[] flds;
@@ -1072,7 +1070,7 @@ else if (rc == 2)
10721070
setCursor(new Cursor(Cursor.WAIT_CURSOR));
10731071

10741072
while (line != null) {
1075-
flds = line.split(Utils.fileFieldSplitter, -1);
1073+
flds = line.trim().split(Utils.fileFieldSplitter, -1);
10761074
try {
10771075
// Calculate dV/dt
10781076
prevTime = time;

0 commit comments

Comments
 (0)