"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "uppsrc/ScatterCtrl/Processing.cpp" between
upp-x11-src-13648.tar.gz and upp-x11-src-13659.tar.gz

About: Ultimate++ is a C++ cross-platform rapid application development framework. Stable release.

Processing.cpp  (upp-x11-src-13648):Processing.cpp  (upp-x11-src-13659)
skipping to change at line 201 skipping to change at line 201
} }
void ProcessingTab::OnArrayBar(Bar &menu) { void ProcessingTab::OnArrayBar(Bar &menu) {
menu.Add(t_("Select all"), Null, THISBACK(ArraySelect)).Key(K_CTRL_A).Hel p(t_("Select all rows")); menu.Add(t_("Select all"), Null, THISBACK(ArraySelect)).Key(K_CTRL_A).Hel p(t_("Select all rows"));
menu.Add(t_("Copy"), ScatterImgP::Copy(), THISBACK(ArrayCopy)).Key(K_CTRL _C).Help(t_("Copy selected rows")); menu.Add(t_("Copy"), ScatterImgP::Copy(), THISBACK(ArrayCopy)).Key(K_CTRL _C).Help(t_("Copy selected rows"));
} }
void ProcessingTab::OnFit() { void ProcessingTab::OnFit() {
WaitCursor waitcursor; WaitCursor waitcursor;
DataSource &ds = pscatter->GetSeries(id); DataSource &ds = pscatter->GetDataSource(id);
userEquation->Init("User", ~tabBestFitRight.userFormula, "x"); userEquation->Init("User", ~tabBestFitRight.userFormula, "x");
Array<double> r2; Array<double> r2;
r2.SetCount(equationTypes.GetCount()); r2.SetCount(equationTypes.GetCount());
for (int i = 0; i < equationTypes.GetCount(); ++i) { for (int i = 0; i < equationTypes.GetCount(); ++i) {
equationTypes[i].GuessCoeff(ds); equationTypes[i].GuessCoeff(ds);
equationTypes[i].Fit(ds, r2[i]); equationTypes[i].Fit(ds, r2[i]);
} }
skipping to change at line 233 skipping to change at line 233
case 2: numDecimals = Null; break; case 2: numDecimals = Null; break;
} }
tabBestFitRight.gridTrend.Clear(); tabBestFitRight.gridTrend.Clear();
for (int i = 0; i < equationTypes.GetCount(); ++i) for (int i = 0; i < equationTypes.GetCount(); ++i)
tabBestFitRight.gridTrend.Add(equationTypes[i].GetFullName(), equ ationTypes[i].GetEquation(numDecimals), r2[i]); tabBestFitRight.gridTrend.Add(equationTypes[i].GetFullName(), equ ationTypes[i].GetEquation(numDecimals), r2[i]);
tabBestFitRight.gridTrend.SetSortColumn(2, true); tabBestFitRight.gridTrend.SetSortColumn(2, true);
} }
void ProcessingTab::OnOp() void ProcessingTab::OnOp()
{ {
DataSource &data = tabFitLeft.scatter.GetSeries(0); DataSource &data = tabFitLeft.scatter.GetDataSource(0);
if (data.IsParam() || data.IsExplicit()) if (data.IsParam() || data.IsExplicit())
return; return;
if (tabFitRight.opAverage && avgFirst) { if (tabFitRight.opAverage && avgFirst) {
double r2; double r2;
average.Fit(data, r2); average.Fit(data, r2);
avgFirst = false; avgFirst = false;
} }
if (tabFitRight.opLinear && linearFirst) { if (tabFitRight.opLinear && linearFirst) {
skipping to change at line 328 skipping to change at line 328
tabFitLeft.scatter.ScatterDraw::Show(10,tabFitRight.opMovAvg); tabFitLeft.scatter.ScatterDraw::Show(10,tabFitRight.opMovAvg);
tabFitLeft.scatter.ScatterDraw::Show(11,tabFitRight.opSecAvg); tabFitLeft.scatter.ScatterDraw::Show(11,tabFitRight.opSecAvg);
tabFitLeft.scatter.ScatterDraw::Show(12,tabFitRight.opCumAvg); tabFitLeft.scatter.ScatterDraw::Show(12,tabFitRight.opCumAvg);
UpdateEquations(); UpdateEquations();
OnShowEquation(); OnShowEquation();
} }
void ProcessingTab::OnAutoSensSector() void ProcessingTab::OnAutoSensSector()
{ {
DataSource &data = tabFitLeft.scatter.GetSeries(0); DataSource &data = tabFitLeft.scatter.GetDataSource(0);
Vector<Pointf> secAvg; Vector<Pointf> secAvg;
double baseWidth; double baseWidth;
baseWidth = 0; baseWidth = 0;
for (int64 i = 1; i < data.GetCount(); ++i) for (int64 i = 1; i < data.GetCount(); ++i)
baseWidth += (data.x(i) - data.x(i-1)); baseWidth += (data.x(i) - data.x(i-1));
baseWidth /= (data.GetCount() - 1); baseWidth /= (data.GetCount() - 1);
double rangeX = data.x(data.GetCount() - 1) - data.x(int64(0)); double rangeX = data.x(data.GetCount() - 1) - data.x(int64(0));
skipping to change at line 365 skipping to change at line 365
return; return;
exclamationOpened = true; exclamationOpened = true;
if (!IsNull(tabOpRight.xLow) && !IsNull(tabOpRight.xHigh)) { if (!IsNull(tabOpRight.xLow) && !IsNull(tabOpRight.xHigh)) {
if (tabOpRight.xLow >= tabOpRight.xHigh) { if (tabOpRight.xLow >= tabOpRight.xHigh) {
Exclamation(t_("'x >' has to be lower than 'x <'")); Exclamation(t_("'x >' has to be lower than 'x <'"));
exclamationOpened = false; exclamationOpened = false;
return; return;
} }
} }
exclamationOpened = false; exclamationOpened = false;
dataXRange.Init(pscatter->GetSeries(id), tabOpRight.xLow, tabOpRight.xHig h); dataXRange.Init(pscatter->GetDataSource(id), tabOpRight.xLow, tabOpRight. xHigh);
tabOpLeft.scatter.Refresh(); tabOpLeft.scatter.Refresh();
} }
void ProcessingTab::UpdateField(const String _name, int _id) void ProcessingTab::UpdateField(const String _name, int _id)
{ {
id = _id; id = _id;
name.SetText(_name); name.SetText(_name);
tabFitLeft.scatter.RemoveAllSeries(); tabFitLeft.scatter.RemoveAllSeries();
tabFitLeft.scatter.AddSeries(pscatter->GetSeries(id)).SetSequentialX(psca tter->GetSequentialX()) tabFitLeft.scatter.AddSeries(pscatter->GetDataSource(id)).SetSequentialX( pscatter->GetSequentialX())
.Legend(pscatter->GetLegend(id)); .Legend(pscatter->GetLegend(id));
tabFitLeft.scatter.SetFastViewX(pscatter->GetFastViewX()); tabFitLeft.scatter.SetFastViewX(pscatter->GetFastViewX());
tabFitLeft.scatter.SetFillColor(0, pscatter->GetFillColor(id)); tabFitLeft.scatter.SetFillColor(0, pscatter->GetFillColor(id));
tabFitLeft.scatter.Dash(0, pscatter->GetDash(id)); tabFitLeft.scatter.Dash(0, pscatter->GetDash(id));
Upp::Color color; Upp::Color color;
double thickness; double thickness;
pscatter->GetStroke(0, thickness, color); pscatter->GetStroke(0, thickness, color);
tabFitLeft.scatter.Stroke(0, thickness, color); tabFitLeft.scatter.Stroke(0, thickness, color);
skipping to change at line 402 skipping to change at line 402
tabFitLeft.scatter.Units(0, pscatter->GetUnitsY(id), pscatter->GetUnitsX( id)); tabFitLeft.scatter.Units(0, pscatter->GetUnitsY(id), pscatter->GetUnitsX( id));
tabFitLeft.scatter.SetLabelX(pscatter->GetLabelX()); tabFitLeft.scatter.SetLabelX(pscatter->GetLabelX());
bool primary = pscatter->IsDataPrimaryY(id); bool primary = pscatter->IsDataPrimaryY(id);
tabFitLeft.scatter.SetRange(pscatter->GetXRange(), primary ? pscatter->GetYR ange() : pscatter->GetY2Range()); tabFitLeft.scatter.SetRange(pscatter->GetXRange(), primary ? pscatter->GetYR ange() : pscatter->GetY2Range());
tabFitLeft.scatter.SetMajorUnits(pscatter->GetMajorUnitsX(), primary ? ps catter->GetMajorUnitsY() : pscatter->GetMajorUnitsY2()); tabFitLeft.scatter.SetMajorUnits(pscatter->GetMajorUnitsX(), primary ? ps catter->GetMajorUnitsY() : pscatter->GetMajorUnitsY2());
tabFitLeft.scatter.SetXYMin(pscatter->GetXMin(), primary ? pscatter->GetY Min() : pscatter->GetY2Min()); tabFitLeft.scatter.SetXYMin(pscatter->GetXMin(), primary ? pscatter->GetY Min() : pscatter->GetY2Min());
tabFitLeft.scatter.ShowInfo().ShowContextMenu().ShowProcessDlg().ShowProp ertiesDlg().SetMouseHandlingLinked(true, true); tabFitLeft.scatter.ShowInfo().ShowContextMenu().ShowProcessDlg().ShowProp ertiesDlg().SetMouseHandlingLinked(true, true);
DataSource &data = tabFitLeft.scatter.GetSeries(0); DataSource &data = tabFitLeft.scatter.GetDataSource(0);
if (!data.IsParam()/* && !data.IsExplicit()*/) { if (!data.IsParam()/* && !data.IsExplicit()*/) {
double avg = data.AvgY(); double avg = data.AvgY();
tabFitRight.eAverage = avg; tabFitRight.eAverage = avg;
tabFitRight.eRMS = data.RMSY(); tabFitRight.eRMS = data.RMSY();
tabFitRight.eStdDev = data.StdDevY(avg); tabFitRight.eStdDev = data.StdDevY(avg);
int64 idmx; int64 idmx;
double val; double val;
val = data.MaxY(idmx); val = data.MaxY(idmx);
if (!IsNull(val)) { if (!IsNull(val)) {
skipping to change at line 463 skipping to change at line 463
tabFitRight.opMovAvg.Enable(false); tabFitRight.opMovAvg.Enable(false);
tabFitRight.opSecAvg.Enable(false); tabFitRight.opSecAvg.Enable(false);
tabFitRight.opCumAvg.Enable(false); tabFitRight.opCumAvg.Enable(false);
} }
Show(); Show();
} }
void ProcessingTab::OnUpdateSensitivity() void ProcessingTab::OnUpdateSensitivity()
{ {
DataSource &data = tabFitLeft.scatter.GetSeries(0); DataSource &data = tabFitLeft.scatter.GetDataSource(0);
bool refresh = false; bool refresh = false;
if (tabFitRight.opMax && newWidthMax != tabFitRight.width) { if (tabFitRight.opMax && newWidthMax != tabFitRight.width) {
newWidthMax = tabFitRight.width; newWidthMax = tabFitRight.width;
upperEnvelope.Clear(); upperEnvelope.Clear();
Vector<int64> idsUpper = data.UpperEnvelopeY(tabFitRight.width); Vector<int64> idsUpper = data.UpperEnvelopeY(tabFitRight.width);
for (int i = 0; i < idsUpper.GetCount(); ++i) for (int i = 0; i < idsUpper.GetCount(); ++i)
upperEnvelope << Pointf(data.x(idsUpper[i]), data.y(idsUp per[i])); upperEnvelope << Pointf(data.x(idsUpper[i]), data.y(idsUp per[i]));
refresh = true; refresh = true;
skipping to change at line 507 skipping to change at line 507
cumAvg = data.CumulativeAverageY(); cumAvg = data.CumulativeAverageY();
refresh = true; refresh = true;
} }
if (refresh) if (refresh)
tabFitLeft.scatter.Refresh(); tabFitLeft.scatter.Refresh();
} }
void ProcessingTab::OnSet() void ProcessingTab::OnSet()
{ {
DataSource &data = tabFitLeft.scatter.GetSeries(0); DataSource &data = tabFitLeft.scatter.GetDataSource(0);
if (tabFreqFirst && tab.Get() == 1) { if (tabFreqFirst && tab.Get() == 1) {
tabFreqFirst = false; tabFreqFirst = false;
if (data.IsParam() || data.IsExplicit()) { if (data.IsParam() || data.IsExplicit()) {
tabFreqLeft.comments.SetText(t_("Impossible to calculate FFT from a not sampled series")); tabFreqLeft.comments.SetText(t_("Impossible to calculate FFT from a not sampled series"));
tabFreqRight.butFFT.Enable(false); tabFreqRight.butFFT.Enable(false);
} else if (data.GetCount() < 5) { } else if (data.GetCount() < 5) {
tabFreqLeft.comments.SetText(t_("Insufficient data to cal culate FFT")); tabFreqLeft.comments.SetText(t_("Insufficient data to cal culate FFT"));
tabFreqRight.butFFT.Enable(false); tabFreqRight.butFFT.Enable(false);
} else { } else {
skipping to change at line 540 skipping to change at line 540
tabFreqLeft.comments.SetText(Format(t_("Sampling time changes from %f to %f"), mindT, maxdT)); tabFreqLeft.comments.SetText(Format(t_("Sampling time changes from %f to %f"), mindT, maxdT));
else else
tabFreqLeft.comments.SetText(""); tabFreqLeft.comments.SetText("");
tabFreqRight.samplingTime = (maxdT + mindT)/2.; tabFreqRight.samplingTime = (maxdT + mindT)/2.;
} }
} else if (tabOpFirst && tab.Get() == 2) { } else if (tabOpFirst && tab.Get() == 2) {
tabOpFirst = false; tabOpFirst = false;
tabOpLeft.scatter.RemoveAllSeries(); tabOpLeft.scatter.RemoveAllSeries();
String legend = pscatter->GetLegend(id); String legend = pscatter->GetLegend(id);
double xLow = pscatter->GetSeries(id).MinX(); double xLow = pscatter->GetDataSource(id).MinX();
if (IsNull(xLow)) if (IsNull(xLow))
xLow = pscatter->GetXMin(); xLow = pscatter->GetXMin();
tabOpRight.xLow <<= xLow; tabOpRight.xLow <<= xLow;
double xHigh = pscatter->GetSeries(id).MaxX(); double xHigh = pscatter->GetDataSource(id).MaxX();
if (IsNull(xHigh)) if (IsNull(xHigh))
xHigh = pscatter->GetXMin() + pscatter->GetXRange(); xHigh = pscatter->GetXMin() + pscatter->GetXRange();
tabOpRight.xHigh <<= xHigh; tabOpRight.xHigh <<= xHigh;
dataXRange.Init(pscatter->GetSeries(id), xLow, xHigh); dataXRange.Init(pscatter->GetDataSource(id), xLow, xHigh);
tabOpLeft.scatter.AddSeries(dataXRange).SetSequentialX(pscatter-> GetSequentialX()) tabOpLeft.scatter.AddSeries(dataXRange).SetSequentialX(pscatter-> GetSequentialX())
.Legend(legend + String("-") + t_("Pro cessed")).NoMark() .Legend(legend + String("-") + t_("Pro cessed")).NoMark()
.Stroke(8, Upp::Color(115, 214, 74)); .Stroke(8, Upp::Color(115, 214, 74));
tabOpLeft.scatter.AddSeries(pscatter->GetSeries(id)).SetSequentia lX(pscatter->GetSequentialX()) tabOpLeft.scatter.AddSeries(pscatter->GetDataSource(id)).SetSeque ntialX(pscatter->GetSequentialX())
.Legend(legend).NoMark().Stroke(2, Blu e()); .Legend(legend).NoMark().Stroke(2, Blu e());
tabOpLeft.scatter.SetFastViewX(pscatter->GetFastViewX()); tabOpLeft.scatter.SetFastViewX(pscatter->GetFastViewX());
tabOpLeft.scatter.SetLegendAnchor(ScatterDraw::RIGHT_TOP).SetLege ndFillColor(Null); tabOpLeft.scatter.SetLegendAnchor(ScatterDraw::RIGHT_TOP).SetLege ndFillColor(Null);
tabOpLeft.scatter.Units(0, pscatter->GetUnitsY(id), pscatter->Get UnitsX(id)); tabOpLeft.scatter.Units(0, pscatter->GetUnitsY(id), pscatter->Get UnitsX(id));
tabOpLeft.scatter.SetLabelX(pscatter->GetLabelX()); tabOpLeft.scatter.SetLabelX(pscatter->GetLabelX());
bool primary = pscatter->IsDataPrimaryY(id); bool primary = pscatter->IsDataPrimaryY(id);
tabOpLeft.scatter.SetRange(pscatter->GetXRange(), primary ? pscat ter->GetYRange() : pscatter->GetY2Range()); tabOpLeft.scatter.SetRange(pscatter->GetXRange(), primary ? pscat ter->GetYRange() : pscatter->GetY2Range());
tabOpLeft.scatter.SetMajorUnits(pscatter->GetMajorUnitsX(), prima ry ? pscatter->GetMajorUnitsY() : pscatter->GetMajorUnitsY2()); tabOpLeft.scatter.SetMajorUnits(pscatter->GetMajorUnitsX(), prima ry ? pscatter->GetMajorUnitsY() : pscatter->GetMajorUnitsY2());
tabOpLeft.scatter.SetXYMin(pscatter->GetXMin(), primary ? pscatte r->GetYMin() : pscatter->GetY2Min()); tabOpLeft.scatter.SetXYMin(pscatter->GetXMin(), primary ? pscatte r->GetYMin() : pscatter->GetY2Min());
tabOpLeft.scatter.ShowInfo().ShowContextMenu().ShowProcessDlg().S howPropertiesDlg().SetMouseHandlingLinked(true, true); tabOpLeft.scatter.ShowInfo().ShowContextMenu().ShowProcessDlg().S howPropertiesDlg().SetMouseHandlingLinked(true, true);
} else if (tabBestFitFirst && tab.Get() == 3) { } else if (tabBestFitFirst && tab.Get() == 3) {
tabBestFitFirst = false; tabBestFitFirst = false;
tabBestFitLeft.scatter.RemoveAllSeries(); tabBestFitLeft.scatter.RemoveAllSeries();
String legend = pscatter->GetLegend(id); String legend = pscatter->GetLegend(id);
tabBestFitLeft.scatter.AddSeries(pscatter->GetSeries(id)).SetSequ entialX(pscatter->GetSequentialX()) tabBestFitLeft.scatter.AddSeries(pscatter->GetDataSource(id)).Set SequentialX(pscatter->GetSequentialX())
.Legend(legend).NoMark().Stroke(2); .Legend(legend).NoMark().Stroke(2);
tabBestFitLeft.scatter.SetFastViewX(pscatter->GetFastViewX()); tabBestFitLeft.scatter.SetFastViewX(pscatter->GetFastViewX());
tabBestFitLeft.scatter.SetLegendAnchor(ScatterDraw::RIGHT_TOP).Se tLegendFillColor(Null); tabBestFitLeft.scatter.SetLegendAnchor(ScatterDraw::RIGHT_TOP).Se tLegendFillColor(Null);
tabBestFitLeft.scatter.Units(0, pscatter->GetUnitsY(id), pscatter ->GetUnitsX(id)); tabBestFitLeft.scatter.Units(0, pscatter->GetUnitsY(id), pscatter ->GetUnitsX(id));
tabBestFitLeft.scatter.SetLabelX(pscatter->GetLabelX()); tabBestFitLeft.scatter.SetLabelX(pscatter->GetLabelX());
bool primary = pscatter->IsDataPrimaryY(id); bool primary = pscatter->IsDataPrimaryY(id);
tabBestFitLeft.scatter.SetRange(pscatter->GetXRange(), primary ? pscatter->GetYRange() : pscatter->GetY2Range()); tabBestFitLeft.scatter.SetRange(pscatter->GetXRange(), primary ? pscatter->GetYRange() : pscatter->GetY2Range());
skipping to change at line 638 skipping to change at line 638
tabFreqLeft.scatter.RemoveAllSeries(); tabFreqLeft.scatter.RemoveAllSeries();
double samplingTime = tabFreqRight.samplingTime; double samplingTime = tabFreqRight.samplingTime;
if (samplingTime < 0) { if (samplingTime < 0) {
Exclamation(t_("Incorrect sampling time")); Exclamation(t_("Incorrect sampling time"));
return; return;
} }
int64 idMaxFFT; int64 idMaxFFT;
{ {
WaitCursor waitcursor; WaitCursor waitcursor;
DataSource &data = tabFitLeft.scatter.GetSeries(0); DataSource &data = tabFitLeft.scatter.GetDataSource(0);
Vector<Pointf> orderedSeries; Vector<Pointf> orderedSeries;
for (int64 i = 0; i < data.GetCount(); ++i) { // Clean Nulls for (int64 i = 0; i < data.GetCount(); ++i) { // Clean Nulls
if (!IsNull(data.x(i)) && !IsNull(data.y(i))) if (!IsNull(data.x(i)) && !IsNull(data.y(i)))
orderedSeries << Pointf(data.x(i), data.y(i)); orderedSeries << Pointf(data.x(i), data.y(i));
} }
//if (orderedSeries.GetCount() != data.GetCount()) //if (orderedSeries.GetCount() != data.GetCount())
// errText << Format(t_("Removed %d Null points."), data.Get Count() - orderedSeries.GetCount()); // errText << Format(t_("Removed %d Null points."), data.Get Count() - orderedSeries.GetCount());
PointfLess less; PointfLess less;
 End of changes. 14 change blocks. 
14 lines changed or deleted 14 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)