Commit 2d37dd4b authored by Locatelli's avatar Locatelli
Browse files

Manage color limits

parent e0f889cb
......@@ -12,3 +12,4 @@
/install-sh
/ltmain.sh
/missing
/lib/
......@@ -5,21 +5,14 @@
* Use async method for filling data vectors for accelerating process
* Remove multiplot files at the start of server
* Multiclient options
- no offscreen log, webspy plots
- offscreen plots for spy and multiplot will be regenerated or taken form the nomad server computer
* Multiplot
- Try create a plot with all plots (subplot)
- For PN do something for detecting channel problem (using CPU of mpda_dpp?) or in nomad?
* Bugs:
- Min and max colorlimits when update data from server during a count
* Does we limits x data for plot 1D (as doing in plot2d)?
* Spy
- Set log activated to offscreen for spy
* Offscreen log
- do recover system
\ No newline at end of file
* Unitary tests
\ No newline at end of file
......@@ -29,7 +29,7 @@ AC_CAMEO
RM_CXXFLAGS="$BOOST_CPPFLAGS \
$ZMQ_CFLAGS \
$PROTOBUF_CFLAGS \
$CAMEO_CFLAGS -DBOOST_NO_CXX11_SCOPED_ENUMS -fPIC -DQT_NO_KEYWORDS"
$CAMEO_CFLAGS -DBOOST_NO_CXX11_SCOPED_ENUMS -fPIC -DQT_NO_KEYWORDS -Wall"
RM_LDFLAGS="$BOOST_LDFLAGS \
$ZMQ_LDFLAGS \
......
INCLUDES = -I$(top_srcdir)/src -I$(top_srcdir)/../NomadServer/src -I/usr/include/python3.5m -I/usr/include/x86_64-linux-gnu/qt5/QtWidgets -I/usr/include/x86_64-linux-gnu/qt5 -I/usr/include/x86_64-linux-gnu/qt5/QtGui -I/usr/include/x86_64-linux-gnu/qt5/QtCore
lib_LTLIBRARIES = libqt.la libmanager.la libplot.la libprotobuf.la libdatacont.la libmplcpp.la libjson.la
bin_PROGRAMS = ploty2 mplplot offscreenplot recovery
#export QT_SELECT=5
QT = \
libqt_la_SOURCES = \
view/qt/QtColorMapWidget.cpp \
view/qt/moc_QtColorMapWidget.cpp \
view/qt/QtPlotDataWidget.cpp \
......@@ -24,10 +25,25 @@ QT = \
view/qt/QtUpdateThread.cpp \
view/qt/moc_QtUpdateThread.cpp
libqt_la_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
view/qt/moc_%.cpp: view/qt/%.h
moc $(DEFINES) $(INCPATH) $< -o $@
PLOT = \
libmanager_la_SOURCES = \
manager/ThreadPoolManager.cpp \
manager/RequestDealerManager.cpp \
manager/ServerSubscriberManager.cpp \
manager/AnalysisRequesterManager.cpp \
manager/ServerRequesterManager.cpp \
manager/PlotManager.cpp \
manager/InterfaceManager.cpp \
manager/OffScreenPlotManager.cpp \
manager/mpl/MplEventManager.cpp
libmanager_la_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
libplot_la_SOURCES = \
plot/Plot.cpp \
plot/EmptyPlot.cpp \
plot/Plot1D.cpp \
......@@ -46,7 +62,9 @@ PLOT = \
plot/property/PropertyPlot2D.cpp \
plot/cut/CutPlot1D.cpp
PROTOBUF = \
libplot_la_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
libprotobuf_la_SOURCES = \
protobuf/generated/AnalysisRequests.pb.cc \
protobuf/generated/AcquisitionSerializer.pb.cc \
protobuf/generated/CommonResponses.pb.cc \
......@@ -54,13 +72,15 @@ PROTOBUF = \
protobuf/generated/DataPlotMessages.pb.cc \
protobuf/generated/NotificationMessages.pb.cc
DATACONT = \
libdatacont_la_SOURCES = \
datacontainer/PlotDataContainer.cpp \
datacontainer/CutPlotDataContainer.cpp \
datacontainer/PropertyPlotDataContainer.cpp \
datacontainer/UpdateContainer.cpp
MPLCPP = \
libdatacont_la_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
libmplcpp_la_SOURCES = \
view/mpl/Mpl.cpp \
view/mpl/MplCut.cpp \
view/mpl/MplLock.cpp \
......@@ -74,153 +94,109 @@ MPLCPP = \
view/mpl/widgets/MplLineSelector.cpp \
view/mpl/widgets/MplRectangleSelector.cpp
JSON = \
libmplcpp_la_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
libjson_la_SOURCES = \
json/HttpConnection.cpp \
json/LogSender.cpp \
json/RestJsonHttpConnection.cpp
libjson_la_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
ploty2_SOURCES = \
main.cpp \
PlotId.cpp \
manager/ThreadPoolManager.cpp \
manager/RequestDealerManager.cpp \
manager/ServerSubscriberManager.cpp \
manager/AnalysisRequesterManager.cpp \
manager/ServerRequesterManager.cpp \
manager/PlotManager.cpp \
manager/InterfaceManager.cpp \
manager/OffScreenPlotManager.cpp \
manager/mpl/MplEventManager.cpp \
$(PLOT) \
$(PROTOBUF) \
$(DATACONT) \
$(MPLCPP) \
$(QT) \
$(JSON)
PlotId.cpp
ploty2_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
ploty2_LDFLAGS = $(RM_LDFLAGS)
ploty2_LDADD = $(LIBS) $(RM_LIBS) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_THREAD_LIB)
$(BOOST_THREAD_LIB) \
libqt.la \
libmanager.la \
libplot.la \
libprotobuf.la \
libdatacont.la \
libmplcpp.la \
libjson.la
mplplot_SOURCES = \
mainplot.cpp \
PlotId.cpp \
manager/AnalysisRequesterManager.cpp \
manager/ServerRequesterManager.cpp \
manager/ServerSubscriberManager.cpp \
manager/InterfaceManager.cpp \
manager/mpl/MplEventManager.cpp \
$(PLOT) \
$(PROTOBUF) \
$(DATACONT) \
$(MPLCPP) \
$(QT)
PlotId.cpp
mplplot_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
mplplot_LDFLAGS = $(RM_LDFLAGS)
mplplot_LDADD = $(LIBS) $(RM_LIBS) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_THREAD_LIB)
$(BOOST_THREAD_LIB) \
libqt.la \
libmanager.la \
libplot.la \
libprotobuf.la \
libdatacont.la \
libmplcpp.la \
libjson.la
offscreenplot_SOURCES = \
mainoffscreenplot.cpp \
PlotId.cpp \
manager/ThreadPoolManager.cpp \
manager/RequestDealerManager.cpp \
manager/ServerSubscriberManager.cpp \
manager/AnalysisRequesterManager.cpp \
manager/ServerRequesterManager.cpp \
manager/PlotManager.cpp \
manager/InterfaceManager.cpp \
manager/OffScreenPlotManager.cpp \
manager/mpl/MplEventManager.cpp \
$(PLOT) \
$(PROTOBUF) \
$(DATACONT) \
$(MPLCPP) \
$(QT) \
$(JSON)
PlotId.cpp
offscreenplot_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
offscreenplot_LDFLAGS = $(RM_LDFLAGS)
offscreenplot_LDADD = $(LIBS) $(RM_LIBS) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_THREAD_LIB)
$(BOOST_THREAD_LIB) \
libqt.la \
libmanager.la \
libplot.la \
libprotobuf.la \
libdatacont.la \
libmplcpp.la \
libjson.la
recovery_SOURCES = \
mainrecovery.cpp \
PlotId.cpp \
manager/ThreadPoolManager.cpp \
manager/RequestDealerManager.cpp \
manager/ServerSubscriberManager.cpp \
manager/AnalysisRequesterManager.cpp \
manager/ServerRequesterManager.cpp \
manager/PlotManager.cpp \
manager/InterfaceManager.cpp \
manager/OffScreenPlotManager.cpp \
manager/mpl/MplEventManager.cpp \
$(PLOT) \
$(PROTOBUF) \
$(DATACONT) \
$(MPLCPP) \
$(QT) \
$(JSON)
PlotId.cpp
recovery_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
recovery_LDFLAGS = $(RM_LDFLAGS)
recovery_LDADD = $(LIBS) $(RM_LIBS) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_THREAD_LIB)
$(BOOST_THREAD_LIB) \
libqt.la \
libmanager.la \
libplot.la \
libprotobuf.la \
libdatacont.la \
libmplcpp.la \
libjson.la
test_SOURCES = \
maintest.cpp \
PlotId.cpp \
manager/ThreadPoolManager.cpp \
manager/RequestDealerManager.cpp \
manager/ServerSubscriberManager.cpp \
manager/AnalysisRequesterManager.cpp \
manager/ServerRequesterManager.cpp \
manager/InterfaceManager.cpp \
manager/PlotManager.cpp \
manager/OffScreenPlotManager.cpp \
manager/mpl/MplEventManager.cpp \
$(PLOT) \
$(PROTOBUF) \
$(MPLCPP) \
$(QT) \
$(JSON)
PlotId.cpp
test_CPPFLAGS = $(RM_CXXFLAGS) -DOFFSCREEN -DTRACEDEBUG
test_LDFLAGS = $(RM_LDFLAGS)
test_LDADD = $(LIBS) $(RM_LIBS) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_THREAD_LIB)
$(BOOST_THREAD_LIB) \
libqt.la \
libmanager.la \
libplot.la \
libprotobuf.la \
libdatacont.la \
libmplcpp.la \
libjson.la
test2_SOURCES = \
maintest2.cpp \
PlotId.cpp \
manager/ThreadPoolManager.cpp \
manager/RequestDealerManager.cpp \
manager/ServerSubscriberManager.cpp \
manager/InterfaceManager.cpp \
manager/AnalysisRequesterManager.cpp \
manager/ServerRequesterManager.cpp \
manager/PlotManager.cpp \
manager/OffScreenPlotManager.cpp \
manager/mpl/MplEventManager.cpp \
$(PLOT) \
$(PROTOBUF) \
$(DATACONT) \
$(MPLCPP) \
$(QT) \
$(JSON)
PlotId.cpp
tests/moc_%.cpp: tests/%.h
moc $(DEFINES) $(INCPATH) $< -o $@
......@@ -231,7 +207,15 @@ test2_LDADD = $(LIBS) $(RM_LIBS) \
$(BOOST_SYSTEM_LIB) \
$(BOOST_FILESYSTEM_LIB) \
$(BOOST_THREAD_LIB) \
-lm
-lm \
libqt.la \
libmanager.la \
libplot.la \
libprotobuf.la \
libdatacont.la \
libmplcpp.la \
libjson.la
test3_SOURCES = \
maintest3.cpp \
......
......@@ -51,20 +51,35 @@ PropertyPlotDataContainer::PropertyPlotDataContainer(const ploty::PlotPropertyDa
}
for (int32 id : plotMessage.datax_ids()) {
if (id != 0) {
dataXIds.push_back(id);
dataXPropertyTypes[id] = ServerRequesterManager::getInstance()->getPropertyType(id);
try {
dataXPropertyTypes[id] = ServerRequesterManager::getInstance()->getPropertyType(id);
dataXIds.push_back(id);
}
catch(...) {
}
}
}
for (int32 id : plotMessage.datay_ids()) {
if (id != 0) {
dataYIds.push_back(id);
dataYPropertyTypes[id] = ServerRequesterManager::getInstance()->getPropertyType(id);
try {
dataYPropertyTypes[id] = ServerRequesterManager::getInstance()->getPropertyType(id);
dataYIds.push_back(id);
}
catch(...) {
}
}
}
for (int32 id : plotMessage.dataz_ids()) {
if (id != 0) {
dataZIds.push_back(id);
dataZPropertyTypes[id] = ServerRequesterManager::getInstance()->getPropertyType(id);
try {
dataZPropertyTypes[id] = ServerRequesterManager::getInstance()->getPropertyType(id);
dataZIds.push_back(id);
}
catch(...) {
}
}
}
for (int32 id : plotMessage.plottype_id()) {
......@@ -146,6 +161,12 @@ PropertyPlotDataContainer::PropertyPlotDataContainer(const ploty::PlotPropertyDa
if (plotMessage.has_use_grid_id()) {
colorMapId = (plotMessage.color_map_id());
}
if (plotMessage.has_min_color_limit_id()) {
minColorLimitId = (plotMessage.min_color_limit_id());
}
if (plotMessage.has_max_color_limit_id()) {
maxColorLimitId = (plotMessage.max_color_limit_id());
}
nbRoisId = plotMessage.nbrois_id();
......@@ -171,13 +192,16 @@ PropertyPlotDataContainer::PropertyPlotDataContainer(const ploty::PlotPropertyDa
roiSum_parent_ids.push_back(id);
}
if (nbRoisId > 0) {
int32 nbrois = ServerRequesterManager::getInstance()->getInt32PropertyValue(nbRoisId);
for (uint32 i = 0; i < roiX0_parent_ids.size(); ++i) {
roiX0_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiX0_parent_ids[i]));
roiY0_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiY0_parent_ids[i]));
roiX1_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiX1_parent_ids[i]));
roiY1_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiY1_parent_ids[i]));
roiSum_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiSum_parent_ids[i]));
try {
for (uint32 i = 0; i < roiX0_parent_ids.size(); ++i) {
roiX0_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiX0_parent_ids[i]));
roiY0_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiY0_parent_ids[i]));
roiX1_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiX1_parent_ids[i]));
roiY1_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiY1_parent_ids[i]));
roiSum_ids.push_back(ServerRequesterManager::getInstance()->getDynamicPropertyIds(roiSum_parent_ids[i]));
}
} catch(Error& e) {
Error("PropertyPlotDataContainer", "PropertyPlotDataContainer", "getting number of roi property");
}
}
......
......@@ -66,8 +66,8 @@ public:
std::vector<int32> maxYId; //! Maximum Y number property Id
std::vector<int32> maxChannelId; //! Maximum Channel number property Id
std::vector<int32> maxSliceId; //! Maximum Slice number property Id
std::vector<float64> xPhysicalSizeIds; //! X physical size
std::vector<float64> yPhysicalSizeIds; //! X physical size
std::vector<int32> xPhysicalSizeIds; //! X physical size property Id
std::vector<int32> yPhysicalSizeIds; //! Y physical size property Id
std::vector<bool> errorBars; //! Plot using error bar
int32 titleId; //! Property Id of title
int32 xaxisTitleId; //! Property Id of x axis title
......@@ -78,9 +78,11 @@ 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 useGridId; //! Property id for use grid property
int32 useLogId; //! Property id for use log property
int32 colorMapId; //! Property id for use color map property
int32 minColorLimitId; //! Property id for min color limit property
int32 maxColorLimitId; //! Property id for max color limit 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
......
......@@ -50,7 +50,6 @@ using namespace std;
using namespace cameo;
using namespace plot;
unique_ptr<application::Instance> nomadserver; //! Instance of nomad server
shared_ptr<application::Subscriber> datachangesubscriber; //! Subcriber on data change publisher of the server
shared_ptr<QApplication> app;
unique_ptr<window::PropertyPlotWindow> plotwindow;
......@@ -99,15 +98,15 @@ int32 main(int32 argc, char* argv[]) {
// Init the Mpl Event Manager
manager::mpl::MplEventManager::getInstance()->init(mpl);
DBGMSG("Connected to " << getNomadServerEndPoint());
cameo::Server server(getNomadServerEndPoint());
// Init cameo application
int32 err = EXIT_SUCCESS;
application::This::init(1, &argv[4]);
{
DBGMSG("Connected to " << getNomadServerEndPoint());
cameo::Server server(getNomadServerEndPoint());
// Get nomad server instance
nomadserver = getNomadInstance(server);
unique_ptr<application::Instance> nomadserver = getNomadInstance(server);
if (nomadserver.get() == 0) {
Error("mainplot", "No nomad server instance");
err = EXIT_FAILURE;
......@@ -217,18 +216,20 @@ int32 main(int32 argc, char* argv[]) {
err = EXIT_FAILURE;
}
// Cancel subscriber
datachangesubscriber->cancel();
// Clean manager
manager::ServerRequesterManager::resetInstance();
// Clean manager
manager::AnalysisRequesterManager::resetInstance();
// Cancel subscriber
datachangesubscriber->cancel();
requesterdb.reset();
requesteranalysis.reset();
nomadserver.reset();
}
exit:
......@@ -237,7 +238,6 @@ exit:
app.reset();
datachangesubscriber.reset();
mpl.reset();
nomadserver.reset();
// Terminate cameo application
application::This::terminate();
......
......@@ -155,6 +155,20 @@ void InterfaceManager::colorLimits(float64 min, float64 max) throw (Error) {
m_PlotWindow->colorLimits(min, max);
}
/*
* saveColorLimits
*/
void InterfaceManager::saveColorLimits(float64 min, float64 max) throw (Error) {
m_PlotWindow->saveColorLimits(min, max);
}
/*
* adjustAdjustColotLimits
*/
std::pair<float64, float64> InterfaceManager::autoAdjustColotLimits() {
return m_PlotWindow->autoAdjustColotLimits();
}
/*
* getPlotKey
*/
......@@ -433,6 +447,7 @@ void InterfaceManager::dismissCutWindow() throw (Error) {
*/
void InterfaceManager::showCutWindowsCoord(const LineCoord& line) {
LineCoord lline = line;
datacontainer::CutPlotDataContainer datacont(getPropertyPlotDataContainer());
plot::property::PropertyPlot2D* plot = dynamic_cast<plot::property::PropertyPlot2D*>(m_PropertyPlot);
if (plot != nullptr) {
......@@ -451,10 +466,14 @@ void InterfaceManager::showCutWindowsCoord(const LineCoord& line) {
Error("InterfaceManager", "cut", "could not create cut window");
}
}
lline.p0.x = lline.p0.x / plot->getXPhysicalSize() * plot->getXDataSize();
lline.p0.y = lline.p0.y / plot->getYPhysicalSize() * plot->getYDataSize();
lline.p1.x = lline.p1.x / plot->getXPhysicalSize() * plot->getXDataSize();
lline.p1.y = lline.p1.y / plot->getYPhysicalSize() * plot->getYDataSize();
}
vector<float64> datax;
vector<float64> datay;
m_CutWindow->setCutLine(line);
m_CutWindow->setCutLine(lline);
}
/*
......
......@@ -155,6 +155,20 @@ public:
*/
void colorLimits(float64 min, float64 max) throw (Error);
/*!
* \brief Save color limits (in nomad server , if properties existed)
* \param[in] min The minimum value in %
* \param[in] max The minimum value in %
* \throws Error
*/
void saveColorLimits(float64 min, float64 max) throw (Error);
/*!
* \brief Compute colors limits from histogram of data
* \return Colors limits with data values format
*/
std::pair<float64, float64> autoAdjustColotLimits();
/*!
* \brief getter of plot key
* \return Property The plot key
......
......@@ -41,6 +41,13 @@ ServerSubscriberManager::ServerSubscriberManager() {
m_Subscriber = nullptr;
}
/*
* destructor
*/
ServerSubscriberManager::~ServerSubscriberManager() {
m_Subscriber.reset();
}
/*
* getInstance
*/
......@@ -62,6 +69,15 @@ void ServerSubscriberManager::resetInstance() {
}
}
/*
* stop
*/
void ServerSubscriberManager::stop() {
if (m_Subscriber) {
m_Subscriber->cancel();
}
}
/*
* registerUpdater
*/
......
......@@ -77,7 +77,15 @@ public:
* \return id of the updated property
*/
int32 loop();
/*!
* \brief stop the subscriber
*/
void stop();
/*!
* \brief
*/
std::vector<ServerSubscriber*> getPlotForPropertyId(int32 id);
private:
......@@ -87,6 +95,11 @@ private:
*/
ServerSubscriberManager();
/*!
* \brief destructor
*/
~ServerSubscriberManager();
static ServerSubscriberManager* m_Instance; //! singleton instance
static std::shared_ptr<cameo::application::Subscriber> m_Subscriber;
......
......@@ -127,6 +127,24 @@ public:
}
/*!
* \brief set color limits
* \param[in] min The minimum value in %
* \param[in] max The minimum value in %
* \throws Error
*/
virtual void saveColorLimits(float64 min, float64 max) throw (Error) {
}