Skip to content

Commit a6d8c22

Browse files
U354706U354706
U354706
authored and
U354706
committed
30/09/2021 : Evolutions majeures
- Formules avec des paramètres de calibration - Association d'un workspace avec une calib - Affichage des ponts du log dans les cartos - Quelques arrangements sur l'ihm - Correction de bugs divers
1 parent b496f6a commit a6d8c22

25 files changed

+931
-351
lines changed

images/icon_addWorkspace_24.png

450 Bytes
Loading

images/icon_log_24.png

453 Bytes
Loading

images/icon_mapFile_24.png

382 Bytes
Loading

images/icon_marker_12.png

241 Bytes
Loading

images/icon_maxValue_16.png

320 Bytes
Loading

images/icon_minValue_16.png

319 Bytes
Loading

images/icon_traceMap_24.png

592 Bytes
Loading

resources/news.html

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,19 @@
11
<html>
22

3-
<b><font size =+1><font color=blue># 16/09/2021 : Version V1.5</font></b>
3+
<b><font size =+1><font color=blue># 30/09/2021 : Version V1.51</font></b>
4+
<ul>
5+
<li>Association d'un workspace avec une calibration (mapping des entr&eacute;es de courbe et carto avec les variables de mesure)
6+
<li>Affichage des points du log dans les courbes/cartos
7+
<li>R&eacute;duction du temps d'ouverture d'un log
8+
<li>Correction de bugs
9+
</ul>
10+
11+
<hr align=center size=1 width="100%">
12+
13+
<b><font size =+1><font color=blue># 19/09/2021 : Version V1.5</font></b>
414
<ul>
515
<li>Possibilit&eacute; de cr&eacute;er une formule &agrave; partir d'un param&egrave;tre de calibration
16+
<li>Quelques arrangements sur l'ihm
617
<li>Correction de bugs
718
</ul>
819

src/calib/MapCal.java

Lines changed: 59 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@
1515
import java.util.Collections;
1616
import java.util.Date;
1717
import java.util.List;
18+
import java.util.Map;
19+
import java.util.Map.Entry;
20+
import java.util.Set;
1821
import java.util.TimeZone;
1922

2023
import javax.xml.parsers.DocumentBuilder;
@@ -32,6 +35,7 @@
3235
import org.w3c.dom.DocumentType;
3336
import org.w3c.dom.Element;
3437

38+
import calib.MdbWorkspace.VariableECU;
3539
import jxl.Workbook;
3640
import jxl.format.Alignment;
3741
import jxl.format.Border;
@@ -53,6 +57,7 @@ public final class MapCal {
5357
private final List<Variable> listVariable;
5458
private MdbData mdbData;
5559
private boolean usedByFormula = false;
60+
private boolean hasWorkspace = false;
5661

5762
public MapCal(File mapFile) {
5863
this.name = mapFile.getName().replace(".map", "");
@@ -89,17 +94,10 @@ private final void parseFile(File mapFile) {
8994

9095
if (mdbData.getInfos().isEmpty() || variable.getInfos() != null) {
9196
listVariable.add(variable);
92-
if (!variable.checkDim()) {
93-
// System.out.println(variable.getName() + " => CheckDim nOK");
94-
}
95-
96-
} else {
97-
// System.out.println(variable.getName() + " => non présente dans le mdb");
9897
}
9998

10099
nLigne--;
101100
}
102-
103101
}
104102

105103
} catch (IOException e) {
@@ -129,6 +127,10 @@ public String toString() {
129127
return this.name;
130128
}
131129

130+
public final boolean hasWorkspaceLinked() {
131+
return hasWorkspace;
132+
}
133+
132134
public List<Variable> getListVariable() {
133135
Collections.sort(listVariable);
134136
return listVariable;
@@ -143,6 +145,33 @@ public final Variable getVariable(String name) {
143145
return null;
144146
}
145147

148+
public final boolean associateWorksplace(Map<String, VariableECU> variablesECU) {
149+
150+
boolean result = false;
151+
152+
Set<Entry<String, VariableECU>> entries = variablesECU.entrySet();
153+
for (Variable var : listVariable) {
154+
for (Entry entry : entries) {
155+
VariableECU variableECU = (VariableECU) entry.getValue();
156+
if (var.getInfos().getVarCol() == variableECU.getOffset()) {
157+
var.setInputX(entry.getKey().toString());
158+
result = true;
159+
} else if (var.getInfos().getVarLigne() == variableECU.getOffset()) {
160+
var.setInputY(entry.getKey().toString());
161+
result = true;
162+
}
163+
}
164+
}
165+
166+
if (result) {
167+
hasWorkspace = true;
168+
} else {
169+
hasWorkspace = false;
170+
}
171+
172+
return result;
173+
}
174+
146175
public static final boolean toCdfx(List<Variable> listVariable, final File file) {
147176

148177
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
@@ -555,24 +584,43 @@ public static final boolean exportMap(List<Variable> listVariable, final File fi
555584
pw.print(BKPTCOL + EGALE);
556585

557586
for (short x = 1; x < var.getDimX(); x++) {
558-
pw.print(var.getValue(modifiedVar, 0, x) + SEMICOLON);
587+
588+
value = var.getValue(modifiedVar, 0, x);
589+
590+
if (value == null || "NaN".equals(value.toString())) {
591+
value = "";
592+
}
593+
pw.print(value + SEMICOLON);
559594
}
560595
pw.println();
561596

562597
pw.print(BKPTLIGN + EGALE);
563598

564599
for (short y = 1; y < var.getDimY(); y++) {
565-
pw.print(var.getValue(modifiedVar, y, 0) + SEMICOLON);
600+
601+
value = var.getValue(modifiedVar, y, 0);
602+
603+
if (value == null || "NaN".equals(value.toString())) {
604+
value = "";
605+
}
606+
pw.print(value + SEMICOLON);
566607
}
567608
pw.println();
568609

569610
for (short y = 1; y < var.getDimY(); y++) {
570611
for (short x = 0; x < var.getDimX(); x++) {
612+
613+
value = var.getValue(modifiedVar, y, x);
614+
615+
if (value == null || "NaN".equals(value.toString())) {
616+
value = "";
617+
}
618+
571619
if (x == 0) {
572-
pw.print(LIGNE + var.getValue(modifiedVar, y, x) + EGALE);
620+
pw.print(LIGNE + value + EGALE);
573621
continue;
574622
}
575-
pw.print(var.getValue(modifiedVar, y, x) + SEMICOLON);
623+
pw.print(value + SEMICOLON);
576624
}
577625
pw.println();
578626
}

src/calib/MdbData.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ public final class MdbData {
2323
private static final String NOMCARTO = "NomCarto";
2424
private static final String TYPENAME = "Typename";
2525
private static final String SOUSTYPE = "Soustype";
26-
private static final String VARCOL = "Varcol";
27-
private static final String VARLIGNE = "Varligne";
26+
private static final String VARCOL = "ColVarAdr";
27+
private static final String VARLIGNE = "LgnVarAdr";
2828
private static final String NBBKPTCOL = "NbBkptCol"; // float
2929
private static final String NBBKPTLGN = "NbBkptLgn"; // float
3030
private static final String TYPEVAR = "TypeVariable";
@@ -92,7 +92,7 @@ public final Map<String, VariableInfo> getVariableInfo(Table tableCartos) {
9292
}
9393

9494
listInfos.put(row.getString(NOMCARTO),
95-
new VariableInfo(row.getString(TYPENAME), row.getString(SOUSTYPE), row.getString(VARCOL), row.getString(VARLIGNE),
95+
new VariableInfo(row.getString(TYPENAME), row.getString(SOUSTYPE), row.getInt(VARCOL), row.getInt(VARLIGNE),
9696
row.getShort(NBBKPTCOL), row.getShort(NBBKPTLGN), row.getInt(COLBKPTFACTOR), row.getDouble(ROWBKPTFACTOR),
9797
row.getDouble(FACTOR), row.getByte(TYPEVAR), row.getDouble(VAL_MAX), row.getDouble(VAL_MIN), row.getString(DETAIL)));
9898
}
@@ -115,8 +115,8 @@ public class VariableInfo {
115115

116116
private String typeName;
117117
private String sousType;
118-
private String varCol;
119-
private String varLigne;
118+
private int varCol;
119+
private int varLigne;
120120
private short nbBkPtCol;
121121
private short nbBkPtRow;
122122
private int colBkPtFactor;
@@ -127,7 +127,7 @@ public class VariableInfo {
127127
private double min;
128128
private String detail;
129129

130-
public VariableInfo(String typeName, String sousType, String varCol, String varLigne, short nbBkPtCol, short nbBkPtRow, int colBkPtFactor,
130+
public VariableInfo(String typeName, String sousType, int varCol, int varLigne, short nbBkPtCol, short nbBkPtRow, int colBkPtFactor,
131131
double rowBkPtFactor, double factor, byte typeVar, double max, double min, String detail) {
132132
this.typeName = typeName;
133133
this.sousType = sousType;
@@ -152,11 +152,11 @@ public String getSousType() {
152152
return sousType != null ? sousType : "";
153153
}
154154

155-
public String getVarCol() {
155+
public int getVarCol() {
156156
return varCol;
157157
}
158158

159-
public String getVarLigne() {
159+
public int getVarLigne() {
160160
return varLigne;
161161
}
162162

src/calib/MdbWorkspace.java

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public final class MdbWorkspace {
6969
public MdbWorkspace(File mdbFile) {
7070
this.name = mdbFile.getName().replace(".mdb", "");
7171
readDatabase(mdbFile);
72-
writeToXml();
72+
// writeToXml();
7373
}
7474

7575
public String getName() {
@@ -80,18 +80,25 @@ public Map<String, Afficheur> getInfos() {
8080
return afficheurs != null ? afficheurs : new HashMap<String, Afficheur>();
8181
}
8282

83+
public Map<String, VariableECU> getVariablesECU() {
84+
return variablesECU != null ? variablesECU : new HashMap<String, VariableECU>();
85+
}
86+
8387
private final void readDatabase(File mdbFile) {
8488

8589
try {
8690
Database db = DatabaseBuilder.open(mdbFile);
8791

8892
Table tableAfficheurs = db.getTable(AFFICHEUR);
89-
this.afficheurs = getAfficheurInfo(tableAfficheurs);
90-
9193
Table tableComVarList = db.getTable(COMVARLIST);
92-
this.comVarList = getComVarList(tableComVarList);
93-
9494
Table tableVariablesECU = db.getTable(VARIABLES);
95+
96+
if (tableAfficheurs == null || tableComVarList == null || tableVariablesECU == null) {
97+
return;
98+
}
99+
100+
this.afficheurs = getAfficheurInfo(tableAfficheurs);
101+
this.comVarList = getComVarList(tableComVarList);
95102
this.variablesECU = getVariablesECU(tableVariablesECU);
96103

97104
db.close();
@@ -102,7 +109,7 @@ private final void readDatabase(File mdbFile) {
102109
}
103110
}
104111

105-
public final Map<String, Afficheur> getAfficheurInfo(Table tableAfficheurs) {
112+
private final Map<String, Afficheur> getAfficheurInfo(Table tableAfficheurs) {
106113

107114
HashMap<String, Afficheur> listInfos = new HashMap<String, Afficheur>(tableAfficheurs.getRowCount());
108115

@@ -114,7 +121,7 @@ public final Map<String, Afficheur> getAfficheurInfo(Table tableAfficheurs) {
114121
return listInfos;
115122
}
116123

117-
public final Map<Integer, VariableDisplay> getComVarList(Table table) {
124+
private final Map<Integer, VariableDisplay> getComVarList(Table table) {
118125

119126
HashMap<Integer, VariableDisplay> listVariable = new HashMap<Integer, VariableDisplay>(table.getRowCount());
120127

@@ -141,7 +148,7 @@ public final Map<Integer, VariableDisplay> getComVarList(Table table) {
141148
return listVariable;
142149
}
143150

144-
public final Map<String, VariableECU> getVariablesECU(Table tableVariablesECU) {
151+
private final Map<String, VariableECU> getVariablesECU(Table tableVariablesECU) {
145152

146153
HashMap<String, VariableECU> listVariables = new HashMap<String, VariableECU>(tableVariablesECU.getRowCount());
147154

0 commit comments

Comments
 (0)