25Multiplier::~Multiplier()
27 for (
auto& node : m_nodeList) if (node) delete node;
44void Multiplier::DrawDCSymbol(wxGraphicsContext* gc)
const
47 gc->SetPen(wxPen(wxColour(0, 77, 255, 255), 2));
48 gc->SetBrush(*wxTRANSPARENT_BRUSH);
49 wxPoint2DDouble xSymbol[4];
50 xSymbol[0] = m_position + wxPoint2DDouble(-5, -5);
51 xSymbol[1] = m_position + wxPoint2DDouble(5, 5);
52 xSymbol[2] = m_position + wxPoint2DDouble(-5, 5);
53 xSymbol[3] = m_position + wxPoint2DDouble(5, -5);
54 gc->StrokeLines(2, &xSymbol[0]);
55 gc->StrokeLines(2, &xSymbol[2]);
58bool Multiplier::Solve(
double* input,
double timeStep)
60 std::vector<double> inputVector;
61 for(
auto itN = m_nodeList.begin(), itNEnd = m_nodeList.end(); itN != itNEnd; ++itN) {
63 if(node->GetNodeType() != Node::NodeType::NODE_OUT) {
64 if(!node->IsConnected()) {
65 inputVector.push_back(1.0);
67 for(
auto itC = m_childList.begin(), itCEnd = m_childList.end(); itC != itCEnd; ++itC) {
69 auto nodeList = cLine->GetNodeList();
70 for(
auto itCN = nodeList.begin(), itCNEnd = nodeList.end(); itCN != itCNEnd; ++itCN) {
71 Node* childNode = *itCN;
72 if(childNode == node) {
73 inputVector.push_back(cLine->GetValue());
83 for(
unsigned int i = 0; i < inputVector.size(); ++i) { m_output *= inputVector[i]; }
95rapidxml::xml_node<>* Multiplier::SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode)
97 auto elementNode = XMLParser::AppendNode(doc, elementListNode,
"Multiplier");
98 XMLParser::SetNodeAttribute(doc, elementNode,
"ID", m_elementID);
100 SaveCADProperties(doc, elementNode);
101 SaveControlNodes(doc, elementNode);
106bool Multiplier::OpenElement(rapidxml::xml_node<>* elementNode)
108 if(!OpenCADProperties(elementNode))
return false;
109 if(!OpenControlNodes(elementNode))
return false;
Connection between two control elements or other connection line and an element.
virtual void StartMove(wxPoint2DDouble position)
Update the element attributes related to the movement.
Base class of all elements of the program. This class is responsible for manage graphical and his dat...
Abstract class that define the general behavior of math operation control block.
virtual Element * GetCopy()
Get a the element copy.
Node of a control element. This class manages the user interaction with the connection and control el...