*ScatterDraw: Fixed problem in Drawing

git-svn-id: svn://ultimatepp.org/upp/trunk@6421 f0d560ea-af0d-0410-9eb7-867de7ffcac7
This commit is contained in:
koldo 2013-10-11 20:05:41 +00:00
parent d51b520863
commit 56618accfc
3 changed files with 12 additions and 8 deletions

View file

@ -16,13 +16,13 @@ public:
TooManyFunctionEvaluation = -4
};
FitError Fit(DataSource &series, double &r2);
FitError Fit(DataSource &series) {double dummy; return Fit(series, dummy);}
FitError Fit(DataSource &series) {double dummy; return Fit(series, dummy);}
virtual double f(double x1) = 0;
virtual double f(double x1, double x2) {NEVER(); return Null;}
virtual double f(Vector <double> x) {NEVER(); return Null;}
virtual String GetName() = 0;
virtual String GetFullName() {return GetName();}
virtual String GetFullName() {return GetName();}
virtual String GetEquation() = 0;
void SetNumDigits(int n) {numDigits = n;}
@ -32,6 +32,8 @@ public:
friend struct Equation_functor;
const Array<double> &GetCoeff() {return coeff;}
protected:
Array<double> coeff;
int degree;
@ -45,6 +47,7 @@ protected:
}
void SetCoeff(double c0, double c1, double c2) {coeff.Clear(); coeff << c0 << c1 << c2;}
void SetCoeff(double c0, double c1) {coeff.Clear(); coeff << c0 << c1;}
void SetCoeff(double c0) {coeff.Clear(); coeff << c0;}
void SetCoeffVal(int id, double c) {coeff[id] = c;}
};

View file

@ -923,7 +923,7 @@ Drawing ScatterDraw::GetDrawing(bool ctrl)
{
DrawingDraw ddw(3*GetSize());
SetDrawing(ddw, GetSize(), 3);
SetDrawing(ddw, GetSize(), 3, ctrl, true);
if (ctrl)
PlotTexts(ddw, GetSize(), 3);
@ -938,7 +938,7 @@ Image ScatterDraw::GetImage(const Size &size, int scale, bool ctrl)
ImageBuffer ib(scale*size);
BufferPainter bp(ib, mode);
SetDrawing(bp, size, scale);
SetDrawing(bp, size, scale, ctrl);
if (ctrl)
PlotTexts(bp, size, scale);

View file

@ -458,7 +458,7 @@ protected:
String VariableFormatY2(double d) const {return VariableFormat(yRange2, d);}
template<class T>
void SetDrawing(T& w, const Size &size, int scale, bool ctrl = false);
void SetDrawing(T& w, const Size &size, int scale, bool ctrl = false, bool setD = false);
template<class T>
void Plot(T& w, const Size &size, int scale);
template<class T>
@ -476,7 +476,7 @@ private:
};
template <class T>
void ScatterDraw::SetDrawing(T& w, const Size& size, int scale, bool ctrl)
void ScatterDraw::SetDrawing(T& w, const Size& size, int scale, bool ctrl, bool setD)
{
if (size.cx == 0 || size.cy == 0)
return;
@ -496,9 +496,10 @@ void ScatterDraw::SetDrawing(T& w, const Size& size, int scale, bool ctrl)
Plot(w, size, scale);
ClipEnd(w);
if (ctrl)
ClipEnd(w);
if (!setD)
w.Offset(Point(-scale*hPlotLeft, -(scale*vPlotTop + titleHeight)));
}