25Multiplier::~Multiplier()
27 for (
auto& node : m_nodeList) if (node) delete node;
31void Multiplier::DrawDCSymbol(
GUIColour* guiColour, wxGraphicsContext* gc)
const
34 gc->SetPen(wxPen(guiColour->bus, 2));
35 gc->SetBrush(*wxTRANSPARENT_BRUSH);
36 wxPoint2DDouble xSymbol[4];
37 xSymbol[0] = m_position + wxPoint2DDouble(-5, -5);
38 xSymbol[1] = m_position + wxPoint2DDouble(5, 5);
39 xSymbol[2] = m_position + wxPoint2DDouble(-5, 5);
40 xSymbol[3] = m_position + wxPoint2DDouble(5, -5);
41 gc->StrokeLines(2, &xSymbol[0]);
42 gc->StrokeLines(2, &xSymbol[2]);
45bool Multiplier::Solve(
double* input,
double timeStep)
47 std::vector<double> inputVector;
48 for(
auto itN = m_nodeList.begin(), itNEnd = m_nodeList.end(); itN != itNEnd; ++itN) {
50 if(node->GetNodeType() != Node::NodeType::NODE_OUT) {
51 if(!node->IsConnected()) {
52 inputVector.push_back(1.0);
54 for(
auto itC = m_childList.begin(), itCEnd = m_childList.end(); itC != itCEnd; ++itC) {
56 auto nodeList = cLine->GetNodeList();
57 for(
auto itCN = nodeList.begin(), itCNEnd = nodeList.end(); itCN != itCNEnd; ++itCN) {
58 Node* childNode = *itCN;
59 if(childNode == node) {
60 inputVector.push_back(cLine->GetValue());
70 for(
unsigned int i = 0; i < inputVector.size(); ++i) { m_output *= inputVector[i]; }
81rapidxml::xml_node<>* Multiplier::SaveElement(rapidxml::xml_document<>& doc, rapidxml::xml_node<>* elementListNode)
83 auto elementNode = XMLParser::AppendNode(doc, elementListNode,
"Multiplier");
84 XMLParser::SetNodeAttribute(doc, elementNode,
"ID", m_elementID);
86 SaveCADProperties(doc, elementNode);
87 SaveControlNodes(doc, elementNode);
92bool Multiplier::OpenElement(rapidxml::xml_node<>* elementNode)
94 if(!OpenCADProperties(elementNode))
return false;
95 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...