Skip to content

Commit b76bdb4

Browse files
committed
Fixes EvalLinAlg modules
@benjaminlarson Check out the fix--dialog code has evolved so much, almost the entire class was deleted
1 parent 93a01d5 commit b76bdb4

File tree

5 files changed

+175
-175
lines changed

5 files changed

+175
-175
lines changed
Lines changed: 172 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,172 @@
1+
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
2+
<!DOCTYPE boost_serialization>
3+
<boost_serialization signature="serialization::archive" version="11">
4+
<networkFile class_id="0" tracking_level="0" version="2">
5+
<networkInfo class_id="1" tracking_level="0" version="0">
6+
<modules class_id="2" tracking_level="0" version="0">
7+
<count>3</count>
8+
<item_version>0</item_version>
9+
<item class_id="3" tracking_level="0" version="0">
10+
<first>CreateMatrix:1</first>
11+
<second class_id="4" tracking_level="0" version="0">
12+
<module class_id="5" tracking_level="0" version="0">
13+
<package_name_>SCIRun</package_name_>
14+
<category_name_>Math</category_name_>
15+
<module_name_>CreateMatrix</module_name_>
16+
</module>
17+
<state class_id="6" tracking_level="0" version="0">
18+
<stateMap class_id="7" tracking_level="0" version="0">
19+
<count>1</count>
20+
<item_version>0</item_version>
21+
<item class_id="8" tracking_level="0" version="0">
22+
<first class_id="9" tracking_level="0" version="0">
23+
<name>TextEntry</name>
24+
</first>
25+
<second class_id="10" tracking_level="0" version="0">
26+
<name>TextEntry</name>
27+
<value class_id="11" tracking_level="0" version="0">
28+
<which>2</which>
29+
<value>1 1
30+
1 1
31+
1 1</value>
32+
</value>
33+
</second>
34+
</item>
35+
</stateMap>
36+
</state>
37+
</second>
38+
</item>
39+
<item>
40+
<first>EvaluateLinearAlgebraUnary:0</first>
41+
<second>
42+
<module>
43+
<package_name_>SCIRun</package_name_>
44+
<category_name_>Math</category_name_>
45+
<module_name_>EvaluateLinearAlgebraUnary</module_name_>
46+
</module>
47+
<state>
48+
<stateMap>
49+
<count>3</count>
50+
<item_version>0</item_version>
51+
<item>
52+
<first>
53+
<name>FunctionString</name>
54+
</first>
55+
<second>
56+
<name>FunctionString</name>
57+
<value>
58+
<which>2</which>
59+
<value>2*x+10</value>
60+
</value>
61+
</second>
62+
</item>
63+
<item>
64+
<first>
65+
<name>Operator</name>
66+
</first>
67+
<second>
68+
<name>Operator</name>
69+
<value>
70+
<which>0</which>
71+
<value>3</value>
72+
</value>
73+
</second>
74+
</item>
75+
<item>
76+
<first>
77+
<name>ScalarValue</name>
78+
</first>
79+
<second>
80+
<name>ScalarValue</name>
81+
<value>
82+
<which>1</which>
83+
<value>-5.70000000000000020e+000</value>
84+
</value>
85+
</second>
86+
</item>
87+
</stateMap>
88+
</state>
89+
</second>
90+
</item>
91+
<item>
92+
<first>ReportMatrixInfo:2</first>
93+
<second>
94+
<module>
95+
<package_name_>SCIRun</package_name_>
96+
<category_name_>Math</category_name_>
97+
<module_name_>ReportMatrixInfo</module_name_>
98+
</module>
99+
<state>
100+
<stateMap>
101+
<count>0</count>
102+
<item_version>0</item_version>
103+
</stateMap>
104+
</state>
105+
</second>
106+
</item>
107+
</modules>
108+
<connections class_id="12" tracking_level="0" version="0">
109+
<count>2</count>
110+
<item_version>0</item_version>
111+
<item class_id="13" tracking_level="0" version="0">
112+
<moduleId1_>CreateMatrix:1</moduleId1_>
113+
<port1_ class_id="14" tracking_level="0" version="0">
114+
<name>EnteredMatrix</name>
115+
<id>0</id>
116+
</port1_>
117+
<moduleId2_>EvaluateLinearAlgebraUnary:0</moduleId2_>
118+
<port2_>
119+
<name>InputMatrix</name>
120+
<id>0</id>
121+
</port2_>
122+
</item>
123+
<item>
124+
<moduleId1_>EvaluateLinearAlgebraUnary:0</moduleId1_>
125+
<port1_>
126+
<name>Result</name>
127+
<id>0</id>
128+
</port1_>
129+
<moduleId2_>ReportMatrixInfo:2</moduleId2_>
130+
<port2_>
131+
<name>InputMatrix</name>
132+
<id>0</id>
133+
</port2_>
134+
</item>
135+
</connections>
136+
</networkInfo>
137+
<modulePositions class_id="15" tracking_level="0" version="0">
138+
<count>3</count>
139+
<item_version>0</item_version>
140+
<item class_id="16" tracking_level="0" version="0">
141+
<first>CreateMatrix:1</first>
142+
<second class_id="17" tracking_level="0" version="0">
143+
<first>-6.84000000000000000e+002</first>
144+
<second>-4.56000000000000000e+002</second>
145+
</second>
146+
</item>
147+
<item>
148+
<first>EvaluateLinearAlgebraUnary:0</first>
149+
<second>
150+
<first>-6.84000000000000000e+002</first>
151+
<second>-3.04000000000000000e+002</second>
152+
</second>
153+
</item>
154+
<item>
155+
<first>ReportMatrixInfo:2</first>
156+
<second>
157+
<first>-6.84000000000000000e+002</first>
158+
<second>-1.52000000000000000e+002</second>
159+
</second>
160+
</item>
161+
</modulePositions>
162+
<moduleNotes class_id="18" tracking_level="0" version="0">
163+
<count>0</count>
164+
<item_version>0</item_version>
165+
</moduleNotes>
166+
<connectionNotes>
167+
<count>0</count>
168+
<item_version>0</item_version>
169+
</connectionNotes>
170+
</networkFile>
171+
</boost_serialization>
172+

src/Interface/Modules/Math/EvaluateLinearAlgebraBinaryDialog.cc

Lines changed: 2 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -27,19 +27,12 @@
2727
*/
2828

2929
#include <Interface/Modules/Math/EvaluateLinearAlgebraBinaryDialog.h>
30-
#include <Interface/Modules/Math/ui_EvaluateLinearAlgebraBinary.h>
31-
#include <Modules/Math/EvaluateLinearAlgebraBinary.h>
32-
#include <Core/Algorithms/Math/EvaluateLinearAlgebraBinaryAlgo.h> //TODO
3330
#include <Core/Algorithms/Base/AlgorithmVariableNames.h>
34-
#include <Dataflow/Network/ModuleStateInterface.h> //TODO: extract into intermediate
3531

3632
using namespace SCIRun::Gui;
3733
using namespace SCIRun::Dataflow::Networks;
38-
using namespace SCIRun::Core::Algorithms::Math;
3934
using namespace SCIRun::Core::Algorithms;
4035

41-
//typedef SCIRun::Modules::Math::EvaluateLinearAlgebraBinaryModule EvaluateLinearAlgebraBinaryModule;
42-
4336
EvaluateLinearAlgebraBinaryDialog::EvaluateLinearAlgebraBinaryDialog(const std::string& name, ModuleStateHandle state,
4437
QWidget* parent /* = 0 */)
4538
: ModuleDialogGeneric(state, parent)
@@ -49,69 +42,10 @@ EvaluateLinearAlgebraBinaryDialog::EvaluateLinearAlgebraBinaryDialog(const std::
4942
fixSize();
5043

5144
addLineEditManager(functionLineEdit_, Variables::FunctionString);
52-
connect(addRadioButton_, SIGNAL(clicked()), this, SLOT(pushOperationToState()));
53-
connect(subtractRadioButton_, SIGNAL(clicked()), this, SLOT(pushOperationToState()));
54-
connect(multiplyRadioButton_, SIGNAL(clicked()), this, SLOT(pushOperationToState()));
55-
connect(functionRadioButton_, SIGNAL(clicked()), this, SLOT(pushOperationToState()));
56-
//buttonBox->setVisible(false);
57-
}
58-
59-
int EvaluateLinearAlgebraBinaryDialog::getSelectedOperator() const
60-
{
61-
if (addRadioButton_->isChecked())
62-
return (int)EvaluateLinearAlgebraBinaryAlgorithm::ADD;
63-
if (subtractRadioButton_->isChecked())
64-
return (int)EvaluateLinearAlgebraBinaryAlgorithm::SUBTRACT;
65-
if (multiplyRadioButton_->isChecked())
66-
return (int)EvaluateLinearAlgebraBinaryAlgorithm::MULTIPLY;
67-
if (functionRadioButton_->isChecked())
68-
return (int)EvaluateLinearAlgebraBinaryAlgorithm::FUNCTION;
69-
else
70-
return -1;
71-
}
72-
73-
void EvaluateLinearAlgebraBinaryDialog::setSelectedOperator(int op)
74-
{
75-
functionLineEdit_->setEnabled(false);
76-
switch (op)
77-
{
78-
case (int)EvaluateLinearAlgebraBinaryAlgorithm::ADD:
79-
addRadioButton_->setChecked(true);
80-
break;
81-
case (int)EvaluateLinearAlgebraBinaryAlgorithm::SUBTRACT:
82-
subtractRadioButton_->setChecked(true);
83-
break;
84-
case(int)EvaluateLinearAlgebraBinaryAlgorithm::MULTIPLY:
85-
multiplyRadioButton_->setChecked(true);
86-
break;
87-
case(int)EvaluateLinearAlgebraBinaryAlgorithm::FUNCTION:
88-
functionRadioButton_->setChecked(true);
89-
functionLineEdit_->setEnabled(true);
90-
break;
91-
}
92-
}
93-
94-
void EvaluateLinearAlgebraBinaryDialog::pushOperationToState(const QString& str)
95-
{
96-
auto op = (EvaluateLinearAlgebraBinaryAlgorithm::Operator) getSelectedOperator();
97-
if(state_->getValue(Variables::Operator).toInt() != op)
98-
state_->setValue(Variables::Operator, op);
99-
100-
std::string value = str.toStdString();
101-
if(state_->getValue(Variables::FunctionString).toString() != value)
102-
{
103-
state_->setValue(Variables::FunctionString, value);
104-
}
105-
}
106-
107-
void EvaluateLinearAlgebraBinaryDialog::pushOperationToState()
108-
{
109-
pushOperationToState(functionLineEdit_->text());
45+
addRadioButtonGroupManager({ addRadioButton_, subtractRadioButton_, multiplyRadioButton_, functionRadioButton_ }, Variables::Operator);
11046
}
11147

11248
void EvaluateLinearAlgebraBinaryDialog::pull()
11349
{
114-
//TODO convert to new widget managers
115-
setSelectedOperator(state_->getValue(Variables::Operator).toInt());
116-
functionLineEdit_->setText(QString::fromStdString(state_->getValue(Variables::FunctionString).toString()));
50+
pull_newVersionToReplaceOld();
11751
}

src/Interface/Modules/Math/EvaluateLinearAlgebraBinaryDialog.h

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,13 @@
3030
#define INTERFACE_MODULES_EVALUATELINEARALGEBRABINARYDIALOG_H
3131

3232
#include "Interface/Modules/Math/ui_EvaluateLinearAlgebraBinary.h"
33-
#include <boost/shared_ptr.hpp>
34-
#include <Modules/Basic/SendScalarModuleState.h>
3533
#include <Interface/Modules/Base/ModuleDialogGeneric.h>
3634
#include <Interface/Modules/Math/share.h>
3735

3836
namespace SCIRun {
3937
namespace Gui {
4038

4139
class SCISHARE EvaluateLinearAlgebraBinaryDialog : public ModuleDialogGeneric,
42-
//public SCIRun::State::SendScalarState,
4340
public Ui::EvaluateLinearAlgebraBinary
4441
{
4542
Q_OBJECT
@@ -49,13 +46,6 @@ class SCISHARE EvaluateLinearAlgebraBinaryDialog : public ModuleDialogGeneric,
4946
SCIRun::Dataflow::Networks::ModuleStateHandle state,
5047
QWidget* parent = 0);
5148
virtual void pull();
52-
53-
private Q_SLOTS:
54-
void pushOperationToState(const QString& str);
55-
void pushOperationToState();
56-
private:
57-
int getSelectedOperator() const;
58-
void setSelectedOperator(int op);
5949
};
6050

6151
}

0 commit comments

Comments
 (0)