Commit 79d1f94d authored by Locatelli's avatar Locatelli
Browse files

send grid, log and colormap to sever for offscreen plot

parent 033ddf9d
......@@ -137,6 +137,16 @@ PropertyPlotDataContainer::PropertyPlotDataContainer(const ploty::PlotPropertyDa
optimizationFitColor.push_back(color);
}
if (plotMessage.has_use_grid_id()) {
useGridId = (plotMessage.use_grid_id());
}
if (plotMessage.has_use_grid_id()) {
useLogId = (plotMessage.use_log_id());
}
if (plotMessage.has_use_grid_id()) {
colorMapId = (plotMessage.color_map_id());
}
nbRoisId = plotMessage.nbrois_id();
DBGMSG("x0_parent_id " << plotMessage.x0_parent_id().size());
......
......@@ -78,6 +78,9 @@ public:
std::vector<int32> optimizationFitFoundId; //! Property id list for optimization fit found
std::vector<int32> optimizationFitYId; //! Property id list for optimization fit y values found
std::vector<std::string> optimizationFitColor; //! Color of optimization fit
int32 useGridId; //! Property id list for use grid property
int32 useLogId; //! Property id list for use log property
int32 colorMapId; //! Property id list for use color map property
int32 nbRoisId; //! Property id of the number of Roi
std::vector<int32> roiX0_parent_ids; //! Parent property id of the dynamic property roi X0 coordinate
std::vector<int32> roiY0_parent_ids; //! Parent property id of the dynamic property roi Y0 coordinate
......
......@@ -266,7 +266,6 @@ void OffScreenPlotManager::run(std::string pbfilename, std::string path) {
}
}
}
DBGMSG("OK pbfilename = " << path << "/" << pbfilename);
}
} catch (boost::filesystem::filesystem_error& e) {
Error("OffScreenPlotManager", "savePlot",
......
......@@ -202,6 +202,18 @@ void ServerRequesterManager::getFloat64PropertyArray(int32 id, std::vector<float
}
}
/*
* setBoolPropertyValue
*/
void ServerRequesterManager::setBoolPropertyValue(int32 id, bool value) throw (Error) {
bool success = sendValueRequest<database::SetBooleanValueRequest>(id , database::Message::SetBooleanValue, value);
if (success == false) {
throw Error("ServerRequesterManager", "setBoolPropertyValue", "setting property id", id);
}
}
/*
* setStringPropertyValue
*/
......
......@@ -108,6 +108,14 @@ public:
*/
void getFloat64PropertyArray(int32 id, std::vector<float64>& array) throw (Error);
/*!
* \brief Set bool property value
* \param[in] id The property id
* \param[in] value the value to set in the property
* \throws Error
*/
void setBoolPropertyValue(int32 id, bool value) throw (Error);
/*!
* \brief Set string property value
* \param[in] id The property id
......
......@@ -74,14 +74,10 @@ void Plot1D::display() throw (Error) {
getYData(i);
}
///////////////////////////////////////////////////////////////////////////////////////
//// reset limits
////
resetLimits();
for (uint32 i = 0; i < m_NbPlots; ++i) {
localplot(i);
}
}
/*
......
......@@ -207,11 +207,6 @@ void Plot2D::display() throw (Error) {
manager::mpl::MplEventManager::getInstance()->subscribeXLimChanged(m_MplPlot2D.getMainAxis(), this);
manager::mpl::MplEventManager::getInstance()->subscribeYLimChanged(m_MplPlot2D.getMainAxis(), this);
}
///////////////////////////////////////////////////////////////////////////////////////
//// reset limits
////
resetLimits();
}
/*
......
......@@ -57,6 +57,18 @@ void OffScreenPlot1D::display() throw (Error) {
Error("OffScreenPlot1D", "display", "Error when executing the title and tight layout method");
}
}
else {
grid(m_Data.usegrid());
}
if (m_Data.uselog() == true) {
log(true);
}
///////////////////////////////////////////////////////////////////////////////////////
//// reset limits
////
resetLimits();
}
/*
......
......@@ -70,7 +70,19 @@ void OffScreenPlot2D::display() throw (Error) {
Error("OffScreenPlot2D", "display", "Error when executing the title and tight layout method");
}
}
else {
grid(m_Data.usegrid());
}
if (m_Data.uselog() == true) {
log(true);
}
colorMap(m_Data.colormap());
///////////////////////////////////////////////////////////////////////////////////////
//// reset limits
////
resetLimits();
}
......
......@@ -175,6 +175,11 @@ void PropertyPlot1D::display() throw (Error) {
Plot1D::display();
///////////////////////////////////////////////////////////////////////////////////////
//// reset limits
////
resetLimits();
try {
updateRoi();
}
......@@ -474,5 +479,21 @@ void PropertyPlot1D::optimizationResult(uint32 numplot) throw (Error) {
}
}
/*
* grid
*/
void PropertyPlot1D::grid(bool show) throw (Error) {
Plot1D::grid(show);
ServerRequesterManager::getInstance()->setBoolPropertyValue(m_DataCont.useGridId, show);
}
/*
* log
*/
void PropertyPlot1D::log(bool tolog) throw (Error) {
Plot1D::log(tolog);
ServerRequesterManager::getInstance()->setBoolPropertyValue(m_DataCont.useLogId, tolog);
}
}
}
......@@ -65,6 +65,19 @@ public:
*/
virtual void update(int32 id);
/*!
* \brief show or hide the plot grid
* \param[in] show The grid state
* \throws Error
*/
virtual void grid(bool show) throw (Error);
/*!
* \brief show or hide the plot in log
* \param[in] tolog The log state
* \throws Error
*/
virtual void log(bool tolog) throw (Error);
protected:
......
......@@ -60,6 +60,11 @@ void PropertyPlot2D::display() throw (Error) {
Plot2D::display();
///////////////////////////////////////////////////////////////////////////////////////
//// reset limits
////
resetLimits();
try {
updateRoi();
}
......@@ -325,5 +330,35 @@ void PropertyPlot2D::updateProjections() {
m_MplPlot2D.updateprojections((int32) m_datax.size(), (int32) m_datay.size(), m_datax, m_datay, m_dataprojx, m_dataprojy);
}
/*
* grid
*/
void PropertyPlot2D::grid(bool show) throw (Error) {
Plot2D::grid(show);
if (m_DataCont.useGridId != 0) {
ServerRequesterManager::getInstance()->setBoolPropertyValue(m_DataCont.useGridId, show);
}
}
/*
* log
*/
void PropertyPlot2D::log(bool tolog) throw (Error) {
Plot2D::log(tolog);
if (m_DataCont.useLogId != 0) {
ServerRequesterManager::getInstance()->setBoolPropertyValue(m_DataCont.useLogId, tolog);
}
}
/*
* colorMap
*/
void PropertyPlot2D::colorMap(const std::string& name) throw (Error) {
Plot2D::colorMap(name);
if (m_DataCont.colorMapId != 0) {
ServerRequesterManager::getInstance()->setStringPropertyValue(m_DataCont.colorMapId, name);
}
}
}
}
......@@ -87,6 +87,26 @@ public:
* \return The Id number
*/
int32 getZdataId() const;
/*!
* \brief show or hide the plot grid
* \param[in] show The grid state
* \throws Error
*/
virtual void grid(bool show) throw (Error);
/*!
* \brief show or hide the plot in log
* \param[in] tolog The log state
* \throws Error
*/
virtual void log(bool tolog) throw (Error);
/*!
* \brief set color map
* \param[in] name the label
* \throws Error
*/
virtual void colorMap(const std::string& name) throw (Error);
private:
......
......@@ -60,4 +60,8 @@ repeated double optimizationResultValues = 22;
optional string numor = 23;
optional bool useGrid = 24;
optional bool useLog = 25;
optional string colorMap = 26;
}
......@@ -502,17 +502,21 @@ void MplPlot2D::log(bool tolog) throw (Error) {
} catch (...) {
throw Error("MplPlot2D", "log", "Could not set_norm on main to ", buf);
}
try {
// Set y scale on X projection
m_XProjectionAxis.attr("set_yscale")(*args2);
} catch (...) {
throw Error("MplPlot2D", "log", "Could not set_yscale on x projection to ", buf);
if (m_XProjectionAxis().is_none() == false) {
try {
// Set y scale on X projection
m_XProjectionAxis.attr("set_yscale")(*args2);
} catch (...) {
throw Error("MplPlot2D", "log", "Could not set_yscale on x projection to ", buf);
}
}
try {
// Set x scale on Y projection
m_YProjectionAxis.attr("set_xscale")(*args2);
} catch (...) {
throw Error("MplPlot2D", "log", "Could not set_xscale on y projection to ", buf);
if (m_YProjectionAxis().is_none() == false) {
try {
// Set x scale on Y projection
m_YProjectionAxis.attr("set_xscale")(*args2);
} catch (...) {
throw Error("MplPlot2D", "log", "Could not set_xscale on y projection to ", buf);
}
}
}
......
......@@ -113,6 +113,24 @@ void QtColorMapWidget::desactivate() {
hide();
}
/*
* enableActions
*/
void QtColorMapWidget::enableActions() {
m_ColorMapComboBox->setEnabled(true);
m_MinLevelRangeSlider->setEnabled(true);
m_MaxLevelRangeSlider->setEnabled(true);
}
/*
* disableActions
*/
void QtColorMapWidget::disableActions() {
m_ColorMapComboBox->setEnabled(false);
m_MinLevelRangeSlider->setEnabled(false);
m_MaxLevelRangeSlider->setEnabled(false);
}
/*
* setPlotType
*/
......
......@@ -69,6 +69,16 @@ public:
*/
void desactivate();
/*!
* \brief Enable actions buttons
*/
void enableActions();
/*!
* \brief Disable actions buttons
*/
void disableActions();
/*!
* \brief Get color map name of the combo bax
* \return The name
......
......@@ -137,6 +137,9 @@ QtPlotDataWidget::QtPlotDataWidget(QWidget* parent, const datacontainer::Propert
QtPlotDataWidget::~QtPlotDataWidget() {
}
/*
* isPlotDataType
*/
bool QtPlotDataWidget::isPlotDataType() {
if ((m_PlotDataProperties.plottypeId.empty() == true) || (m_PlotDataProperties.xId.empty() == true) || (m_PlotDataProperties.yId.empty()) ||
(m_PlotDataProperties.channelId.empty() == true) || (m_PlotDataProperties.sliceId.empty() == true)) {
......@@ -149,6 +152,9 @@ bool QtPlotDataWidget::isPlotDataType() {
return false;
}
/*
* activate
*/
void QtPlotDataWidget::activate() {
updatePlotType();
updateX();
......@@ -165,12 +171,45 @@ void QtPlotDataWidget::activate() {
show();
}
/*
* desactivate
*/
void QtPlotDataWidget::desactivate() {
unsubscribeUpdate();
hide();
}
/*
* enableActions
*/
void QtPlotDataWidget::enableActions() {
m_PlotTypeComboBox->setEnabled(true);
m_XSpinBox->setEnabled(true);
m_XSlider->setEnabled(true);
m_YSpinBox->setEnabled(true);
m_YSlider->setEnabled(true);
m_ChannelSpinBox->setEnabled(true);
m_ChannelSlider->setEnabled(true);
m_SliceSpinBox->setEnabled(true);
m_SliceSlider->setEnabled(true);
}
/*
* disableActions
*/
void QtPlotDataWidget::disableActions() {
m_PlotTypeComboBox->setEnabled(false);
m_XSpinBox->setEnabled(false);
m_XSlider->setEnabled(false);
m_YSpinBox->setEnabled(false);
m_YSlider->setEnabled(false);
m_ChannelSpinBox->setEnabled(false);
m_ChannelSlider->setEnabled(false);
m_SliceSpinBox->setEnabled(false);
m_SliceSlider->setEnabled(false);
}
/*
* subscribeUpdate
*/
......
......@@ -71,6 +71,16 @@ public:
*/
void desactivate();
/*!
* \brief Enable actions buttons
*/
void enableActions();
/*!
* \brief Disable actions buttons
*/
void disableActions();
/*!
* \brief Susbscribe for property events on nomad server
*/
......
......@@ -178,7 +178,7 @@ void QtRoiWidget::cancelRoi() {
m_Delete->setEnabled(true);
m_Validate->setVisible(false);
m_Cancel->setVisible(false);
m_Toolbar.enableActions();
m_QtWindow->enableActions();
m_QtWindow->deleteRoi(m_Id);
}
catch(...) {
......@@ -191,7 +191,7 @@ void QtRoiWidget::cancelRoi() {
*/
void QtRoiWidget::modifyRoi() {
try {
m_Toolbar.disableActions();
m_QtWindow->disableActions();
manager::InterfaceManager::getInstance(m_QtWindow->getPlotId())->modifyRoiStart(m_Id, m_Color);
m_Delete->setEnabled(false);
m_Modify->setEnabled(false);
......@@ -212,7 +212,7 @@ void QtRoiWidget::validateRoi() {
m_Delete->setEnabled(true);
m_Validate->setVisible(false);
m_Cancel->setVisible(false);
m_Toolbar.enableActions();
m_QtWindow->enableActions();
m_QtWindow->validateRoi(m_Id);
}
catch(...) {
......
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