@@ -13,6 +13,9 public: | |||||
13 |
|
13 | |||
14 | /// Checks if the container can handle the variable passed in parameter |
|
14 | /// Checks if the container can handle the variable passed in parameter | |
15 | virtual bool canDrop(const Variable &variable) const = 0; |
|
15 | virtual bool canDrop(const Variable &variable) const = 0; | |
|
16 | ||||
|
17 | /// Checks if the container contains the variable passed in parameter | |||
|
18 | virtual bool contains(const Variable &variable) const = 0; | |||
16 | }; |
|
19 | }; | |
17 |
|
20 | |||
18 |
|
21 |
@@ -35,6 +35,7 public: | |||||
35 | // IVisualizationWidget interface |
|
35 | // IVisualizationWidget interface | |
36 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
36 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
37 | bool canDrop(const Variable &variable) const override; |
|
37 | bool canDrop(const Variable &variable) const override; | |
|
38 | bool contains(const Variable &variable) const override; | |||
38 | QString name() const override; |
|
39 | QString name() const override; | |
39 |
|
40 | |||
40 | void updateDisplay(std::shared_ptr<Variable> variable); |
|
41 | void updateDisplay(std::shared_ptr<Variable> variable); |
@@ -38,6 +38,7 public: | |||||
38 | // IVisualizationWidget interface |
|
38 | // IVisualizationWidget interface | |
39 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
39 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
40 | bool canDrop(const Variable &variable) const override; |
|
40 | bool canDrop(const Variable &variable) const override; | |
|
41 | bool contains(const Variable &variable) const override; | |||
41 | QString name() const override; |
|
42 | QString name() const override; | |
42 |
|
43 | |||
43 | private: |
|
44 | private: |
@@ -26,6 +26,7 public: | |||||
26 | // IVisualizationWidget interface |
|
26 | // IVisualizationWidget interface | |
27 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
27 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
28 | bool canDrop(const Variable &variable) const override; |
|
28 | bool canDrop(const Variable &variable) const override; | |
|
29 | bool contains(const Variable &variable) const override; | |||
29 | QString name() const override; |
|
30 | QString name() const override; | |
30 |
|
31 | |||
31 | public slots: |
|
32 | public slots: |
@@ -35,6 +35,7 public: | |||||
35 | // IVisualizationWidget interface |
|
35 | // IVisualizationWidget interface | |
36 | void accept(IVisualizationWidgetVisitor *visitor) override; |
|
36 | void accept(IVisualizationWidgetVisitor *visitor) override; | |
37 | bool canDrop(const Variable &variable) const override; |
|
37 | bool canDrop(const Variable &variable) const override; | |
|
38 | bool contains(const Variable &variable) const override; | |||
38 | QString name() const override; |
|
39 | QString name() const override; | |
39 |
|
40 | |||
40 | private: |
|
41 | private: |
@@ -141,6 +141,18 bool VisualizationGraphWidget::canDrop(const Variable &variable) const | |||||
141 | return true; |
|
141 | return true; | |
142 | } |
|
142 | } | |
143 |
|
143 | |||
|
144 | bool VisualizationGraphWidget::contains(const Variable &variable) const | |||
|
145 | { | |||
|
146 | // Finds the variable among the keys of the map | |||
|
147 | auto variablePtr = &variable; | |||
|
148 | auto findVariable | |||
|
149 | = [variablePtr](const auto &entry) { return variablePtr == entry.first.get(); }; | |||
|
150 | ||||
|
151 | auto end = impl->m_VariableToPlotMultiMap.cend(); | |||
|
152 | auto it = std::find_if(impl->m_VariableToPlotMultiMap.cbegin(), end, findVariable); | |||
|
153 | return it != end; | |||
|
154 | } | |||
|
155 | ||||
144 | QString VisualizationGraphWidget::name() const |
|
156 | QString VisualizationGraphWidget::name() const | |
145 | { |
|
157 | { | |
146 | return ui->graphNameLabel->text(); |
|
158 | return ui->graphNameLabel->text(); |
@@ -93,6 +93,12 bool VisualizationTabWidget::canDrop(const Variable &variable) const | |||||
93 | return true; |
|
93 | return true; | |
94 | } |
|
94 | } | |
95 |
|
95 | |||
|
96 | bool VisualizationTabWidget::contains(const Variable &variable) const | |||
|
97 | { | |||
|
98 | Q_UNUSED(variable); | |||
|
99 | return false; | |||
|
100 | } | |||
|
101 | ||||
96 | QString VisualizationTabWidget::name() const |
|
102 | QString VisualizationTabWidget::name() const | |
97 | { |
|
103 | { | |
98 | return impl->m_Name; |
|
104 | return impl->m_Name; |
@@ -101,6 +101,12 bool VisualizationWidget::canDrop(const Variable &variable) const | |||||
101 | return false; |
|
101 | return false; | |
102 | } |
|
102 | } | |
103 |
|
103 | |||
|
104 | bool VisualizationWidget::contains(const Variable &variable) const | |||
|
105 | { | |||
|
106 | Q_UNUSED(variable); | |||
|
107 | return false; | |||
|
108 | } | |||
|
109 | ||||
104 | QString VisualizationWidget::name() const |
|
110 | QString VisualizationWidget::name() const | |
105 | { |
|
111 | { | |
106 | return QStringLiteral("MainView"); |
|
112 | return QStringLiteral("MainView"); |
@@ -99,6 +99,12 bool VisualizationZoneWidget::canDrop(const Variable &variable) const | |||||
99 | return true; |
|
99 | return true; | |
100 | } |
|
100 | } | |
101 |
|
101 | |||
|
102 | bool VisualizationZoneWidget::contains(const Variable &variable) const | |||
|
103 | { | |||
|
104 | Q_UNUSED(variable); | |||
|
105 | return false; | |||
|
106 | } | |||
|
107 | ||||
102 | QString VisualizationZoneWidget::name() const |
|
108 | QString VisualizationZoneWidget::name() const | |
103 | { |
|
109 | { | |
104 | return ui->zoneNameLabel->text(); |
|
110 | return ui->zoneNameLabel->text(); |
General Comments 0
You need to be logged in to leave comments.
Login now