Commit 114add71 authored by Locatelli's avatar Locatelli
Browse files

Correct some bugs:

- Remove ending core on mainplot, missing waiting on thread.
- Allow empty data in plod1d for cut window.
parent 28b81548
......@@ -242,6 +242,9 @@ int32 main(int32 argc, char* argv[]) {
}
app->exec();
plotwindow.reset();
frontsubscriber->cancel();
frontRequestThread.join();
}
}
else {
......@@ -256,7 +259,6 @@ int32 main(int32 argc, char* argv[]) {
// Cancel subscribers
datachangesubscriber->cancel();
frontsubscriber->cancel();
// Clean manager
manager::ServerRequesterManager::resetInstance();
......
......@@ -90,141 +90,139 @@ void Plot1D::display() throw (Error) {
*/
void Plot1D::localplot(uint32 numplot) throw (Error) {
if ((m_PlotXArrays[numplot].size() != 0) && (m_PlotYArrays[numplot].size() != 0)) {
////
//// Set plot parameters
////
string label = getLegendKey(numplot);
string color = string("#") + getColor(numplot);
////
//// Plot arrays
////
if (m_PlotXArrays[numplot].size() == m_PlotYArrays[numplot].size()) {
if ((m_PlotXPropertyTypes[numplot] == "int32array") && (m_PlotYPropertyTypes[numplot] == "int32array")) {
try {
plot(numplot, m_PlotXArrays[numplot], m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot data", "x = int32array , y = int32array");
}
} else if ((m_PlotXPropertyTypes[numplot] == "float64array") && (m_PlotYPropertyTypes[numplot] == "float64array")) {
try {
plot(numplot, m_PlotXArrays[numplot], m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot data", "x = float64array , y = float64array");
}
} else if ((m_PlotXPropertyTypes[numplot] == "int32array") && (m_PlotYPropertyTypes[numplot] == "float64array")) {
try {
plot(numplot, m_PlotXArrays[numplot], m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot data", "x = int32array , y = float64array");
}
} else if ((m_PlotXPropertyTypes[numplot] == "float64array") && (m_PlotYPropertyTypes[numplot] == "int32array")) {
try {
plot(numplot, m_PlotXArrays[numplot], m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot data", "x = float64array , y = int32array");
}
} else if ((m_PlotXPropertyTypes[numplot].empty() == true) && (m_PlotYPropertyTypes[numplot] == "float64array")) {
try {
plot(numplot, m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot data", "y = float64array");
}
}
}
///////////////////////////////////////////////////////////////////////////////////////
//// optimization Plot if there is
////
try {
optimizationPlot(numplot);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot optimization y");
}
try {
optimizationResult(numplot);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot optimization result");
}
////
//// Set plot parameters
////
string label = getLegendKey(numplot);
string color = string("#") + getColor(numplot);
///////////////////////////////////////////////////////////////////////////////////////
//// Set Title
////
if (m_ShowTitle == true) {
string title = getPlotTitle();
////
//// Plot arrays
////
if (m_PlotXArrays[numplot].size() == m_PlotYArrays[numplot].size()) {
if ((m_PlotXPropertyTypes[numplot] == "int32array") && (m_PlotYPropertyTypes[numplot] == "int32array")) {
try {
m_MplPlot1D.title(title);
} catch (Error &e) {
Warning("Plot1D", "localplot", "Failed to set plot title", title);
plot(numplot, m_PlotXArrays[numplot], m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot data", "x = int32array , y = int32array");
}
if (m_PlotWindow != nullptr) {
title = getWindowTitle();
try {
m_PlotWindow->setWindowTitle(title);
} catch (Error &e) {
Warning("Plot1D", "localplot", "Failed to set window title", title);
}
} else if ((m_PlotXPropertyTypes[numplot] == "float64array") && (m_PlotYPropertyTypes[numplot] == "float64array")) {
try {
plot(numplot, m_PlotXArrays[numplot], m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot data", "x = float64array , y = float64array");
}
}
///////////////////////////////////////////////////////////////////////////////////////
//// Set x label
////
if (m_ShowXLabel == true) {
string xlabel = getXLabel();
} else if ((m_PlotXPropertyTypes[numplot] == "int32array") && (m_PlotYPropertyTypes[numplot] == "float64array")) {
try {
m_MplPlot1D.xlabel(xlabel);
plot(numplot, m_PlotXArrays[numplot], m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Warning("Plot1D", "localplot", "Failed to set x label", xlabel);
Error("Plot1D", "localplot", "Failed to plot data", "x = int32array , y = float64array");
}
}
///////////////////////////////////////////////////////////////////////////////////////
//// Set y label
////
if (m_ShowYLabel == true) {
string ylabel = getYLabel();
} else if ((m_PlotXPropertyTypes[numplot] == "float64array") && (m_PlotYPropertyTypes[numplot] == "int32array")) {
try {
m_MplPlot1D.ylabel(ylabel);
plot(numplot, m_PlotXArrays[numplot], m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Warning("Plot1D", "localplot", "Failed to set y label", ylabel);
Error("Plot1D", "localplot", "Failed to plot data", "x = float64array , y = int32array");
}
}
///////////////////////////////////////////////////////////////////////////////////////
//// set legend
////
if (m_ShowLegend == true) {
} else if ((m_PlotXPropertyTypes[numplot].empty() == true) && (m_PlotYPropertyTypes[numplot] == "float64array")) {
try {
m_MplPlot1D.legend("xx-small", "upper right", m_PlotWindow == nullptr);
plot(numplot, m_PlotYArrays[numplot], label, color);
} catch (Error& e) {
Warning("Plot1D", "localplot", "Failed to create plot legend");
Error("Plot1D", "localplot", "Failed to plot data", "y = float64array");
}
}
}
///////////////////////////////////////////////////////////////////////////////////////
//// check grid
////
///////////////////////////////////////////////////////////////////////////////////////
//// optimization Plot if there is
////
try {
optimizationPlot(numplot);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot optimization y");
}
try {
optimizationResult(numplot);
} catch (Error& e) {
Error("Plot1D", "localplot", "Failed to plot optimization result");
}
///////////////////////////////////////////////////////////////////////////////////////
//// Set Title
////
if (m_ShowTitle == true) {
string title = getPlotTitle();
try {
if (m_PlotWindow != nullptr) {
grid(m_PlotWindow->gridActivated());
m_MplPlot1D.title(title);
} catch (Error &e) {
Warning("Plot1D", "localplot", "Failed to set plot title", title);
}
if (m_PlotWindow != nullptr) {
title = getWindowTitle();
try {
m_PlotWindow->setWindowTitle(title);
} catch (Error &e) {
Warning("Plot1D", "localplot", "Failed to set window title", title);
}
}
}
///////////////////////////////////////////////////////////////////////////////////////
//// Set x label
////
if (m_ShowXLabel == true) {
string xlabel = getXLabel();
try {
m_MplPlot1D.xlabel(xlabel);
} catch (Error& e) {
Warning("Plot1D", "localplot", "Failed to show plot grid");
Warning("Plot1D", "localplot", "Failed to set x label", xlabel);
}
}
///////////////////////////////////////////////////////////////////////////////////////
//// check log
////
///////////////////////////////////////////////////////////////////////////////////////
//// Set y label
////
if (m_ShowYLabel == true) {
string ylabel = getYLabel();
try {
if (m_PlotWindow != nullptr) {
log(m_PlotWindow->logActivated());
}
m_MplPlot1D.ylabel(ylabel);
} catch (Error& e) {
Warning("Plot1D", "localplot", "Failed to activate log");
Warning("Plot1D", "localplot", "Failed to set y label", ylabel);
}
}
///////////////////////////////////////////////////////////////////////////////////////
//// set legend
////
if (m_ShowLegend == true) {
try {
m_MplPlot1D.legend("xx-small", "upper right", m_PlotWindow == nullptr);
} catch (Error& e) {
Warning("Plot1D", "localplot", "Failed to create plot legend");
}
}
///////////////////////////////////////////////////////////////////////////////////////
//// check grid
////
try {
if (m_PlotWindow != nullptr) {
grid(m_PlotWindow->gridActivated());
}
} catch (Error& e) {
Warning("Plot1D", "localplot", "Failed to show plot grid");
}
///////////////////////////////////////////////////////////////////////////////////////
//// check log
////
try {
if (m_PlotWindow != nullptr) {
log(m_PlotWindow->logActivated());
}
} catch (Error& e) {
Warning("Plot1D", "localplot", "Failed to activate log");
}
}
/*
......
......@@ -166,7 +166,6 @@ std::string CutPlot1D::getPlotTitle() {
* display
*/
void CutPlot1D::display() throw (Error) {
Plot1D::display();
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment