new plotter

This commit is contained in:
Sergey Solovyev
2013-01-19 02:47:33 +04:00
parent 6af5239c6e
commit 05e9026048
13 changed files with 165 additions and 71 deletions

View File

@@ -34,7 +34,7 @@ public abstract class AbstractGraphCalculator implements GraphCalculator {
}
float yMin = graphsData.getLastYMin();
float yMax = graphsData.getLastYMin();
float yMax = graphsData.getLastYMax();
// prepare graph
if (!graph.empty()) {

View File

@@ -154,11 +154,10 @@ public class CalculatorGraph2dView extends View implements GraphView {
@Override
public void invalidateGraphs() {
graphsData.clear();
if (mDrawn) {
mDrawn = false;
graphsData.clear();
invalidate();
}
}

View File

@@ -1,5 +1,3 @@
// Copyright (C) 2009 Mihai Preda
package org.solovyev.android.calculator.plot;
import android.content.Context;
@@ -18,7 +16,7 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
public class Graph3dView extends GLView implements GraphView {
public class CalculatorGraph3dView extends GLView implements GraphView {
private boolean useHighQuality3d = Build.VERSION.SDK_INT >= 5;
@@ -37,12 +35,12 @@ public class Graph3dView extends GLView implements GraphView {
@NotNull
private GraphViewHelper graphViewHelper = GraphViewHelper.newDefaultInstance();
public Graph3dView(Context context, AttributeSet attrs) {
public CalculatorGraph3dView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
public Graph3dView(Context context) {
public CalculatorGraph3dView(Context context) {
super(context);
touchHandler = new TouchHandler(this);
init();

View File

@@ -39,16 +39,20 @@ public class CalculatorPlotFragment extends AbstractCalculatorPlotFragment {
}
if ( plotData.isPlot3d() ) {
graphView = new Graph3dView(getActivity());
graphView = new CalculatorGraph3dView(getActivity());
} else {
graphView = new CalculatorGraph2dView(getActivity());
}
// todo serso: investigate (after switching from 3d to 2d - blank screen)
graphView.init(PlotViewDef.newInstance(Color.WHITE, Color.WHITE, Color.DKGRAY, getBgColor()));
//graphView.setXRange((float)plotBoundaries.getXMin(), (float)plotBoundaries.getXMax());
graphView.setPlotFunctions(plotData.getFunctions());
graphContainer.addView((View) graphView);
if (graphView instanceof View) {
graphContainer.addView((View) graphView);
}
}
@Override