new plotter
This commit is contained in:
parent
76719407db
commit
f792e4c8ec
@ -5,6 +5,7 @@ import jscl.math.Generic;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.solovyev.android.calculator.core.R;
|
||||
import org.solovyev.android.calculator.jscl.JsclOperation;
|
||||
import org.solovyev.android.calculator.plot.CalculatorPlotter;
|
||||
import org.solovyev.android.calculator.view.NumeralBaseConverterDialog;
|
||||
import org.solovyev.android.menu.LabeledMenuItem;
|
||||
|
||||
@ -79,9 +80,8 @@ public enum CalculatorDisplayMenuItem implements LabeledMenuItem<CalculatorDispl
|
||||
final Generic expression = data.getResult();
|
||||
assert expression != null;
|
||||
|
||||
Locator.getInstance().getPlotter().removeAllUnpinned();
|
||||
Locator.getInstance().getPlotter().addFunction(expression);
|
||||
Locator.getInstance().getPlotter().plot();
|
||||
final CalculatorPlotter plotter = Locator.getInstance().getPlotter();
|
||||
plotter.plot(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -123,6 +123,11 @@ public class AndroidCalculatorPlotter implements CalculatorPlotter, SharedPrefer
|
||||
plotter.plot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void plot(@NotNull Generic expression) {
|
||||
plotter.plot(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean is2dPlotPossible() {
|
||||
return plotter.is2dPlotPossible();
|
||||
|
@ -47,6 +47,7 @@ public interface CalculatorPlotter {
|
||||
List<PlotFunction> getVisibleFunctions();
|
||||
|
||||
void plot();
|
||||
void plot(@NotNull Generic expression);
|
||||
|
||||
boolean is2dPlotPossible();
|
||||
|
||||
|
@ -27,6 +27,8 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
||||
@NotNull
|
||||
private final Calculator calculator;
|
||||
|
||||
private final PlotResourceManager plotResourceManager = new PlotResourceManager();
|
||||
|
||||
private boolean plot3d = false;
|
||||
|
||||
private boolean plotImag = false;
|
||||
@ -77,6 +79,11 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
||||
return imagAdded || realAdded;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private PlotFunction newPlotFunction(@NotNull XyFunction xyFunction) {
|
||||
return new PlotFunction(xyFunction);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addFunction(@NotNull PlotFunction plotFunction) {
|
||||
synchronized (functions) {
|
||||
@ -258,6 +265,13 @@ public class CalculatorPlotterImpl implements CalculatorPlotter {
|
||||
calculator.fireCalculatorEvent(CalculatorEventType.plot_graph, null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void plot(@NotNull Generic expression) {
|
||||
removeAllUnpinned();
|
||||
addFunction(expression);
|
||||
plot();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean is2dPlotPossible() {
|
||||
return arity < 2;
|
||||
|
@ -0,0 +1,10 @@
|
||||
package org.solovyev.android.calculator.plot;
|
||||
|
||||
/**
|
||||
* User: serso
|
||||
* Date: 1/13/13
|
||||
* Time: 8:19 PM
|
||||
*/
|
||||
class PlotResourceManager {
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user