Several bug fixes and small improvements

This commit is contained in:
2014-08-28 14:25:18 +02:00
parent 1a294a1a75
commit e21b3d64ee
3 changed files with 40 additions and 31 deletions

View File

@@ -3,14 +3,14 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ch.psi</groupId>
<artifactId>fda</artifactId>
<version>2.4.5</version>
<version>2.4.6</version>
<dependencies>
<dependency>
<groupId>ch.psi</groupId>
<artifactId>ch.psi.fda.core</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
<!-- These 3 libraries are just needed for testing -->
@@ -22,12 +22,12 @@
<dependency>
<groupId>ch.psi</groupId>
<artifactId>ch.psi.fda.cdump</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>ch.psi</groupId>
<artifactId>ch.psi.fda.fdaq</artifactId>
<version>2.3.0</version>
<version>2.3.1</version>
</dependency>
<dependency>

View File

@@ -130,7 +130,7 @@ public class VisualizationMain {
visualizer.setUpdateAtStreamElement(false);
visualizer.setUpdateAtStreamDelimiter(false);
visualizer.setUpdateAtEndOfStream(true);
JPanel opanel = new ScrollableFlowPanel();
opanel.setLayout(new FlowLayout());

View File

@@ -61,15 +61,14 @@ public class Visualizer {
private boolean first = true;
public Visualizer(VDescriptor vdescriptor){
this(vdescriptor,null,null);
this(vdescriptor,null);
}
public Visualizer(VDescriptor vdescriptor, String linePlotImpl, String matrixPlotImpl){
public Visualizer(VDescriptor vdescriptor, String linePlotImpl){
if (linePlotImpl==null){
linePlotImpl="jfree";
}
if (matrixPlotImpl==null){
matrixPlotImpl="jfree";
}
String matrixPlotImpl="jfree";
filters = new ArrayList<SeriesDataFilter>();
try{
@@ -95,6 +94,9 @@ public class Visualizer {
// filter.setMaxSeries(lp.getMaxSeries()*lp.getY().size()); // Workaround - keep for each array max series
// filter.setOffset(lp.getOffset());
// filter.setSize(lp.getSize());
filter.setMaxSeries(lp.getMaxSeries());
filter.setOffset(lp.getMinX().intValue());
filter.setSize(Double.valueOf(lp.getMaxX()-lp.getMinX()).intValue());
filter.setSeriesName(sy.getY());
filters.add(filter);
}
@@ -109,6 +111,8 @@ public class Visualizer {
ch.psi.fda.vdescriptor.MatrixPlot lp = (ch.psi.fda.vdescriptor.MatrixPlot) vplot;
MatrixPlotSeries data = new MatrixPlotSeries("", lp.getMinX(), lp.getMaxX(), lp.getnX(), lp.getMinY(), lp.getMaxY(), lp.getnY());
if ("3D".equals(lp.getType()))
matrixPlotImpl="jzy3d";
MatrixPlot plot = MatrixPlotBase.newPlot(matrixPlotImpl);
plot.setTitle(lp.getTitle());
plot.addSeries(data);
@@ -188,9 +192,9 @@ public class Visualizer {
}
// Add Data to the series
/*
series.add(dataX , dataY, updateAtStreamElement);*/
((LinePlot)xyfilter.getPlot()).setUpdatesEnabled(updateAtStreamElement);
series.appendData(dataX , dataY);
((LinePlot)xyfilter.getPlot()).setUpdatesEnabled(true);
}
if(filter instanceof XYSeriesArrayDataFilter){
final XYSeriesArrayDataFilter xyfilter = (XYSeriesArrayDataFilter) filter;
@@ -226,15 +230,12 @@ public class Visualizer {
size = offset + xyfilter.getSize();
}
((LinePlot)xyfilter.getPlot()).setUpdatesEnabled(false);
((LinePlot)xyfilter.getPlot()).setUpdatesEnabled(updateAtStreamElement);
for(int i=offset;i<size;i++){
//series.add(i,data[i], false); // Do not fire change event - this would degrade performance drastically
series.appendData(i,data[i]);
}
((LinePlot)xyfilter.getPlot()).setUpdatesEnabled(updateAtStreamElement);
// series.fireSeriesChanged();
((LinePlot)xyfilter.getPlot()).setUpdatesEnabled(true);
}
});
@@ -242,7 +243,9 @@ public class Visualizer {
else if(filter instanceof XYZSeriesDataFilter){
XYZSeriesDataFilter xyzfilter = (XYZSeriesDataFilter) filter;
try{
xyzfilter.getPlot().setUpdatesEnabled(updateAtStreamElement);
xyzfilter.getSeries().appendData((Double) message.getData(xyzfilter.getIdX()),(Double) message.getData(xyzfilter.getIdY()), (Double) message.getData(xyzfilter.getIdZ()));
xyzfilter.getPlot().setUpdatesEnabled(true);
}
catch (Exception e) {
// Ignore if something goes wrong while adding a datapoint
@@ -257,15 +260,11 @@ public class Visualizer {
// int offset = xyzfilter.getOffset();
// int size = xyzfilter.getSize();
// for(int i=offset;i<offset+size; i++){
xyzfilter.getPlot().setUpdatesEnabled(updateAtStreamElement);
for(int i=0;i<data.length; i++){
((MatrixPlot)xyzfilter.getPlot()).getSeries("").appendData(i, y, data[i]);
}
/*
// Update data if update by point is enabled
if(updateAtStreamElement){
xyzfilter.getPlot().update(false);
}
*/
xyzfilter.getPlot().setUpdatesEnabled(true);
}
catch (Exception e) {
// Ignore if something goes wrong while adding a datapoint
@@ -293,9 +292,8 @@ public class Visualizer {
// Update matrix plot at the end of each line
if(updateAtStreamDelimiter){
for(SeriesDataFilter f: filters){
Plot plot = f.getPlot();
plot.update(true);
for (Plot plot:getPlots()) {
plot.update(true);
}
}
@@ -315,10 +313,9 @@ public class Visualizer {
// Update plots if updateAtEndOfStream flag is set
if(updateAtEndOfStream){
// Update matrix plots
for(SeriesDataFilter f: filters){
Plot plot = f.getPlot();
for (Plot plot:getPlots()) {
plot.update(true);
}
}
}
}
@@ -334,13 +331,25 @@ public class Visualizer {
public List<JPanel> getPlotPanels(){
List<JPanel> panels = new ArrayList<JPanel>();
for(SeriesDataFilter f: filters){
panels.add(f.getPlot().getChartPanel());
JPanel panel=f.getPlot().getChartPanel();
if ((panel!=null) &&(!panels.contains(panel)))
panels.add(panel);
}
return panels;
}
public boolean isUpdateAtStreamElement() {
public List<Plot> getPlots(){
List<Plot> plots = new ArrayList<Plot>();
for(SeriesDataFilter f: filters){
Plot plot=f.getPlot();
if ((plot!=null) &&(!plots.contains(plot)))
plots.add(plot);
}
return plots;
}
public boolean isUpdateAtStreamElement() {
return updateAtStreamElement;
}
public void setUpdateAtStreamElement(boolean updateAtStreamElement) {