new plotter

This commit is contained in:
Sergey Solovyev
2013-01-19 16:53:09 +04:00
parent 2ebf5841e1
commit 4e6d49abf4
7 changed files with 78 additions and 30 deletions

View File

@@ -65,11 +65,20 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
yVariable = null;
}
final PlotFunction realPlotFunction = newPlotFunction(new XyFunction(expression, xVariable, yVariable, false));
final PlotFunction imagPlotFunction = newPlotFunction(new XyFunction(expression, xVariable, yVariable, true));
final XyFunction realXyFunction = new XyFunction(expression, xVariable, yVariable, false);
final XyFunction imagXyFunction = new XyFunction(expression, xVariable, yVariable, true);
// first create plot functions with default line definitions
PlotFunction realPlotFunction = new PlotFunction(realXyFunction);
PlotFunction imagPlotFunction = new PlotFunction(imagXyFunction);
// then remove all unpinned graphs and free their line definitions
removeAllUnpinnedExcept(realPlotFunction, imagPlotFunction);
// create plot functions with freed line definitions
realPlotFunction = newPlotFunction(realXyFunction);
imagPlotFunction = newPlotFunction(imagXyFunction);
final boolean realAdded = addFunction(realPlotFunction);
final boolean imagAdded = addFunction(plotImag ? imagPlotFunction : PlotFunction.invisible(imagPlotFunction));
@@ -95,7 +104,6 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
}
}
private boolean removeAllUnpinnedExcept(@NotNull final PlotFunction... exceptFunctions) {
synchronized (functions) {

View File

@@ -12,16 +12,16 @@ public enum PlotLineColor {
// Color.WHITE
white(0xFFFFFFFF),
// Color.GRAY
grey(0xFF888888),
blue(0xFF10648C),
// Color.RED
red(0xFFFF0000),
blue(0xFF10648C),
// Color.GREEN
green(0xFF00FF00);
green(0xFF00FF00),
// Color.GRAY
grey(0xFF888888);
private final int color;