#ifndef COMPONENTS_H #define COMPONENTS_H #include #include #include class POINT{ int x,y,z,hole; public: POINT(); POINT(unsigned _x, unsigned _y, unsigned _hole); POINT(const POINT &p); void incy(); void decy(); std::string getscad() const; void set (unsigned x, unsigned y, unsigned hole); void sety (unsigned y); void setz (unsigned z); POINT movehole(unsigned hole) const; POINT movey(unsigned y) const; POINT addy(int y) const; POINT switchside() const; POINT to_vcc() const; POINT to_ground() const; }; class IC{ unsigned nbpin; unsigned pos; std::string name; void print(); public: IC(unsigned _nbpin, unsigned _pos, PARAM_STRING _name); POINT pin(unsigned no, unsigned hole); unsigned pin_y(unsigned no); }; class TO220{ std::string name; bool reverse; unsigned x,y,hole; void print(); public: TO220(bool _reverse, unsigned _x, unsigned _y, unsigned _hole, PARAM_STRING _name); POINT pin(unsigned no, unsigned hole); unsigned pin_y(unsigned no); }; enum CONNECTOR_TYPE{ CONNECT_MALE, CONNECT_FEMALE }; class CONNECTOR{ CONNECTOR_TYPE type; std::string name; unsigned x,y,hole; unsigned nbpin; void print(); public: CONNECTOR(unsigned _x, unsigned _y, unsigned _hole, unsigned _nbpin, CONNECTOR_TYPE type, PARAM_STRING _name); POINT pin(unsigned no, unsigned hole); unsigned pin_y(unsigned no); }; void jumper (const POINT &p1, const POINT &p2, PARAM_STRING color); void jumper (const POINT &p1, const POINT &p2); // jumper qui fait un S au point y void jumper (const POINT &p1, unsigned y, const POINT &p2, PARAM_STRING color); void jumper (const POINT &p1, unsigned y, const POINT &p2); // jumper vers le ground ou vcc. Le y fournit le point d'attache sur le ground ou vcc void jumper_ground (const POINT &p1, unsigned y, PARAM_STRING color); void jumper_vcc (const POINT &p1, unsigned y, PARAM_STRING color); void jump0 (PARAM_STRING color, unsigned height, const POINT &p1, const POINT &p2); template void jump0(PARAM_STRING color, unsigned height, const T &t1, const T &t2, Ts ... ts) { jump0(color,height,t1,t2); jump0(color,height,t2,ts...); } void jump_vertical (PARAM_STRING color, unsigned height, const POINT &p1); void jump_last_vertical (PARAM_STRING color, unsigned height); void jump (PARAM_STRING color, unsigned height, const POINT &p1, const POINT &p2); template void jump(PARAM_STRING color, unsigned height, const T &t1, const T &t2, Ts ... ts) { jump_vertical(color,height,t1); jump0(color,height,t1,t2,ts...); jump_last_vertical(color,height); } void resistor (const POINT &p1, const POINT &p2, PARAM_STRING color, unsigned value); void resistor_ground (const POINT &p1, unsigned y, PARAM_STRING color, unsigned value); void resistor_vcc (const POINT &p1, unsigned y, PARAM_STRING color, unsigned value); void diode (const POINT &p1, const POINT &p2, PARAM_STRING color); void diode_to_ground (const POINT &p1, unsigned y, PARAM_STRING color); void diode_to_vcc (const POINT &p1, unsigned y, PARAM_STRING color); void diode_from_ground (const POINT &p1, unsigned y, PARAM_STRING color); void diode_from_vcc (const POINT &p1, unsigned y, PARAM_STRING color); void led (const POINT &p1, const POINT &p2, PARAM_STRING color); void led_to_ground (const POINT &p1, unsigned y, PARAM_STRING color); void led_from_vcc (const POINT &p1, unsigned y, PARAM_STRING color); #endif