-
Notifications
You must be signed in to change notification settings - Fork 12
Feature/core updates etc #287
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
b9529a9
DevTools: eventlogger added option to log before and after
petersteneteg cf5e514
Various: update for core getIdentifier() string -> string_view change
petersteneteg ccf2aab
VTK: port update to core changes
petersteneteg 2e4c713
VTK: port update to core changes
petersteneteg File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,6 +35,7 @@ | |
| #include <inviwo/core/metadata/processormetadata.h> | ||
| #include <inviwo/core/util/stringconversion.h> | ||
| #include <inviwo/core/network/networkutils.h> | ||
| #include <inviwo/core/util/safecstr.h> | ||
| #include <inviwo/graphviz/graphvizutil.h> | ||
|
|
||
| #include <graphviz/cgraph.h> | ||
|
|
@@ -158,8 +159,7 @@ void calculateLayout(StrBuffer& buff, ProcessorNetwork* net, const Func& func) { | |
| ivec2 center{0}; | ||
| int count = 0; | ||
| net->forEachProcessor([&](Processor* p) { | ||
| const std::string identifier{p->getIdentifier()}; | ||
| if (auto* n = agnode(G, const_cast<char*>(identifier.c_str()), 0)) { | ||
| if (auto* n = agnode(G, const_cast<char*>(SafeCStr{p->getIdentifier()}.c_str()), 0)) { | ||
| const auto& coord = ND_coord(n); | ||
| center += ivec2{coord.x, -coord.y}; | ||
| ++count; | ||
|
|
@@ -174,8 +174,7 @@ void calculateLayout(StrBuffer& buff, ProcessorNetwork* net, const Func& func) { | |
| const dvec2 offset = oldCenter - newCenter; | ||
|
|
||
| net->forEachProcessor([&](Processor* p) { | ||
| const std::string identifier{p->getIdentifier()}; | ||
| if (auto* n = agnode(G, const_cast<char*>(identifier.c_str()), 0)) { | ||
| if (auto* n = agnode(G, const_cast<char*>(SafeCStr{p->getIdentifier()}.c_str()), 0)) { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-tidy diagnosticmisc/graphviz/src/graphvizsettings.cpp:177:33: warning: [cppcoreguidelines-pro-type-const-cast]
177 | if (auto* n = agnode(G, const_cast<char*>(SafeCStr{p->getIdentifier()}.c_str()), 0)) {
| ^ |
||
| const auto& coord = ND_coord(n); | ||
| func(p, dvec2{coord.x, -coord.y} + offset); | ||
| } | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -90,14 +90,48 @@ bool VtkInport::canConnectTo(const Port* port) const { | |||||
| } | ||||||
| return false; | ||||||
| } | ||||||
|
|
||||||
| void VtkInport::connectTo(Outport* outport) { | ||||||
| if (!outport) return; | ||||||
| if (isConnectedTo(outport)) return; | ||||||
|
|
||||||
| if (auto* vtkOutport = dynamic_cast<VtkOutport*>(outport)) { | ||||||
| if (getNumberOfConnections() + 1 > getMaxNumberOfConnections()) { | ||||||
| throw Exception("Trying to connect to a full port."); | ||||||
| } | ||||||
| outports_.push_back(vtkOutport); | ||||||
|
|
||||||
| doConnectTo(outport); | ||||||
| } else { | ||||||
| throw Exception("Trying to connect incompatible ports."); | ||||||
| } | ||||||
| } | ||||||
| void VtkInport::disconnectFrom(Outport* outport) { | ||||||
| if (auto it = std::ranges::find_if(outports_, [&](VtkOutport* p) { return p == outport; }); | ||||||
| it != outports_.end()) { | ||||||
|
|
||||||
| outports_.erase(it); | ||||||
| doDisconnectFrom(outport); | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| Outport* VtkInport::getConnectedOutport(size_t i) const { | ||||||
| if (i < outports_.size()) { | ||||||
| return outports_[i]; | ||||||
| } else { | ||||||
| return nullptr; | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| size_t VtkInport::getMaxNumberOfConnections() const { | ||||||
| return repeatable_ == Repeatable::Yes ? std::numeric_limits<size_t>::max() : 1; | ||||||
| } | ||||||
|
|
||||||
| size_t VtkInport::getNumberOfConnections() const { return outports_.size(); } | ||||||
|
|
||||||
| vtkDataObject* VtkInport::getData(size_t i) const { | ||||||
| if (i < connectedOutports_.size()) { | ||||||
| // NOLINTNEXTLINE(cppcoreguidelines-pro-type-static-cast-downcast) | ||||||
| return static_cast<VtkOutport*>(connectedOutports_[i])->getData(); | ||||||
| if (i < outports_.size()) { | ||||||
| return outports_[i]->getData(); | ||||||
| } | ||||||
| return nullptr; | ||||||
| } | ||||||
|
|
@@ -153,8 +187,8 @@ int VtkInport::getTypeId() const { return typeId_; } | |||||
|
|
||||||
| void VtkInport::setTypeId(int typeId) { | ||||||
| typeId_ = typeId; | ||||||
| std::vector<Outport*> portsToRemove = | ||||||
| util::copy_if(connectedOutports_, [&](auto port) { return !canConnectTo(port); }); | ||||||
| std::vector<VtkOutport*> portsToRemove = | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. clang-tidy diagnostics
Suggested change
|
||||||
| util::copy_if(outports_, [&](auto port) { return !canConnectTo(port); }); | ||||||
| for (auto outport : portsToRemove) { | ||||||
| getProcessor()->getNetwork()->removeConnection(outport, this); | ||||||
| } | ||||||
|
|
||||||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
clang-tidy diagnostic
misc/graphviz/src/graphvizsettings.cpp:162:37: warning: [cppcoreguidelines-pro-type-const-cast]