git-svn-id: http://svn.3splooges.com/romraider-arch/trunk@608 d2e2e1cd-ba16-0410-be16-b7c4453c7c2d

This commit is contained in:
Tgui 2007-04-05 12:33:50 +00:00
parent 86649910d7
commit cc7a02ad1a
3 changed files with 51 additions and 47 deletions

View File

@ -18,8 +18,8 @@ public class UtecTimerTask extends TimerTask{
public void setData(String data){
this.data = data;
this.stringBuffer = new StringBuffer(data);
JutecGUI.getInstance().getJProgressBar().setMinimum(0);
JutecGUI.getInstance().getJProgressBar().setMaximum(data.length());
//JutecGUI.getInstance().getJProgressBar().setMinimum(0);
//JutecGUI.getInstance().getJProgressBar().setMaximum(data.length());
}
public void run(){
@ -30,7 +30,7 @@ public class UtecTimerTask extends TimerTask{
UtecSerialConnectionManager.sendCommandToUtec((int)theChar);
counter++;
JutecGUI.getInstance().getJProgressBar().setValue(counter);
//JutecGUI.getInstance().getJProgressBar().setValue(counter);
// Kill the timer after a at the end of the string
if(counter == data.length()){

View File

@ -79,43 +79,13 @@ public class JutecToolBar extends JToolBar implements ActionListener {
openFileName = fileChooser.getSelectedFile().getPath();
mapData = new UtecMapData(openFileName);
//UtecDataManager.setCurrentMap(mapData);
UtecDataManager.addMap(mapData);
}
if(mapData != null){
// Define columnLabels
String[] columnLabels = new String[11];
for(int i = 0; i < columnLabels.length ; i++){
columnLabels[i] = i+"";
if(mapData != null){
// Add map to collection of maps
UtecDataManager.addMap(mapData);
// Enable the save option
this.saveImage.setEnabled(true);
}
String[] rowLabels = new String[40];
for(int i = 0; i < rowLabels.length ; i++){
rowLabels[i] = i+"";
}
// Initialise tree
ETreeNode root = new ETreeNode("UTEC:"+mapData.getMapName()+", "+mapData.getMapComment(), new TableMetaData(TableMetaData.MAP_SET_ROOT,0.0,0.0,new Object[0],null,null,false,"","", "", "", mapData.getMapName(), this.parentTuningEntity));
Object[] ignored = {new Double(-100.0)};
ETreeNode fuel = new ETreeNode("Fuel", new TableMetaData(TableMetaData.DATA_3D, Double.parseDouble(UtecProperties.getProperties("utec.fuelMapMin")[0]), Double.parseDouble(UtecProperties.getProperties("utec.fuelMapMax")[0]), ignored,columnLabels,rowLabels, false, "Fuel" , "Data", "RPM", "Fuel:"+mapData.getMapName(), mapData.getMapName(),this.parentTuningEntity));
Object[] ignored2 = {new Double(-100.0)};
ETreeNode timing = new ETreeNode("Timing", new TableMetaData(TableMetaData.DATA_3D, Double.parseDouble(UtecProperties.getProperties("utec.timingMapMin")[0]), Double.parseDouble(UtecProperties.getProperties("utec.timingMapMax")[0]), ignored,columnLabels,rowLabels, false, "Timing" , "Data", "RPM", "Timing:"+mapData.getMapName(), mapData.getMapName(),this.parentTuningEntity));
Object[] ignored3 = {new Double(-100.0)};
ETreeNode boost = new ETreeNode("Boost", new TableMetaData(TableMetaData.DATA_3D, Double.parseDouble(UtecProperties.getProperties("utec.boostMapMin")[0]), Double.parseDouble(UtecProperties.getProperties("utec.boostMapMax")[0]), ignored, columnLabels,rowLabels,false, "Boost", "Data", "RPM", "Boost:"+mapData.getMapName(), mapData.getMapName(), this.parentTuningEntity));
root.add(fuel);
root.add(timing);
root.add(boost);
this.theTEL.addNewTuningGroup(root);
// Enable the save option
this.saveImage.setEnabled(true);
}
} catch (Exception ex) {

View File

@ -3,6 +3,10 @@ package enginuity.logger.utec.gui.mapTabs;
import java.util.Iterator;
import java.util.Vector;
import enginuity.NewGUI.data.ApplicationStateManager;
import enginuity.NewGUI.data.TableMetaData;
import enginuity.NewGUI.interfaces.TuningEntity;
import enginuity.NewGUI.tree.ETreeNode;
import enginuity.logger.utec.commEvent.LoggerDataListener;
import enginuity.logger.utec.commEvent.UtecAFRListener;
import enginuity.logger.utec.mapData.UtecMapData;
@ -15,7 +19,6 @@ public class UtecDataManager {
private static UtecTableModel boostListener = null;
private static UtecAFRListener utecAFRListener = null;
private static Vector<LoggerDataListener> loggerListener = new Vector<LoggerDataListener>();
private static Vector<LoggerDataListener> generalListener = new Vector<LoggerDataListener>();
private static boolean isExpectingMap = false;
private static String rawMapData = "";
@ -36,7 +39,9 @@ public class UtecDataManager {
public static void addMap(UtecMapData newUtecMap){
allMaps.add(newUtecMap);
//setCurrentMap(newUtecMap);
System.out.println("UtecDataManager:"+ApplicationStateManager.getCurrentTuningEntity().getName());
ETreeNode rootNode = buildMapDataTreeNode(newUtecMap, ApplicationStateManager.getCurrentTuningEntity());
ApplicationStateManager.getEnginuityInstance().addNewTuningGroup(rootNode);
}
public static void setCurrentMap(UtecMapData newUtecMap){
@ -61,8 +66,39 @@ public class UtecDataManager {
System.out.println("Done calling map listeners.");
}
private static ETreeNode buildMapDataTreeNode(UtecMapData mapData, TuningEntity parentTuningEntity) {
// Define columnLabels
String[] columnLabels = new String[11];
for(int i = 0; i < columnLabels.length ; i++){
columnLabels[i] = (i * 10)+"";
}
String[] rowLabels = new String[40];
for(int i = 0; i < rowLabels.length ; i++){
rowLabels[i] = i+"";
}
// Initialise tree
ETreeNode root = new ETreeNode("UTEC:"+mapData.getMapName()+", "+mapData.getMapComment(), new TableMetaData(TableMetaData.MAP_SET_ROOT,0.0,0.0,new Object[0],null,null,false,"","", "", "", mapData.getMapName(), parentTuningEntity));
Object[] ignored = {new Double(-100.0)};
ETreeNode fuel = new ETreeNode("Fuel", new TableMetaData(TableMetaData.DATA_3D, Double.parseDouble(UtecProperties.getProperties("utec.fuelMapMin")[0]), Double.parseDouble(UtecProperties.getProperties("utec.fuelMapMax")[0]), ignored,columnLabels,rowLabels, false, "Fuel" , "Load", "RPM", "Fuel:"+mapData.getMapName(), mapData.getMapName(),parentTuningEntity));
Object[] ignored2 = {new Double(-100.0)};
ETreeNode timing = new ETreeNode("Timing", new TableMetaData(TableMetaData.DATA_3D, Double.parseDouble(UtecProperties.getProperties("utec.timingMapMin")[0]), Double.parseDouble(UtecProperties.getProperties("utec.timingMapMax")[0]), ignored,columnLabels,rowLabels, false, "Timing" , "Load", "RPM", "Timing:"+mapData.getMapName(), mapData.getMapName(),parentTuningEntity));
Object[] ignored3 = {new Double(-100.0)};
ETreeNode boost = new ETreeNode("Boost", new TableMetaData(TableMetaData.DATA_3D, Double.parseDouble(UtecProperties.getProperties("utec.boostMapMin")[0]), Double.parseDouble(UtecProperties.getProperties("utec.boostMapMax")[0]), ignored, columnLabels,rowLabels,false, "Boost", "Load", "RPM", "Boost:"+mapData.getMapName(), mapData.getMapName(), parentTuningEntity));
root.add(fuel);
root.add(timing);
root.add(boost);
return root;
}
/**
* Set serial data from a serial event
* Get serial data from a serial event
*
* @param serialData
*/
@ -82,8 +118,11 @@ public class UtecDataManager {
UtecMapData newMap = new UtecMapData();
newMap.replaceRawData(new StringBuffer(rawMapData));
newMap.populateMapDataStructures();
// setCurrentMap(newMap);
rawMapData = "";
addMap(newMap);
setExpectingMap(false);
}
}else{
@ -100,11 +139,6 @@ public class UtecDataManager {
//System.out.println("DM LoggerEvent: Checking data length");
if(data.length < 4){
// **********************************
// Call out to general data listeners
// **********************************
return;
}