Skip to content

Commit

Permalink
show subterminal names and sizes for multifeature terminals
Browse files Browse the repository at this point in the history
  • Loading branch information
Ylannl committed Jul 28, 2020
1 parent f2f9461 commit 1eda61f
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 12 deletions.
1 change: 1 addition & 0 deletions src/geoflow/core_nodes.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ namespace geoflow::nodes::core {
vector_output(node_name+"."+term_name).push_back_any(data);
}
} else {
std::cout << "pushing empty any for " << node_name+"."+term_name << "at i=" << i << std::endl;
vector_output(node_name+"."+term_name).push_back_any(std::any());
}
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/geoflow/geoflow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const std::vector<std::any>& gfSingleFeatureInputTerminal::get_data_vec() const
auto sot = (gfSingleFeatureOutputTerminal*)(output_term.get());
return sot->get_data_vec();
}
size_t gfSingleFeatureInputTerminal::size() {
size_t gfSingleFeatureInputTerminal::size() const {
auto output_term = connected_output_.lock();
auto sot = (gfSingleFeatureOutputTerminal*)(output_term.get());
return sot->size();
Expand Down Expand Up @@ -255,7 +255,7 @@ bool gfMultiFeatureInputTerminal::is_touched() {
}
return false;
}
size_t gfMultiFeatureInputTerminal::size() {
size_t gfMultiFeatureInputTerminal::size() const{
if (connected_outputs_.size()==0)
return 0;
else
Expand All @@ -279,7 +279,7 @@ bool gfMultiFeatureOutputTerminal::has_data() const {
}
return true;
}
size_t gfMultiFeatureOutputTerminal::size() {
size_t gfMultiFeatureOutputTerminal::size() const {
if (terminals_.size()==0)
return 0;
else
Expand Down
12 changes: 6 additions & 6 deletions src/geoflow/geoflow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ namespace geoflow {
}
const gfIO get_side() { return GF_IN; };
bool is_optional() { return is_optional_; };
virtual size_t size() = 0;
virtual size_t size() const = 0;

friend class gfOutputTerminal;
friend class gfSingleFeatureOutputTerminal;
Expand Down Expand Up @@ -170,7 +170,7 @@ namespace geoflow {
const gfTerminalFamily get_family() { return GF_SINGLE_FEATURE; };
template<typename T> const T get(size_t i);
const std::vector<std::any>& get_data_vec() const;
size_t size();
size_t size() const;

friend class gfSingleFeatureOutputTerminal;
};
Expand Down Expand Up @@ -202,7 +202,7 @@ namespace geoflow {
void connect(gfInputTerminal& in);
void disconnect(gfInputTerminal& in);

virtual size_t size()=0;
virtual size_t size() const=0;
void set_type(std::type_index type) {types_ = {type}; }

void touch() { is_touched_=true; };
Expand Down Expand Up @@ -265,7 +265,7 @@ namespace geoflow {
}

// multi element
size_t size() { return data_.size(); };
size_t size() const { return data_.size(); };
template<typename T>void resize(size_t n) {
return data_.resize(n, T());
};
Expand Down Expand Up @@ -329,7 +329,7 @@ namespace geoflow {
bool has_data() const;
bool is_touched();
bool has_connection() {return connected_outputs_.size() > 0; };
size_t size();
size_t size() const;

const SubTermRefs& sub_terminals() { return sub_terminals_; };
// const BasicRefs& basic_terminals() { return basic_terminals_; };
Expand Down Expand Up @@ -357,7 +357,7 @@ namespace geoflow {
using gfOutputTerminal::gfOutputTerminal;
const gfTerminalFamily get_family() { return GF_MULTI_FEATURE; };
bool has_data() const;
size_t size();
size_t size() const;

// note these 2 are almost the same now:
gfSingleFeatureOutputTerminal& add(std::string term_name, std::type_index ttype ) ;
Expand Down
20 changes: 17 additions & 3 deletions src/geoflow/gui/ImNodesEz.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,23 @@ bool Slot(geoflow::gfTerminal* term, int kind)
ImGui::SameLine(); ImGui::Text("(size: %lu)", ot->size());
}
}
} else if (term->get_family()==geoflow::GF_MULTI_FEATURE )
ImGui::TextUnformatted("Family: Multi Feature");
else
} else if (term->get_family()==geoflow::GF_MULTI_FEATURE ) {
if(term->get_side()==geoflow::GF_IN) {
ImGui::TextUnformatted("Family: Multi Feature");
auto* it = (geoflow::gfMultiFeatureInputTerminal*) term;
for (auto& subterm : it->sub_terminals()) {
ImGui::Text(" %lu %s, ", subterm->size(), subterm->get_name().c_str());
// ImGui::Text(" %s)", subterm->get_type().name());
}
} else {
ImGui::TextUnformatted("Family: Multi Feature");
auto* it = (geoflow::gfMultiFeatureOutputTerminal*) term;
for (auto& [name, subterm] : it->sub_terminals()) {
ImGui::Text(" %lu %s, ", subterm->size(), subterm->get_name().c_str());
// ImGui::Text(" %s)", subterm->get_type().name());
}
}
} else
ImGui::TextUnformatted("Family: Unknown");

ImGui::Text("Compatible types:");
Expand Down

0 comments on commit 1eda61f

Please sign in to comment.