Fix linux compilation.
This commit is contained in:
parent
ec57e3b534
commit
990cde402b
28 changed files with 245 additions and 161 deletions
|
@ -5,68 +5,73 @@
|
|||
#include "LogicGateNode.h"
|
||||
|
||||
ElectronicCircuitNode::ElectronicCircuitNode(const Transform& transform)
|
||||
: AbstractVisualNode(transform)
|
||||
: AbstractVisualNode(transform)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
ElectronicCircuitNode::~ElectronicCircuitNode()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void ElectronicCircuitNode::setContent(ElectronicCircuit* content)
|
||||
{
|
||||
mContent = content;
|
||||
mContentDirty = true;
|
||||
mContent = content;
|
||||
mContentDirty = true;
|
||||
}
|
||||
|
||||
void ElectronicCircuitNode::createOrUpdateGeometry(SceneInfo* sceneInfo)
|
||||
{
|
||||
mInputTerminalNodes.clear();
|
||||
mWireNodes.clear();
|
||||
mLogicGateNodes.clear();
|
||||
mInputTerminalNodes.clear();
|
||||
mWireNodes.clear();
|
||||
mLogicGateNodes.clear();
|
||||
|
||||
// Layout terminals
|
||||
double terminal_vertical_spacing = 100;
|
||||
double terminal_left_margin = 10;
|
||||
// Layout terminals
|
||||
double terminal_vertical_spacing = 100;
|
||||
double terminal_left_margin = 10;
|
||||
|
||||
double terminal_y = 0;
|
||||
for (auto terminal : mContent->getInputTerminals())
|
||||
{
|
||||
Point loc{ terminal_left_margin, terminal_y };
|
||||
auto terminal_node = std::make_unique<TerminalNode>(Transform(loc));
|
||||
double terminal_y = 0;
|
||||
for (auto terminal : mContent->getInputTerminals())
|
||||
{
|
||||
Point loc{ terminal_left_margin, terminal_y };
|
||||
auto terminal_node = std::make_unique<TerminalNode>(Transform(loc));
|
||||
|
||||
terminal_node->setContent(terminal);
|
||||
terminal_node->setContent(terminal);
|
||||
|
||||
addChild(terminal_node.get());
|
||||
mInputTerminalNodes.push_back(std::move(terminal_node));
|
||||
addChild(terminal_node.get());
|
||||
mInputTerminalNodes.push_back(std::move(terminal_node));
|
||||
|
||||
terminal_y += terminal_vertical_spacing;
|
||||
}
|
||||
terminal_y += terminal_vertical_spacing;
|
||||
}
|
||||
|
||||
// Layout logic gates
|
||||
double logic_gate_vertical_spacing = 100;
|
||||
double logic_gate_horizontal_spacing = 100;
|
||||
// Layout logic gates
|
||||
double logic_gate_vertical_spacing = 100;
|
||||
double logic_gate_horizontal_spacing = 100;
|
||||
|
||||
double gate_x = logic_gate_vertical_spacing;
|
||||
double gate_y = 0;
|
||||
for (auto gate : mContent->getLogicGates())
|
||||
{
|
||||
Point loc{ gate_x, gate_y };
|
||||
auto gate_node = std::make_unique<LogicGateNode>(Transform(loc));
|
||||
double gate_x = logic_gate_vertical_spacing;
|
||||
double gate_y = 0;
|
||||
for (auto gate : mContent->getLogicGates())
|
||||
{
|
||||
Point loc{ gate_x, gate_y };
|
||||
auto gate_node = std::make_unique<LogicGateNode>(Transform(loc));
|
||||
|
||||
gate_node->setContent(gate);
|
||||
gate_node->setContent(gate);
|
||||
|
||||
addChild(gate_node.get());
|
||||
mLogicGateNodes.push_back(std::move(gate_node));
|
||||
addChild(gate_node.get());
|
||||
mLogicGateNodes.push_back(std::move(gate_node));
|
||||
|
||||
gate_x += logic_gate_vertical_spacing;
|
||||
gate_y += logic_gate_horizontal_spacing;
|
||||
}
|
||||
gate_x += logic_gate_vertical_spacing;
|
||||
gate_y += logic_gate_horizontal_spacing;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void ElectronicCircuitNode::update(SceneInfo* sceneInfo)
|
||||
{
|
||||
if (mContentDirty)
|
||||
{
|
||||
createOrUpdateGeometry(sceneInfo);
|
||||
mContentDirty = false;
|
||||
}
|
||||
}
|
||||
if (mContentDirty)
|
||||
{
|
||||
createOrUpdateGeometry(sceneInfo);
|
||||
mContentDirty = false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue