Hi,
what do you mean with 'mixed'?
There is no newer version right now.
But there is a tiny sample (IntelliJ Project) for download at:
WUFI2D-FileData.tgz
and some java doc:
doc.tar.gz
and here comes another sample (paste it to a file named 'Gui.java':
<file Gui.java>
package main;
import main.core.data.IGrid;
import main.core.data.IMaterial;
import main.core.data.IWufiData;
import main.core.data.constants.OneArrayResults;
import main.core.data.dt.primitives.MyPoint;
import main.core.data.factory.WufiDataFactory;
import javax.swing.*;
import javax.swing.filechooser.FileFilter;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.File;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/*
* @author veitner
* Date: Nov 14, 2011
* Time: 10:03:05 AM
*/
/**
* $Id: Gui.java $
*/
public class Gui extends JFrame {
private void printLayout(IGrid g, java.util.List<IMaterial> mat,
StringBuffer sb) {
sb.append("Materialclassification (0 is unassigned or a boundary
if next neighbour !=0):\n");
for (int j = 0; j < g.getGridLayoutY().size(); j++) {
for (int i = 0; i < g.getGridLayoutX().size(); i++) {
IMaterial m = g.getGridElement(i, j).getMaterial();
int id = (m == null ? 0 : mat.indexOf(m) + 1);
sb.append(id).append(" ");
}
sb.append("\n");
}
sb.append("\n");
}
private void printData(String id, float[][] data, StringBuffer sb) {
sb.append(id).append("=(");
for (int i = 0; i < data.length; i++) {
sb.append("(");
for (int j = 0; j < data
.length; j++) {
sb.append(data[j]);
if (j < data.length - 1) {
sb.append(",");
}
}
sb.append(")");
if (i < data.length - 1) {
sb.append(",");
}
}
sb.append(")\t");
}
public Gui() {
super("sample");
JPanel p = new JPanel();
final JTextField te = new JTextField();
te.setMinimumSize(new Dimension(180, (int)
te.getPreferredSize().getHeight() + 4));
te.setSize(te.getMinimumSize());
te.setPreferredSize(te.getMinimumSize());
p.add(te, BorderLayout.NORTH);
final JTextArea ta = new JTextArea();
ta.setEditable(false);
JScrollPane sp = new JScrollPane(ta);
sp.setMinimumSize(new Dimension(250, 220));
sp.setPreferredSize(sp.getMinimumSize());
add(sp, BorderLayout.CENTER);
JButton btn = new JButton("...");
btn.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
JFileChooser fc = new JFileChooser();
fc.setFileFilter(new FileFilter() {
@Override
public boolean accept(File f) {
if (f.isDirectory()) return true;
String s = f.getAbsolutePath();
return s.toLowerCase().endsWith("wfd");
}
@Override
public String getDescription() {
return "*.wfd|*.wfd";
}
});
if (fc.showOpenDialog(null) ==
JFileChooser.APPROVE_OPTION) {
StringBuffer sb = new StringBuffer();
te.setText(fc.getSelectedFile().getName());
WufiDataFactory wdf = new WufiDataFactory();
try {
IWufiData wd =
wdf.getWufiData(fc.getSelectedFile());
IGrid g = wd.getGrid();
sb.append("Grid:\nx=(");
java.util.List<Float> l = g.getGridLayoutX();
for (int i = 0; i < l.size() - 1; i++) {
sb.append(l.get(i)).append(",");
}
sb.append(l.get(l.size() - 1)).append(")\n");
sb.append("y=(");
l = g.getGridLayoutY();
for (int i = 0; i < l.size() - 1; i++) {
sb.append(l.get(i)).append(",");
}
sb.append(l.get(l.size() - 1)).append(")\n\n");
printLayout(g, wd.getMaterials(), sb);
Map<Enum, float[][]> temp = new HashMap<Enum,
float[][]>();
int x = 1;
int y = 1;
while (g.getGridElement(x, y).getMaterial() ==
null) { //find a non null element
x++;
}
MyPoint pos = new MyPoint(x, y, x + 1, y +
1); //select 4 elements
/*either this and iterate through the data
HashSet<MyPoint> hsPos = new HashSet<MyPoint>();
hsPos.add(pos);
ICalculationResult cr =
wd.getCalculationResults(OneArrayResults.ksTeta,hsPos,wd.getCalcInfo().getStartDate(), wd.getCalcInfo().getEndDate());
or that*/
sb.append("some Data:\n");
for (long step = 0; step < 5/*maxSteps*/; step
++) {
sb.append("Step:
").append(step).append("\n");
if
(wd.getCalcInfo().getResultOptions().get(OneArrayResults.ksTeta))
{ //temperature
wd.getResultElements(OneArrayResults.ksTeta, step, pos,
temp); //retrieve the data
}
if
(wd.getCalcInfo().getResultOptions().get(OneArrayResults.ksRH)) { //rel.
humidity
wd.getResultElements(OneArrayResults.ksRH, step, pos, temp); //retrieve
the data
}
if
(wd.getCalcInfo().getResultOptions().get(OneArrayResults.ksWC)) {//
water content
wd.getResultElements(OneArrayResults.ksWC, step, pos, temp); //retrieve
the data
}
if
(wd.getCalcInfo().getResultOptions().get(OneArrayResults.ksPd))
{//partial press of vapour
wd.getResultElements(OneArrayResults.ksPd, step, pos, temp); //retrieve
the data
}
float[][] d;
if
(temp.containsKey(OneArrayResults.ksTeta)) {
d = temp.get(OneArrayResults.ksTeta);
printData("teta", d, sb);
}
if (temp.containsKey(OneArrayResults.ksRH))
{
d = temp.get(OneArrayResults.ksRH);
printData("rh", d, sb);
}
if (temp.containsKey(OneArrayResults.ksWC))
{
d = temp.get(OneArrayResults.ksWC);
printData("wc", d, sb);
}
if (temp.containsKey(OneArrayResults.ksPd))
{
d = temp.get(OneArrayResults.ksPd);
printData("pd", d, sb);
}
sb.append("\n");
}
ta.setText(sb.toString());
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
});
p.add(btn, BorderLayout.EAST);
add(p, BorderLayout.NORTH);
JButton btn1 = new JButton("Close");
btn1.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
System.exit(0);
}
});
add(btn1, BorderLayout.SOUTH);
pack();
}
public static void main(String[] args) {
Gui gui = new Gui();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
Rectangle r = gui.getBounds();
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
r.translate((d.width - r.width) / 2, (d.height - r.height) / 2);
gui.setBounds(r);
gui.setVisible(true);
}
}
Best regards,
Veit