##// END OF EJS Templates
Prohibits the display of a spectrogram in an existing graph and the display of data on a graph already containing a spectrogram
Alexandre Leroux -
r1063:5850a514ee91
parent child
Show More
@@ -10,6 +10,7
10 #include <Common/MimeTypesDef.h>
10 #include <Common/MimeTypesDef.h>
11 #include <Data/ArrayData.h>
11 #include <Data/ArrayData.h>
12 #include <Data/IDataSeries.h>
12 #include <Data/IDataSeries.h>
13 #include <Data/SpectrogramSeries.h>
13 #include <DragAndDrop/DragDropHelper.h>
14 #include <DragAndDrop/DragDropHelper.h>
14 #include <Settings/SqpSettingsDefs.h>
15 #include <Settings/SqpSettingsDefs.h>
15 #include <SqpApplication.h>
16 #include <SqpApplication.h>
@@ -293,9 +294,17 void VisualizationGraphWidget::accept(IVisualizationWidgetVisitor *visitor)
293
294
294 bool VisualizationGraphWidget::canDrop(const Variable &variable) const
295 bool VisualizationGraphWidget::canDrop(const Variable &variable) const
295 {
296 {
296 /// @todo : for the moment, a graph can always accomodate a variable
297 auto isSpectrogram = [](const auto &variable) {
297 Q_UNUSED(variable);
298 return std::dynamic_pointer_cast<SpectrogramSeries>(variable.dataSeries()) != nullptr;
298 return true;
299 };
300
301 // - A spectrogram series can't be dropped on graph with existing plottables
302 // - No data series can be dropped on graph with existing spectrogram series
303 return isSpectrogram(variable)
304 ? impl->m_VariableToPlotMultiMap.empty()
305 : std::none_of(
306 impl->m_VariableToPlotMultiMap.cbegin(), impl->m_VariableToPlotMultiMap.cend(),
307 [isSpectrogram](const auto &entry) { return isSpectrogram(*entry.first); });
299 }
308 }
300
309
301 bool VisualizationGraphWidget::contains(const Variable &variable) const
310 bool VisualizationGraphWidget::contains(const Variable &variable) const
General Comments 0
You need to be logged in to leave comments. Login now