}
}
public SvgPlot getPlot(Quantity x, Quantity y, String title, Wpt[] pts)
throws FunctionEvaluationException {
SvgPlot plot = new SvgPlot();
plot.setTitle(SvgPlot.PlotDesignation.GLOBAL, title);
for (double[] xx : getSupportPoints()) {
final int n = xx.length;
double[] xdata = new double[n];
double[] ydata = new double[n];
for (int i = 0; i < n; i++) {
Date d = new Date((long) xx[i]);
xdata[i] = unitConversion(x, getQuantity(d, x));
ydata[i] = unitConversion(y, getQuantity(d, y));
}
plot.addData(xdata, ydata);
}
for (Wpt wpt : pts) {
for (Date d : timeWpt(wpt, 0.01)) {
try {
plot.addPoint(unitConversion(x, getQuantity(d, x)),
unitConversion(y, getQuantity(d, y)), wpt.getName());
} catch (Exception err) {
System.err.println("Warning: Cannot plot Wpt:");
System.err.println(wpt.getName());
System.err.println(wpt.getLon());
System.err.println(wpt.getLat());
DateFormat df = new SimpleDateFormat(GPSDings.ISO_DATE
+ "'Z'");
df.setTimeZone(GPSDings.UTC);
System.err.println(df.format(d));
System.err.println(err);
}
}
}
plot.setTitle(SvgPlot.PlotDesignation.X, getAxisTitle(x));
plot.setTitle(SvgPlot.PlotDesignation.Y, getAxisTitle(y));
return plot;
}