Skip to content

Commit 760fad2

Browse files
committed
Make new port color/type
1 parent b05baa8 commit 760fad2

File tree

8 files changed

+234
-0
lines changed

8 files changed

+234
-0
lines changed

src/Dataflow/Network/ModuleDescription.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ void PortColorLookup::init()
5959
("ColorMap", "purple")
6060
("Bundle", "orange")
6161
("Nrrd", "cyan") // not quite right, it's bluer than the highlight cyan
62+
("ComplexDenseMatrix", "brown")
6263
("Datatype", "black");
6364
}
6465

src/Interface/Application/ModuleWidget.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,8 @@ QColor Gui::to_color(const std::string& str, int alpha)
144144
result = QColor(122,119,226);
145145
else if (str == "orange")
146146
result = QColor(254, 139, 38);
147+
else if (str == "brown")
148+
result = QColor(165, 42, 42);
147149
else
148150
result = Qt::black;
149151
}

src/Modules/Basic/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,10 +31,12 @@ SET(Modules_Basic_SRCS
3131
DynamicPortTester.cc
3232
NeedToExecuteTester.cc
3333
ReceiveScalar.cc
34+
ReceiveComplexScalar.cc
3435
ReceiveTestMatrix.cc
3536
ReceiveScalarModuleState.cc
3637
PrintDatatype.cc
3738
SendScalar.cc
39+
SendComplexScalar.cc
3840
SendTestMatrix.cc
3941
SendScalarModuleState.cc
4042
ChooseInput.cc
@@ -46,10 +48,12 @@ SET(Modules_Basic_HEADERS
4648
DynamicPortTester.h
4749
NeedToExecuteTester.h
4850
ReceiveScalar.h
51+
ReceiveComplexScalar.h
4952
ReceiveScalarModuleState.h
5053
ReceiveTestMatrix.h
5154
PrintDatatype.h
5255
SendScalar.h
56+
SendComplexScalar.h
5357
SendScalarModuleState.h
5458
SendTestMatrix.h
5559
ChooseInput.h
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
/*
2+
For more information, please see: http://software.sci.utah.edu
3+
4+
The MIT License
5+
6+
Copyright (c) 2015 Scientific Computing and Imaging Institute,
7+
University of Utah.
8+
9+
License for the specific language governing rights and limitations under
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this software and associated documentation files (the "Software"),
12+
to deal in the Software without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Software, and to permit persons to whom the
15+
Software is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
DEALINGS IN THE SOFTWARE.
27+
*/
28+
/// @todo Documentation Modules/Basic/ReceiveScalar.cc
29+
30+
#include <iostream>
31+
#include <Modules/Basic/ReceiveComplexScalar.h>
32+
#include <Core/Datatypes/DenseMatrix.h>
33+
#include <Core/Datatypes/Scalar.h>
34+
35+
using namespace SCIRun::Modules::Basic;
36+
using namespace SCIRun::Dataflow::Networks;
37+
using namespace SCIRun::Core::Datatypes;
38+
using namespace SCIRun::Core::Algorithms;
39+
40+
ReceiveComplexScalarModule::ReceiveComplexScalarModule()
41+
: Module(ModuleLookupInfo("ReceiveComplexScalar", "Math", "SCIRun"), false),
42+
latestValue_(-1)
43+
{
44+
INITIALIZE_PORT(Input);
45+
}
46+
47+
void ReceiveComplexScalarModule::execute()
48+
{
49+
auto doubleData = getRequiredInput(Input);
50+
//latestValue_ = doubleData->value();
51+
//get_state()->setValue(ReceivedValue, latestValue_);
52+
}
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
/*
2+
For more information, please see: http://software.sci.utah.edu
3+
4+
The MIT License
5+
6+
Copyright (c) 2015 Scientific Computing and Imaging Institute,
7+
University of Utah.
8+
9+
License for the specific language governing rights and limitations under
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this software and associated documentation files (the "Software"),
12+
to deal in the Software without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Software, and to permit persons to whom the
15+
Software is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
DEALINGS IN THE SOFTWARE.
27+
*/
28+
29+
#ifndef MODULES_BASIC_RECEIVE_COMPLEX_SCALAR_H
30+
#define MODULES_BASIC_RECEIVE_COMPLEX_SCALAR_H
31+
32+
#include <Dataflow/Network/Module.h>
33+
#include <Modules/Basic/share.h>
34+
35+
namespace SCIRun {
36+
namespace Modules {
37+
namespace Basic {
38+
39+
class SCISHARE ReceiveComplexScalarModule : public SCIRun::Dataflow::Networks::Module,
40+
public Has1InputPort<ComplexDenseMatrixPortTag>,
41+
public HasNoOutputPorts
42+
{
43+
public:
44+
ReceiveComplexScalarModule();
45+
virtual void execute();
46+
virtual void setStateDefaults() {}
47+
48+
Complex latestReceivedValue() const { return latestValue_; }
49+
50+
INPUT_PORT(0, Input, ComplexDenseMatrix);
51+
private:
52+
Complex latestValue_;
53+
};
54+
}}}
55+
56+
#endif
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
/*
2+
For more information, please see: http://software.sci.utah.edu
3+
4+
The MIT License
5+
6+
Copyright (c) 2015 Scientific Computing and Imaging Institute,
7+
University of Utah.
8+
9+
License for the specific language governing rights and limitations under
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this software and associated documentation files (the "Software"),
12+
to deal in the Software without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Software, and to permit persons to whom the
15+
Software is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
DEALINGS IN THE SOFTWARE.
27+
*/
28+
29+
#include <Core/Datatypes/Scalar.h>
30+
#include <Modules/Basic/SendComplexScalar.h>
31+
#include <Core/Datatypes/DenseMatrix.h>
32+
#include <Core/Logging/Log.h>
33+
34+
using namespace SCIRun::Modules::Basic;
35+
using namespace SCIRun::Core::Datatypes;
36+
using namespace SCIRun::Dataflow::Networks;
37+
using namespace SCIRun::Core::Algorithms;
38+
using namespace SCIRun::Core::Logging;
39+
40+
SendComplexScalarModule::SendComplexScalarModule()
41+
: Module(ModuleLookupInfo("SendComplexScalar", "Math", "SCIRun"), false),
42+
data_(-1)
43+
{
44+
INITIALIZE_PORT(Scalar);
45+
}
46+
47+
void SendComplexScalarModule::execute()
48+
{
49+
if (needToExecute())
50+
{
51+
//data_ = get_state()->getValue(SendScalarModule::ValueToSend()).toDouble();
52+
//LOG_DEBUG("Executing SendScalar with new value: " << data_);
53+
//boost::shared_ptr<Double> output(new Double(data_));
54+
//sendOutput(Scalar, output);
55+
}
56+
else
57+
{
58+
LOG_DEBUG("Executing SendScalar with old value, not sending anything: " << data_);
59+
}
60+
}
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
For more information, please see: http://software.sci.utah.edu
3+
4+
The MIT License
5+
6+
Copyright (c) 2015 Scientific Computing and Imaging Institute,
7+
University of Utah.
8+
9+
License for the specific language governing rights and limitations under
10+
Permission is hereby granted, free of charge, to any person obtaining a
11+
copy of this software and associated documentation files (the "Software"),
12+
to deal in the Software without restriction, including without limitation
13+
the rights to use, copy, modify, merge, publish, distribute, sublicense,
14+
and/or sell copies of the Software, and to permit persons to whom the
15+
Software is furnished to do so, subject to the following conditions:
16+
17+
The above copyright notice and this permission notice shall be included
18+
in all copies or substantial portions of the Software.
19+
20+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21+
OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
23+
THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
25+
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
26+
DEALINGS IN THE SOFTWARE.
27+
*/
28+
29+
#ifndef MODULES_BASIC_SEND_COMPLEX_SCALAR_H
30+
#define MODULES_BASIC_SEND_COMPLEX_SCALAR_H
31+
32+
#include <Dataflow/Network/Module.h>
33+
#include <Modules/Basic/share.h>
34+
35+
namespace SCIRun {
36+
namespace Modules {
37+
namespace Basic {
38+
39+
class SCISHARE SendComplexScalarModule : public SCIRun::Dataflow::Networks::Module,
40+
public Has1OutputPort<ComplexDenseMatrixPortTag>,
41+
public HasNoInputPorts
42+
{
43+
public:
44+
SendComplexScalarModule();
45+
virtual void execute();
46+
virtual void setStateDefaults() {}
47+
48+
OUTPUT_PORT(0, Scalar, ComplexDenseMatrix);
49+
private:
50+
Complex data_;
51+
};
52+
53+
}}}
54+
55+
#endif

src/Modules/Factory/ModuleFactoryImpl1.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ DEALINGS IN THE SOFTWARE.
2929
#include <Modules/Factory/ModuleDescriptionLookup.h>
3030
#include <Modules/Basic/ReceiveScalar.h>
3131
#include <Modules/Basic/SendScalar.h>
32+
#include <Modules/Basic/ReceiveComplexScalar.h>
33+
#include <Modules/Basic/SendComplexScalar.h>
3234
#include <Modules/Basic/ReceiveTestMatrix.h>
3335
#include <Modules/Basic/SendTestMatrix.h>
3436
#include <Modules/Basic/DynamicPortTester.h>
@@ -196,6 +198,8 @@ void ModuleDescriptionLookup::addTestingModules()
196198
{
197199
addModuleDesc<SendScalarModule>("SendScalar", "Testing", "SCIRun", "Functional, needs GUI and algorithm work.", "...");
198200
addModuleDesc<ReceiveScalarModule>("ReceiveScalar", "Testing", "SCIRun", "...", "...");
201+
addModuleDesc<SendComplexScalarModule>("SendComplexScalar", "Testing", "SCIRun", "...", "...");
202+
addModuleDesc<ReceiveComplexScalarModule>("ReceiveComplexScalar", "Testing", "SCIRun", "...", "...");
199203
addModuleDesc<SendTestMatrixModule>("SendTestMatrix", "Testing", "SCIRun", "...", "...");
200204
addModuleDesc<ReceiveTestMatrixModule>("ReceiveTestMatrix", "Testing", "SCIRun", "...", "...");
201205
addModuleDesc<DynamicPortTester>("DynamicPortTester", "Testing", "SCIRun", "...", "...");

0 commit comments

Comments
 (0)