Simple Nano Circuit 0.0.2
FootPinNode.h
1#ifndef _FootPinNode_H_
2#define _FootPinNode_H_
3
4#include "PinProperty.h"
5#include "ICType.h"
6
7#include "BaseElectronObject.h"
8#include "NetlistManagerClass.h"
9#include "NetlistClass.h"
10
11class BaseIcObject;
12class WireObject;
13
15{
16 private:
17 enum class PinType
18 {
19 FreePoint = 1,
20 ICFoot,
21 WirePoint,
22 };
23 FootPinNode::PinType pinType;
24
25 struct StoreData
26 {
27 ICType id;
28 SDL_Point centerPos;
29 };
30 StoreData storeData;
31
32 public:
33 void calcCenterPos();
34 private:
35 SDL_Point relatePos = {0, 0};
36 void buildRelateXY4IC();
37
38 private:
39
40 private:
41
42 private:
43 SDL_Rect calcDrawingRect();
44
45 public:
46 enum class ClockLocation
47 {
48 FREE = 1,
49 LEFT,
50 RIGHT,
51 TOP,
52 BOTTOM,
53 LEFTTOP,
54 LEFTBOTTOM,
55 RIGHTTOP,
56 RIGHTBOTTOM
57 };
58
59 enum class WireEndPointLocation
60 {
61 START = 1,
62 END
63 };
64
65 public:
66 FootPinNode( BaseIcObject* , FootPinNode::ClockLocation , int , ICType , PinProperty );
67
68 BaseIcObject* forIC = nullptr;
69 FootPinNode::ClockLocation pinClockLocation;
70 int pinOffset = 0;
71
72 void turnClockLocation();
73 void turnClockMirrow();
74
75 PinProperty pinProperty = PinProperty::NonPolar;
76 ICType fatherIcType = ICType::None;
77
78 public:
81 FootPinNode(const unsigned char*, AsgardClass*);
82
83 BaseElectronObject* processClickEvent( SDL_Point& ) override;
84 void processKeyEvent( int ) override { return; };
85 BaseElectronObject* deepDuplicateSelf() override;
86 void calcCenterPos4Wire();
87
88 public:
89 FootPinNode( WireObject* , FootPinNode::WireEndPointLocation );
90
91 WireObject* forWire = nullptr;
92 FootPinNode::WireEndPointLocation pinWireEndPointLocation;
93
94 public:
96
97 SDL_Rect selfLocationRect;
98 SDL_Point centerPos;
99 const ICType getType() const override {return ICType::FootPin;}
100 SDL_Rect getLocationRect() override;
101
102 void Drawing() override;
103 void Drawing( BaseElectronObject::RendererEffective ) override;
104
105 NetlistManagerClass::BindResult bindNetlist();
106
107 // 任何点类型都可使用
108 bool havePopupWindow() override {return false;}
109 const char* popupWindowName() const override {return "";}
110 void CreateImGuiForm() override {return;};
111
112 bool isPinSameLocation( FootPinNode* );
113 bool isPointSameLocation( SDL_Point& );
114
115 bool isFreePin();
116
117 NetlistClass* attachedNet = nullptr;
118 void setNetlist( NetlistClass* _nl) {this->attachedNet = _nl;};
119
120 NetlistClass* getNetlist() { return nullptr; }; // 尚未实现
121 size_t getNetlistIndex();
122
123 public: // setInvalid()和updateCurrentState()是否进行传递
124 enum class Translate
125 {
126 Yes = 1,
127 No,
128 };
129
130
131 private:
132 double current = 0.0;
133 bool currentReady = false;
134 public:
135 void resetCurrentState();
136 bool isCurrentReady();
137 std::string getPosLocationDescription();
138 void updateCurrentState(double, Translate);
139 double getCurrent();
140
141 private:
142 bool valid = false;
143 public:
144 bool isValid();
145 bool isInvalid();
146 void setValid();
147 void setInvalid(Translate);
148
149 double voltage = 0.0;
150 void setVoltage(const double&);
151 double getVoltage() {return this->voltage;};
152
153 void saveToFile(std::ofstream&) override;
154
155 void processMouseMotion(const SDL_Point&) override;
156};
157
158#endif
Definition: AsgardClass.h:17
Definition: BaseElectronObject.h:13
Definition: BaseIcObject.h:11
Definition: FootPinNode.h:15
FootPinNode(BaseIcObject *, FootPinNode::ClockLocation, int, ICType, PinProperty)
ICFoot.
Definition: FootPinNode.cpp:46
~FootPinNode()
任何点类型都可使用
Definition: FootPinNode.h:95
Definition: NetlistClass.h:19
Definition: WireObject.h:14