@@ -0,0 +1,62 | |||
|
1 | /*------------------------------------------------------------------------------ | |
|
2 | -- This file is a part of the Kicad Tools Software | |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
|
4 | -- | |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
|
6 | -- it under the terms of the GNU General Public License as published by | |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
|
8 | -- (at your option) any later version. | |
|
9 | -- | |
|
10 | -- This program is distributed in the hope that it will be useful, | |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
13 | -- GNU General Public License for more details. | |
|
14 | -- | |
|
15 | -- You should have received a copy of the GNU General Public License | |
|
16 | -- along with this program; if not, write to the Free Software | |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
18 | -------------------------------------------------------------------------------*/ | |
|
19 | /*-- Author : Alexis Jeandet | |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
|
21 | ----------------------------------------------------------------------------*/ | |
|
22 | #include "pcbzone.h" | |
|
23 | #include <QPen> | |
|
24 | #include <QPixmapCache> | |
|
25 | ||
|
26 | PCBZone::PCBZone(QIlib::QIcadPcbZone *zoneNode, PCBContext *context) | |
|
27 | :QGraphicsItemGroup(),zoneNode(zoneNode),context(context) | |
|
28 | { | |
|
29 | this->init(); | |
|
30 | } | |
|
31 | ||
|
32 | void PCBZone::init() | |
|
33 | { | |
|
34 | this->setFlags(ItemIsMovable|ItemIsSelectable|ItemIsFocusable); | |
|
35 | QPolygonF poly; | |
|
36 | for(int i=0;i<this->zoneNode->filledPolygon.points.points.count();i++) | |
|
37 | { | |
|
38 | poly.append(this->zoneNode->filledPolygon.points.points.at(i)->pos()); | |
|
39 | } | |
|
40 | QGraphicsPixmapItem* test=new QGraphicsPixmapItem(); | |
|
41 | QPixmap pix; | |
|
42 | QPainter painter; | |
|
43 | QGraphicsPolygonItem* polygonItem = new QGraphicsPolygonItem(); | |
|
44 | QPen pen = polygonItem->pen(); | |
|
45 | pen.setWidthF(0.01); | |
|
46 | ||
|
47 | polygonItem->setPen(pen); | |
|
48 | QBrush brush = polygonItem->brush(); | |
|
49 | brush.setStyle(Qt::SolidPattern); | |
|
50 | brush.setColor(context->layerColor(this->zoneNode->layer.value())); | |
|
51 | polygonItem->setBrush(brush); | |
|
52 | polygonItem->setZValue(-context->layer(this->zoneNode->layer.value())); | |
|
53 | polygonItem->setPolygon(poly); | |
|
54 | polygonItem->setCacheMode(QGraphicsItem::DeviceCoordinateCache); | |
|
55 | // test->setPixmap(polygonItem->); | |
|
56 | //voir doc/qt/... | |
|
57 | // polygonItem->paint(); | |
|
58 | this->addToGroup(polygonItem); | |
|
59 | ||
|
60 | this->setCacheMode(QGraphicsItem::DeviceCoordinateCache); | |
|
61 | setOpacity(0.6); | |
|
62 | } |
@@ -0,0 +1,43 | |||
|
1 | /*------------------------------------------------------------------------------ | |
|
2 | -- This file is a part of the Kicad Tools Software | |
|
3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS | |
|
4 | -- | |
|
5 | -- This program is free software; you can redistribute it and/or modify | |
|
6 | -- it under the terms of the GNU General Public License as published by | |
|
7 | -- the Free Software Foundation; either version 2 of the License, or | |
|
8 | -- (at your option) any later version. | |
|
9 | -- | |
|
10 | -- This program is distributed in the hope that it will be useful, | |
|
11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of | |
|
12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
|
13 | -- GNU General Public License for more details. | |
|
14 | -- | |
|
15 | -- You should have received a copy of the GNU General Public License | |
|
16 | -- along with this program; if not, write to the Free Software | |
|
17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
|
18 | -------------------------------------------------------------------------------*/ | |
|
19 | /*-- Author : Alexis Jeandet | |
|
20 | -- Mail : alexis.jeandet@member.fsf.org | |
|
21 | ----------------------------------------------------------------------------*/ | |
|
22 | #ifndef PCBZONE_H | |
|
23 | #define PCBZONE_H | |
|
24 | #include <QObject> | |
|
25 | #include <QWidget> | |
|
26 | #include <QGraphicsRectItem> | |
|
27 | #include <QGraphicsItemGroup> | |
|
28 | #include <pcbcontext.h> | |
|
29 | #include <qicadpcb.h> | |
|
30 | #include <QPainterPath> | |
|
31 | ||
|
32 | class PCBZone: public QGraphicsItemGroup | |
|
33 | { | |
|
34 | public: | |
|
35 | PCBZone(QIlib::QIcadPcbZone* zoneNode,PCBContext* context); | |
|
36 | private: | |
|
37 | void init(); | |
|
38 | QIlib::QIcadPcbZone* zoneNode; | |
|
39 | int layer; | |
|
40 | PCBContext* context; | |
|
41 | }; | |
|
42 | ||
|
43 | #endif // PCBZONE_H |
@@ -1,167 +1,171 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | const char* add_net_c = "(add_net"; |
|
23 | 23 | const char* angle_c = "(angle"; |
|
24 | 24 | const char* area_c = "(area"; |
|
25 | 25 | const char* arrow1a_c = "(arrow1a"; |
|
26 | 26 | const char* arrow1b_c = "(arrow1b"; |
|
27 | 27 | const char* arrow2a_c = "(arrow2a"; |
|
28 | 28 | const char* arrow2b_c = "(arrow2b"; |
|
29 | 29 | const char* at_c = "(at"; |
|
30 | 30 | const char* attr_c = "(attr"; |
|
31 | 31 | const char* center_c = "(center"; |
|
32 | 32 | const char* clearance_c = "(clearance"; |
|
33 | 33 | const char* code_c = "(code"; |
|
34 | 34 | const char* component_c = "(component"; |
|
35 | 35 | const char* components_c = "(components"; |
|
36 | 36 | const char* crossbar_c = "(crossbar"; |
|
37 | 37 | const char* date_c = "(date"; |
|
38 | 38 | const char* design_c = "(design"; |
|
39 | 39 | const char* dimension_c = "(dimension"; |
|
40 | 40 | const char* drawings_c = "(drawings"; |
|
41 | 41 | const char* drill_c = "(drill"; |
|
42 | 42 | const char* drillshape_c = "(drillshape"; |
|
43 | 43 | const char* edge_width_c = "(edge_width"; |
|
44 | 44 | const char* effects_c = "(effects"; |
|
45 | 45 | const char* end_c = "(end"; |
|
46 | 46 | const char* excludeedgelayer_c = "(excludeedgelayer"; |
|
47 | 47 | const char* export_c = "(export"; |
|
48 | 48 | const char* feature1_c = "(feature1"; |
|
49 | 49 | const char* feature2_c = "(feature2"; |
|
50 | 50 | const char* field_c = "(field"; |
|
51 | 51 | const char* fields_c = "(fields"; |
|
52 | const char* filled_polygon_c = "(filled_polygon"; | |
|
52 | 53 | const char* font_c = "(font"; |
|
53 | 54 | const char* fp_circle_c = "(fp_circle"; |
|
54 | 55 | const char* fp_line_c = "(fp_line"; |
|
55 | 56 | const char* fp_text_c = "(fp_text"; |
|
56 | 57 | const char* general_c = "(general"; |
|
57 | 58 | const char* gr_arc_c = "(gr_arc"; |
|
58 | 59 | const char* gr_circle_c = "(gr_circle"; |
|
59 | 60 | const char* gr_line_c = "(gr_line"; |
|
60 | 61 | const char* gr_text_c = "(gr_text"; |
|
61 | 62 | const char* host_c = "(host"; |
|
62 | 63 | const char* hpglpendiameter_c = "(hpglpendiameter"; |
|
63 | 64 | const char* hpglpennumber_c = "(hpglpennumber"; |
|
64 | 65 | const char* hpglpenoverlay_c = "(hpglpenoverlay"; |
|
65 | 66 | const char* hpglpenspeed_c = "(hpglpenspeed"; |
|
66 | 67 | const char* kicad_pcb_c = "(kicad_pcb"; |
|
67 | 68 | const char* last_trace_width_c = "(last_trace_width"; |
|
68 | 69 | const char* layers_c = "(layers"; |
|
69 | 70 | const char* layer_c = "(layer"; |
|
70 | 71 | const char* layerselection_c = "(layerselection"; |
|
71 | 72 | const char* lib_c = "(lib"; |
|
72 | 73 | const char* libpart_c = "(libpart"; |
|
73 | 74 | const char* libparts_c = "(libparts"; |
|
74 | 75 | const char* libraries_c = "(libraries"; |
|
75 | 76 | const char* library_c = "(library"; |
|
76 | 77 | const char* libsource_c = "(libsource"; |
|
77 | 78 | const char* linewidth_c = "(linewidth"; |
|
78 | 79 | const char* links_c = "(links"; |
|
79 | 80 | const char* logical_c = "(logical"; |
|
80 | 81 | const char* mirror_c = "(mirror"; |
|
81 | 82 | const char* mod_edge_width_c = "(mod_edge_width"; |
|
82 | 83 | const char* mod_text_size_c = "(mod_text_size"; |
|
83 | 84 | const char* mode_c = "(mode"; |
|
84 | 85 | const char* model_c = "(model"; |
|
85 | 86 | const char* module_c = "(module"; |
|
86 | 87 | const char* modules_c = "(modules"; |
|
87 | 88 | const char* name_c = "(name"; |
|
88 | 89 | const char* names_c = "(names"; |
|
89 | 90 | const char* net_c = "(net"; |
|
90 | 91 | const char* net_class_c = "(net_class"; |
|
91 | 92 | const char* nets_c = "(nets"; |
|
92 | 93 | const char* no_connect_c = "(no_connect"; |
|
93 | 94 | const char* node_c = "(node"; |
|
94 | 95 | const char* num_c = "(num"; |
|
95 | 96 | const char* outputdirectory_c = "(outputdirectory"; |
|
96 | 97 | const char* outputformat_c = "(outputformat"; |
|
97 | 98 | const char* pad_c = "(pad"; |
|
98 | 99 | const char* pad_drill_c = "(pad_drill"; |
|
99 | 100 | const char* pad_size_c = "(pad_size"; |
|
100 | 101 | const char* pad_to_mask_clearance_c = "(pad_to_mask_clearance"; |
|
101 | 102 | const char* padsonsilk_c = "(padsonsilk"; |
|
102 | 103 | const char* page_c = "(page"; |
|
103 | 104 | const char* part_c = "(part"; |
|
104 | 105 | const char* path_c = "(path"; |
|
105 | 106 | const char* pcb_text_size_c = "(pcb_text_size"; |
|
106 | 107 | const char* pcb_text_width_c = "(pcb_text_width"; |
|
107 | 108 | const char* pcbplotparams_c = "(pcbplotparams"; |
|
108 | 109 | const char* pin_c = "(pin"; |
|
109 | 110 | const char* pins_c = "(pins"; |
|
110 | 111 | const char* plotframeref_c = "(plotframeref"; |
|
111 | 112 | const char* plotinvisibletext_c = "(plotinvisibletext"; |
|
112 | 113 | const char* plotothertext_c = "(plotothertext"; |
|
113 | 114 | const char* plotreference_c = "(plotreference"; |
|
114 | 115 | const char* plotvalue_c = "(plotvalue"; |
|
116 | const char* polygon_c = "(polygon"; | |
|
115 | 117 | const char* psa4output_c = "(psa4output"; |
|
116 | 118 | const char* psnegative_c = "(psnegative"; |
|
119 | const char* pts_c = "(pts"; | |
|
117 | 120 | const char* ref_c = "(ref"; |
|
118 | 121 | const char* rotate = "(rota"; |
|
119 | 122 | const char* scale_c = "(scale"; |
|
120 | 123 | const char* scaleselection_c = "(scaleselection"; |
|
121 | 124 | const char* segment_c = "(segment"; |
|
122 | 125 | const char* segment_width_c = "(segment_width"; |
|
123 | 126 | const char* setup_c = "(setup"; |
|
124 | 127 | const char* sheetpath_c = "(sheetpath"; |
|
125 | 128 | const char* size_c = "(size"; |
|
126 | 129 | const char* source_c = "(source"; |
|
127 | 130 | const char* start_c = "(start"; |
|
128 | 131 | const char* subtractmaskfromsilk_c = "(subtractmaskfromsilk"; |
|
129 | 132 | const char* tags_c = "(tags"; |
|
130 | 133 | const char* tedit_c = "(tedit"; |
|
131 | 134 | const char* thickness_c = "(thickness"; |
|
132 | 135 | const char* tool_c = "(tool"; |
|
133 | 136 | const char* trace_clearance_c = "(trace_clearance"; |
|
134 | 137 | const char* trace_min_c = "(trace_min"; |
|
135 | 138 | const char* trace_width_c = "(trace_width"; |
|
136 | 139 | const char* tracks_c = "(tracks"; |
|
137 | 140 | const char* tstamp_c = "(tstamp"; |
|
138 | 141 | const char* tstamps_c = "(tstamps"; |
|
139 | 142 | const char* type_c = "(type"; |
|
140 | 143 | const char* uri_c = "(uri"; |
|
141 | 144 | const char* useauxorigin_c = "(useauxorigin"; |
|
142 | 145 | const char* usegerberextensions_c = "(usegerberextensions"; |
|
143 | 146 | const char* uvia_dia_c = "(uvia_dia"; |
|
144 | 147 | const char* uvia_drill_c = "(uvia_drill"; |
|
145 | 148 | const char* uvia_min_drill_c = "(uvia_min_drill"; |
|
146 | 149 | const char* uvia_min_size_c = "(uvia_min_size"; |
|
147 | 150 | const char* uvia_size_c = "(uvia_size"; |
|
148 | 151 | const char* uvias_allowed_c = "(uvias_allowed"; |
|
149 | 152 | const char* value_c = "(value"; |
|
150 | 153 | const char* version_c = "(version"; |
|
151 | 154 | const char* via_c = "(via"; |
|
152 | 155 | const char* via_dia_c = "(via_dia"; |
|
153 | 156 | const char* via_drill_c = "(via_drill"; |
|
154 | 157 | const char* via_min_drill_c = "(via_min_drill"; |
|
155 | 158 | const char* via_min_size_c = "(via_min_size"; |
|
156 | 159 | const char* via_size_c = "(via_size"; |
|
157 | 160 | const char* viasonmask_c = "(viasonmask"; |
|
158 | 161 | const char* visible_elements_c = "(visible_elements"; |
|
159 | 162 | const char* width_c = "(width"; |
|
160 | 163 | const char* xyz = "(x"; |
|
164 | const char* xy_c = "(xy"; | |
|
161 | 165 | const char* zone_45_only_c = "(zone_45_only"; |
|
162 | 166 | const char* zone_clearance_c = "(zone_clearance"; |
|
163 | 167 | const char* zone_c = "(zone"; |
|
164 | 168 | const char* zones_c = "(zones"; |
|
165 | 169 | |
|
166 | 170 | |
|
167 | 171 |
@@ -1,178 +1,182 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | /* |
|
23 | 23 | * Have a look to LispLikeLexique.ods |
|
24 | 24 | */ |
|
25 | 25 | #ifndef LEXIQUE_H |
|
26 | 26 | #define LEXIQUE_H |
|
27 | 27 | |
|
28 | 28 | namespace QIlib{ |
|
29 | 29 | |
|
30 | 30 | namespace Lexique |
|
31 | 31 | { |
|
32 | 32 | extern "C" const char* add_net_c; |
|
33 | 33 | extern "C" const char* angle_c; |
|
34 | 34 | extern "C" const char* area_c; |
|
35 | 35 | extern "C" const char* arrow1a_c; |
|
36 | 36 | extern "C" const char* arrow1b_c; |
|
37 | 37 | extern "C" const char* arrow2a_c; |
|
38 | 38 | extern "C" const char* arrow2b_c; |
|
39 | 39 | extern "C" const char* at_c; |
|
40 | 40 | extern "C" const char* attr_c; |
|
41 | 41 | extern "C" const char* center_c; |
|
42 | 42 | extern "C" const char* clearance_c; |
|
43 | 43 | extern "C" const char* code_c; |
|
44 | 44 | extern "C" const char* component_c; |
|
45 | 45 | extern "C" const char* components_c; |
|
46 | 46 | extern "C" const char* crossbar_c; |
|
47 | 47 | extern "C" const char* date_c; |
|
48 | 48 | extern "C" const char* design_c; |
|
49 | 49 | extern "C" const char* dimension_c; |
|
50 | 50 | extern "C" const char* drawings_c; |
|
51 | 51 | extern "C" const char* drill_c; |
|
52 | 52 | extern "C" const char* drillshape_c; |
|
53 | 53 | extern "C" const char* edge_width_c; |
|
54 | 54 | extern "C" const char* effects_c; |
|
55 | 55 | extern "C" const char* end_c; |
|
56 | 56 | extern "C" const char* excludeedgelayer_c; |
|
57 | 57 | extern "C" const char* export_c; |
|
58 | 58 | extern "C" const char* feature1_c; |
|
59 | 59 | extern "C" const char* feature2_c; |
|
60 | 60 | extern "C" const char* field_c; |
|
61 | 61 | extern "C" const char* fields_c; |
|
62 | extern "C" const char* filled_polygon_c; | |
|
62 | 63 | extern "C" const char* font_c; |
|
63 | 64 | extern "C" const char* fp_circle_c; |
|
64 | 65 | extern "C" const char* fp_line_c; |
|
65 | 66 | extern "C" const char* fp_text_c; |
|
66 | 67 | extern "C" const char* general_c; |
|
67 | 68 | extern "C" const char* gr_arc_c; |
|
68 | 69 | extern "C" const char* gr_circle_c; |
|
69 | 70 | extern "C" const char* gr_line_c; |
|
70 | 71 | extern "C" const char* gr_text_c; |
|
71 | 72 | extern "C" const char* host_c; |
|
72 | 73 | extern "C" const char* hpglpendiameter_c; |
|
73 | 74 | extern "C" const char* hpglpennumber_c; |
|
74 | 75 | extern "C" const char* hpglpenoverlay_c; |
|
75 | 76 | extern "C" const char* hpglpenspeed_c; |
|
76 | 77 | extern "C" const char* kicad_pcb_c; |
|
77 | 78 | extern "C" const char* last_trace_width_c; |
|
78 | 79 | extern "C" const char* layers_c; |
|
79 | 80 | extern "C" const char* layer_c; |
|
80 | 81 | extern "C" const char* layerselection_c; |
|
81 | 82 | extern "C" const char* lib_c; |
|
82 | 83 | extern "C" const char* libpart_c; |
|
83 | 84 | extern "C" const char* libparts_c; |
|
84 | 85 | extern "C" const char* libraries_c; |
|
85 | 86 | extern "C" const char* library_c; |
|
86 | 87 | extern "C" const char* libsource_c; |
|
87 | 88 | extern "C" const char* linewidth_c; |
|
88 | 89 | extern "C" const char* links_c; |
|
89 | 90 | extern "C" const char* logical_c; |
|
90 | 91 | extern "C" const char* mirror_c; |
|
91 | 92 | extern "C" const char* mod_edge_width_c; |
|
92 | 93 | extern "C" const char* mod_text_size_c; |
|
93 | 94 | extern "C" const char* mode_c; |
|
94 | 95 | extern "C" const char* model_c; |
|
95 | 96 | extern "C" const char* module_c; |
|
96 | 97 | extern "C" const char* modules_c; |
|
97 | 98 | extern "C" const char* name_c; |
|
98 | 99 | extern "C" const char* names_c; |
|
99 | 100 | extern "C" const char* net_c; |
|
100 | 101 | extern "C" const char* net_class_c; |
|
101 | 102 | extern "C" const char* nets_c; |
|
102 | 103 | extern "C" const char* no_connect_c; |
|
103 | 104 | extern "C" const char* node_c; |
|
104 | 105 | extern "C" const char* num_c; |
|
105 | 106 | extern "C" const char* outputdirectory_c; |
|
106 | 107 | extern "C" const char* outputformat_c; |
|
107 | 108 | extern "C" const char* pad_c; |
|
108 | 109 | extern "C" const char* pad_drill_c; |
|
109 | 110 | extern "C" const char* pad_size_c; |
|
110 | 111 | extern "C" const char* pad_to_mask_clearance_c; |
|
111 | 112 | extern "C" const char* padsonsilk_c; |
|
112 | 113 | extern "C" const char* page_c; |
|
113 | 114 | extern "C" const char* part_c; |
|
114 | 115 | extern "C" const char* path_c; |
|
115 | 116 | extern "C" const char* pcb_text_size_c; |
|
116 | 117 | extern "C" const char* pcb_text_width_c; |
|
117 | 118 | extern "C" const char* pcbplotparams_c; |
|
118 | 119 | extern "C" const char* pin_c; |
|
119 | 120 | extern "C" const char* pins_c; |
|
120 | 121 | extern "C" const char* plotframeref_c; |
|
121 | 122 | extern "C" const char* plotinvisibletext_c; |
|
122 | 123 | extern "C" const char* plotothertext_c; |
|
123 | 124 | extern "C" const char* plotreference_c; |
|
124 | 125 | extern "C" const char* plotvalue_c; |
|
126 | extern "C" const char* polygon_c; | |
|
125 | 127 | extern "C" const char* psa4output_c; |
|
126 | 128 | extern "C" const char* psnegative_c; |
|
129 | extern "C" const char* pts_c; | |
|
127 | 130 | extern "C" const char* ref_c; |
|
128 | 131 | extern "C" const char* rotate; |
|
129 | 132 | extern "C" const char* scale_c; |
|
130 | 133 | extern "C" const char* scaleselection_c; |
|
131 | 134 | extern "C" const char* segment_c; |
|
132 | 135 | extern "C" const char* segment_width_c; |
|
133 | 136 | extern "C" const char* setup_c; |
|
134 | 137 | extern "C" const char* sheetpath_c; |
|
135 | 138 | extern "C" const char* size_c; |
|
136 | 139 | extern "C" const char* source_c; |
|
137 | 140 | extern "C" const char* start_c; |
|
138 | 141 | extern "C" const char* subtractmaskfromsilk_c; |
|
139 | 142 | extern "C" const char* tags_c; |
|
140 | 143 | extern "C" const char* tedit_c; |
|
141 | 144 | extern "C" const char* thickness_c; |
|
142 | 145 | extern "C" const char* tool_c; |
|
143 | 146 | extern "C" const char* trace_clearance_c; |
|
144 | 147 | extern "C" const char* trace_min_c; |
|
145 | 148 | extern "C" const char* trace_width_c; |
|
146 | 149 | extern "C" const char* tracks_c; |
|
147 | 150 | extern "C" const char* tstamp_c; |
|
148 | 151 | extern "C" const char* tstamps_c; |
|
149 | 152 | extern "C" const char* type_c; |
|
150 | 153 | extern "C" const char* uri_c; |
|
151 | 154 | extern "C" const char* useauxorigin_c; |
|
152 | 155 | extern "C" const char* usegerberextensions_c; |
|
153 | 156 | extern "C" const char* uvia_dia_c; |
|
154 | 157 | extern "C" const char* uvia_drill_c; |
|
155 | 158 | extern "C" const char* uvia_min_drill_c; |
|
156 | 159 | extern "C" const char* uvia_min_size_c; |
|
157 | 160 | extern "C" const char* uvia_size_c; |
|
158 | 161 | extern "C" const char* uvias_allowed_c; |
|
159 | 162 | extern "C" const char* value_c; |
|
160 | 163 | extern "C" const char* version_c; |
|
161 | 164 | extern "C" const char* via_c; |
|
162 | 165 | extern "C" const char* via_dia_c; |
|
163 | 166 | extern "C" const char* via_drill_c; |
|
164 | 167 | extern "C" const char* via_min_drill_c; |
|
165 | 168 | extern "C" const char* via_min_size_c; |
|
166 | 169 | extern "C" const char* via_size_c; |
|
167 | 170 | extern "C" const char* viasonmask_c; |
|
168 | 171 | extern "C" const char* visible_elements_c; |
|
169 | 172 | extern "C" const char* width_c; |
|
170 | 173 | extern "C" const char* xyz; |
|
174 | extern "C" const char* xy_c; | |
|
171 | 175 | extern "C" const char* zone_45_only_c; |
|
172 | 176 | extern "C" const char* zone_clearance_c; |
|
173 | 177 | extern "C" const char* zone_c; |
|
174 | 178 | extern "C" const char* zones_c; |
|
175 | 179 | } |
|
176 | 180 | } |
|
177 | 181 | |
|
178 | 182 | #endif // LEXIQUE_H |
@@ -1,1195 +1,1308 | |||
|
1 | 1 | #include "qicadpcb.h" |
|
2 | 2 | |
|
3 | 3 | |
|
4 | 4 | QIlib::QIcadPcb::QIcadPcb() |
|
5 | 5 | :pcbRoot(NULL) |
|
6 | 6 | { |
|
7 | 7 | |
|
8 | 8 | } |
|
9 | 9 | |
|
10 | 10 | bool QIlib::QIcadPcb::parsePcb(const QString &pcb) |
|
11 | 11 | { |
|
12 | 12 | parse(pcb.toStdString().c_str()); |
|
13 | 13 | updateConcreteTree(); |
|
14 | 14 | return false; |
|
15 | 15 | } |
|
16 | 16 | |
|
17 | 17 | QString QIlib::QIcadPcb::toString() |
|
18 | 18 | { |
|
19 | 19 | |
|
20 | 20 | } |
|
21 | 21 | |
|
22 | 22 | QString QIlib::QIcadPcb::print() |
|
23 | 23 | { |
|
24 | 24 | return rootNode.print(); |
|
25 | 25 | } |
|
26 | 26 | |
|
27 | 27 | |
|
28 | 28 | void QIlib::QIcadPcb::updateConcreteTree() |
|
29 | 29 | { |
|
30 | 30 | if(this->rootNode.nodes.count()) |
|
31 | 31 | { |
|
32 | 32 | if(this->rootNode.nodes.at(0)->name==QIlib::Lexique::kicad_pcb_c) |
|
33 | 33 | { |
|
34 | 34 | if(this->pcbRoot==NULL) |
|
35 | 35 | { |
|
36 | 36 | this->pcbRoot = new QIcadPcbRoot(this->rootNode.nodes.at(0)); |
|
37 | 37 | } |
|
38 | 38 | } |
|
39 | 39 | } |
|
40 | 40 | } |
|
41 | 41 | |
|
42 | 42 | |
|
43 | 43 | QIlib::QIcadPcbRoot::QIcadPcbRoot(QIlib::AbstractNode *node) |
|
44 | 44 | :QIcadAbstractNodeWrapper(node) |
|
45 | 45 | { |
|
46 | 46 | this->setNode(node); |
|
47 | 47 | } |
|
48 | 48 | |
|
49 | 49 | void QIlib::QIcadPcbRoot::setNode(QIlib::AbstractNode *node) |
|
50 | 50 | { |
|
51 | 51 | this->clrNets(); |
|
52 | 52 | this->clrModules(); |
|
53 | 53 | this->clrDimensions(); |
|
54 | 54 | this->clrLines(); |
|
55 | 55 | this->clrSegments(); |
|
56 | 56 | this->clrVias(); |
|
57 | 57 | this->clrArcs(); |
|
58 | 58 | this->clrCircles(); |
|
59 | 59 | this->clrTexts(); |
|
60 | 60 | this->clrZones(); |
|
61 | 61 | if(node->name==QIlib::Lexique::kicad_pcb_c) |
|
62 | 62 | { |
|
63 | 63 | this->p_node = node; |
|
64 | 64 | for(int i=0;i<node->nodes.count();i++) |
|
65 | 65 | { |
|
66 | 66 | if(node->nodes.at(i)->name==QIlib::Lexique::version_c) |
|
67 | 67 | { |
|
68 | 68 | this->version.setNode(node->nodes.at(i)); |
|
69 | 69 | } |
|
70 | 70 | if(node->nodes.at(i)->name==QIlib::Lexique::host_c) |
|
71 | 71 | { |
|
72 | 72 | this->host.setNode(node->nodes.at(i)); |
|
73 | 73 | } |
|
74 | 74 | if(node->nodes.at(i)->name==QIlib::Lexique::page_c) |
|
75 | 75 | { |
|
76 | 76 | this->page.setNode(node->nodes.at(i)); |
|
77 | 77 | } |
|
78 | 78 | if(node->nodes.at(i)->name==QIlib::Lexique::general_c) |
|
79 | 79 | { |
|
80 | 80 | this->general.setNode(node->nodes.at(i)); |
|
81 | 81 | } |
|
82 | 82 | if(node->nodes.at(i)->name==QIlib::Lexique::layers_c) |
|
83 | 83 | { |
|
84 | 84 | this->layers.setNode(node->nodes.at(i)); |
|
85 | 85 | } |
|
86 | 86 | if(node->nodes.at(i)->name==QIlib::Lexique::setup_c) |
|
87 | 87 | { |
|
88 | 88 | this->setup.setNode(node->nodes.at(i)); |
|
89 | 89 | } |
|
90 | 90 | if(node->nodes.at(i)->name==QIlib::Lexique::net_c) |
|
91 | 91 | { |
|
92 | 92 | this->apendNet(node->nodes.at(i)); |
|
93 | 93 | } |
|
94 | 94 | if(node->nodes.at(i)->name==QIlib::Lexique::module_c) |
|
95 | 95 | { |
|
96 | 96 | this->apendModule(node->nodes.at(i)); |
|
97 | 97 | } |
|
98 | 98 | if(node->nodes.at(i)->name==QIlib::Lexique::gr_line_c) |
|
99 | 99 | { |
|
100 | 100 | this->apendLine(node->nodes.at(i)); |
|
101 | 101 | } |
|
102 | 102 | if(node->nodes.at(i)->name==QIlib::Lexique::dimension_c) |
|
103 | 103 | { |
|
104 | 104 | this->apendDimension(node->nodes.at(i)); |
|
105 | 105 | } |
|
106 | 106 | if(node->nodes.at(i)->name==QIlib::Lexique::via_c) |
|
107 | 107 | { |
|
108 | 108 | this->apendVia(node->nodes.at(i)); |
|
109 | 109 | } |
|
110 | 110 | if(node->nodes.at(i)->name==QIlib::Lexique::segment_c) |
|
111 | 111 | { |
|
112 | 112 | this->apendSegment(node->nodes.at(i)); |
|
113 | 113 | } |
|
114 | 114 | if(node->nodes.at(i)->name==QIlib::Lexique::gr_text_c) |
|
115 | 115 | { |
|
116 | 116 | this->apendText(node->nodes.at(i)); |
|
117 | 117 | } |
|
118 | 118 | if(node->nodes.at(i)->name==QIlib::Lexique::gr_arc_c) |
|
119 | 119 | { |
|
120 | 120 | this->apendArc(node->nodes.at(i)); |
|
121 | 121 | } |
|
122 | 122 | if(node->nodes.at(i)->name==QIlib::Lexique::gr_circle_c) |
|
123 | 123 | { |
|
124 | 124 | this->apendCircle(node->nodes.at(i)); |
|
125 | 125 | } |
|
126 | 126 | if(node->nodes.at(i)->name==QIlib::Lexique::zone_c) |
|
127 | 127 | { |
|
128 | 128 | this->apendZone(node->nodes.at(i)); |
|
129 | 129 | } |
|
130 | 130 | } |
|
131 | 131 | } |
|
132 | 132 | } |
|
133 | 133 | |
|
134 | 134 | void QIlib::QIcadPcbRoot::clrNets() |
|
135 | 135 | { |
|
136 | 136 | while(nets.count()) |
|
137 | 137 | { |
|
138 | 138 | QIcadAbstractNodeWrapper* net; |
|
139 | 139 | net = nets.last(); |
|
140 | 140 | nets.removeLast(); |
|
141 | 141 | delete net; |
|
142 | 142 | } |
|
143 | 143 | } |
|
144 | 144 | |
|
145 | 145 | void QIlib::QIcadPcbRoot::apendNet(QIlib::AbstractNode *node) |
|
146 | 146 | { |
|
147 | 147 | if(node->name==QIlib::Lexique::net_c) |
|
148 | 148 | { |
|
149 | 149 | this->nets.append(new QIcadAbstractNodeWrapper(node)); |
|
150 | 150 | } |
|
151 | 151 | } |
|
152 | 152 | |
|
153 | 153 | void QIlib::QIcadPcbRoot::clrModules() |
|
154 | 154 | { |
|
155 | 155 | while(modules.count()) |
|
156 | 156 | { |
|
157 | 157 | QIcadPcbModule* module; |
|
158 | 158 | module = modules.last(); |
|
159 | 159 | modules.removeLast(); |
|
160 | 160 | delete module; |
|
161 | 161 | } |
|
162 | 162 | } |
|
163 | 163 | |
|
164 | 164 | void QIlib::QIcadPcbRoot::apendModule(QIlib::AbstractNode *node) |
|
165 | 165 | { |
|
166 | 166 | if(node->name==QIlib::Lexique::module_c) |
|
167 | 167 | { |
|
168 | 168 | this->modules.append(new QIcadPcbModule(node)); |
|
169 | 169 | } |
|
170 | 170 | } |
|
171 | 171 | |
|
172 | 172 | void QIlib::QIcadPcbRoot::clrDimensions() |
|
173 | 173 | { |
|
174 | 174 | while(dimensions.count()) |
|
175 | 175 | { |
|
176 | 176 | QIcadPcbDimension* dimension; |
|
177 | 177 | dimension = dimensions.last(); |
|
178 | 178 | dimensions.removeLast(); |
|
179 | 179 | delete dimension; |
|
180 | 180 | } |
|
181 | 181 | } |
|
182 | 182 | |
|
183 | 183 | void QIlib::QIcadPcbRoot::apendDimension(QIlib::AbstractNode *node) |
|
184 | 184 | { |
|
185 | 185 | if(node->name==QIlib::Lexique::dimension_c) |
|
186 | 186 | { |
|
187 | 187 | this->dimensions.append(new QIcadPcbDimension(node)); |
|
188 | 188 | } |
|
189 | 189 | } |
|
190 | 190 | |
|
191 | 191 | void QIlib::QIcadPcbRoot::apendLine(QIlib::AbstractNode *node) |
|
192 | 192 | { |
|
193 | 193 | if(node->name==QIlib::Lexique::gr_line_c) |
|
194 | 194 | { |
|
195 | 195 | this->lines.append(new QIcadPcbLine(node)); |
|
196 | 196 | } |
|
197 | 197 | } |
|
198 | 198 | |
|
199 | 199 | void QIlib::QIcadPcbRoot::clrLines() |
|
200 | 200 | { |
|
201 | 201 | while(lines.count()) |
|
202 | 202 | { |
|
203 | 203 | QIcadPcbLine* line; |
|
204 | 204 | line = lines.last(); |
|
205 | 205 | lines.removeLast(); |
|
206 | 206 | delete line; |
|
207 | 207 | } |
|
208 | 208 | } |
|
209 | 209 | |
|
210 | 210 | void QIlib::QIcadPcbRoot::clrSegments() |
|
211 | 211 | { |
|
212 | 212 | while(segments.count()) |
|
213 | 213 | { |
|
214 | 214 | QIcadPcbSegment* segment; |
|
215 | 215 | segment = segments.last(); |
|
216 | 216 | segments.removeLast(); |
|
217 | 217 | delete segment; |
|
218 | 218 | } |
|
219 | 219 | } |
|
220 | 220 | |
|
221 | 221 | void QIlib::QIcadPcbRoot::apendSegment(QIlib::AbstractNode *node) |
|
222 | 222 | { |
|
223 | 223 | if(node->name==QIlib::Lexique::segment_c) |
|
224 | 224 | { |
|
225 | 225 | this->segments.append(new QIcadPcbSegment(node)); |
|
226 | 226 | } |
|
227 | 227 | } |
|
228 | 228 | |
|
229 | 229 | void QIlib::QIcadPcbRoot::clrVias() |
|
230 | 230 | { |
|
231 | 231 | while(vias.count()) |
|
232 | 232 | { |
|
233 | 233 | QIcadPcbVia* via; |
|
234 | 234 | via = vias.last(); |
|
235 | 235 | vias.removeLast(); |
|
236 | 236 | delete via; |
|
237 | 237 | } |
|
238 | 238 | } |
|
239 | 239 | |
|
240 | 240 | void QIlib::QIcadPcbRoot::apendVia(QIlib::AbstractNode *node) |
|
241 | 241 | { |
|
242 | 242 | if(node->name==QIlib::Lexique::via_c) |
|
243 | 243 | { |
|
244 | 244 | this->vias.append(new QIcadPcbVia(node,this->setup.defaultViaDrillSize())); |
|
245 | 245 | } |
|
246 | 246 | } |
|
247 | 247 | |
|
248 | 248 | void QIlib::QIcadPcbRoot::clrArcs() |
|
249 | 249 | { |
|
250 | 250 | while(arcs.count()) |
|
251 | 251 | { |
|
252 | 252 | QIcadPcbArc* arc; |
|
253 | 253 | arc = arcs.last(); |
|
254 | 254 | arcs.removeLast(); |
|
255 | 255 | delete arc; |
|
256 | 256 | } |
|
257 | 257 | } |
|
258 | 258 | |
|
259 | 259 | void QIlib::QIcadPcbRoot::apendArc(QIlib::AbstractNode *node) |
|
260 | 260 | { |
|
261 | 261 | if(node->name==QIlib::Lexique::gr_arc_c) |
|
262 | 262 | { |
|
263 | 263 | this->arcs.append(new QIcadPcbArc(node)); |
|
264 | 264 | } |
|
265 | 265 | } |
|
266 | 266 | |
|
267 | 267 | void QIlib::QIcadPcbRoot::clrCircles() |
|
268 | 268 | { |
|
269 | 269 | while(circles.count()) |
|
270 | 270 | { |
|
271 | 271 | QIcadPcbCircle* circle; |
|
272 | 272 | circle = circles.last(); |
|
273 | 273 | circles.removeLast(); |
|
274 | 274 | delete circle; |
|
275 | 275 | } |
|
276 | 276 | } |
|
277 | 277 | |
|
278 | 278 | void QIlib::QIcadPcbRoot::apendCircle(QIlib::AbstractNode *node) |
|
279 | 279 | { |
|
280 | 280 | if(node->name==QIlib::Lexique::gr_circle_c) |
|
281 | 281 | { |
|
282 | 282 | this->circles.append(new QIcadPcbCircle(node)); |
|
283 | 283 | } |
|
284 | 284 | } |
|
285 | 285 | |
|
286 | 286 | void QIlib::QIcadPcbRoot::clrTexts() |
|
287 | 287 | { |
|
288 | 288 | while(texts.count()) |
|
289 | 289 | { |
|
290 | 290 | QIcadPcbText* text; |
|
291 | 291 | text = texts.last(); |
|
292 | 292 | texts.removeLast(); |
|
293 | 293 | delete text; |
|
294 | 294 | } |
|
295 | 295 | } |
|
296 | 296 | |
|
297 | 297 | void QIlib::QIcadPcbRoot::apendText(QIlib::AbstractNode *node) |
|
298 | 298 | { |
|
299 | 299 | if(node->name==QIlib::Lexique::gr_text_c) |
|
300 | 300 | { |
|
301 | 301 | this->texts.append(new QIcadPcbText(node)); |
|
302 | 302 | } |
|
303 | 303 | } |
|
304 | 304 | |
|
305 | 305 | void QIlib::QIcadPcbRoot::clrZones() |
|
306 | 306 | { |
|
307 | 307 | while(zones.count()) |
|
308 | 308 | { |
|
309 | 309 | QIcadPcbZone* zone; |
|
310 | 310 | zone = zones.last(); |
|
311 | 311 | zones.removeLast(); |
|
312 | 312 | delete zone; |
|
313 | 313 | } |
|
314 | 314 | } |
|
315 | 315 | |
|
316 | 316 | void QIlib::QIcadPcbRoot::apendZone(QIlib::AbstractNode *node) |
|
317 | 317 | { |
|
318 | 318 | if(node->name==QIlib::Lexique::zone_c) |
|
319 | 319 | { |
|
320 | 320 | this->zones.append(new QIcadPcbZone(node)); |
|
321 | 321 | } |
|
322 | 322 | } |
|
323 | 323 | |
|
324 | 324 | QIlib::QIcadPcbGeneralInfo::QIcadPcbGeneralInfo(QIlib::AbstractNode *node) |
|
325 | 325 | :QIcadAbstractNodeWrapper(node) |
|
326 | 326 | { |
|
327 | 327 | this->setNode(node); |
|
328 | 328 | } |
|
329 | 329 | |
|
330 | 330 | void QIlib::QIcadPcbGeneralInfo::setNode(QIlib::AbstractNode *node) |
|
331 | 331 | { |
|
332 | 332 | if(node->name==QIlib::Lexique::general_c) |
|
333 | 333 | { |
|
334 | 334 | this->p_node = node; |
|
335 | 335 | for(int i=0;i<node->nodes.count();i++) |
|
336 | 336 | { |
|
337 | 337 | if(node->nodes.at(i)->name==QIlib::Lexique::links_c) |
|
338 | 338 | { |
|
339 | 339 | this->links.setNode(node->nodes.at(i)); |
|
340 | 340 | } |
|
341 | 341 | if(node->nodes.at(i)->name==QIlib::Lexique::no_connect_c) |
|
342 | 342 | { |
|
343 | 343 | this->no_connections.setNode(node->nodes.at(i)); |
|
344 | 344 | } |
|
345 | 345 | if(node->nodes.at(i)->name==QIlib::Lexique::area_c) |
|
346 | 346 | { |
|
347 | 347 | this->area.setNode(node->nodes.at(i)); |
|
348 | 348 | } |
|
349 | 349 | if(node->nodes.at(i)->name==QIlib::Lexique::thickness_c) |
|
350 | 350 | { |
|
351 | 351 | this->thickness.setNode(node->nodes.at(i)); |
|
352 | 352 | } |
|
353 | 353 | if(node->nodes.at(i)->name==QIlib::Lexique::drawings_c) |
|
354 | 354 | { |
|
355 | 355 | this->drawings.setNode(node->nodes.at(i)); |
|
356 | 356 | } |
|
357 | 357 | if(node->nodes.at(i)->name==QIlib::Lexique::tracks_c) |
|
358 | 358 | { |
|
359 | 359 | this->tracks.setNode(node->nodes.at(i)); |
|
360 | 360 | } |
|
361 | 361 | if(node->nodes.at(i)->name==QIlib::Lexique::zones_c) |
|
362 | 362 | { |
|
363 | 363 | this->zones.setNode(node->nodes.at(i)); |
|
364 | 364 | } |
|
365 | 365 | if(node->nodes.at(i)->name==QIlib::Lexique::modules_c) |
|
366 | 366 | { |
|
367 | 367 | this->modules.setNode(node->nodes.at(i)); |
|
368 | 368 | } |
|
369 | 369 | if(node->nodes.at(i)->name==QIlib::Lexique::nets_c) |
|
370 | 370 | { |
|
371 | 371 | this->nets.setNode(node->nodes.at(i)); |
|
372 | 372 | } |
|
373 | 373 | } |
|
374 | 374 | } |
|
375 | 375 | } |
|
376 | 376 | |
|
377 | 377 | |
|
378 | 378 | QIlib::QIcadPcbLayers::QIcadPcbLayers(QIlib::AbstractNode *node) |
|
379 | 379 | :QIcadAbstractNodeWrapper(node) |
|
380 | 380 | { |
|
381 | 381 | this->setNode(node); |
|
382 | 382 | } |
|
383 | 383 | |
|
384 | 384 | void QIlib::QIcadPcbLayers::setNode(QIlib::AbstractNode *node) |
|
385 | 385 | { |
|
386 | 386 | this->p_node = node; |
|
387 | 387 | if(node->name==QIlib::Lexique::layers_c) |
|
388 | 388 | { |
|
389 | 389 | this->clrLayers(); |
|
390 | 390 | for(int i=0;i<node->nodes.count();i++) |
|
391 | 391 | { |
|
392 | 392 | this->apendLayer(node->nodes.at(i)); |
|
393 | 393 | } |
|
394 | 394 | } |
|
395 | 395 | } |
|
396 | 396 | |
|
397 | 397 | void QIlib::QIcadPcbLayers::clrLayers() |
|
398 | 398 | { |
|
399 | 399 | while(layers.count()) |
|
400 | 400 | { |
|
401 | 401 | QIcadPcbLayer* layer; |
|
402 | 402 | layer = layers.last(); |
|
403 | 403 | layers.removeLast(); |
|
404 | 404 | delete layer; |
|
405 | 405 | } |
|
406 | 406 | } |
|
407 | 407 | |
|
408 | 408 | void QIlib::QIcadPcbLayers::apendLayer(QIlib::AbstractNode *node) |
|
409 | 409 | { |
|
410 | 410 | this->layers.append(new QIcadPcbLayer(node)); |
|
411 | 411 | } |
|
412 | 412 | |
|
413 | 413 | |
|
414 | 414 | QIlib::QIcadPcbLine::QIcadPcbLine(QIlib::AbstractNode *node) |
|
415 | 415 | :QIcadAbstractPcbLine(node) |
|
416 | 416 | { |
|
417 | 417 | this->setNode(node); |
|
418 | 418 | } |
|
419 | 419 | |
|
420 | 420 | |
|
421 | 421 | void QIlib::QIcadPcbLine::setNode(QIlib::AbstractNode *node) |
|
422 | 422 | { |
|
423 | 423 | if(node->name==QIlib::Lexique::gr_line_c) |
|
424 | 424 | { |
|
425 | 425 | this->p_node = node; |
|
426 | 426 | for(int i=0;i<node->nodes.count();i++) |
|
427 | 427 | { |
|
428 | 428 | if(node->nodes.at(i)->name==QIlib::Lexique::start_c) |
|
429 | 429 | { |
|
430 | 430 | this->p_startpos = nodeTo2DCoords(node->nodes.at(i)); |
|
431 | 431 | this->start.setNode(node->nodes.at(i)); |
|
432 | 432 | } |
|
433 | 433 | if(node->nodes.at(i)->name==QIlib::Lexique::end_c) |
|
434 | 434 | { |
|
435 | 435 | this->p_stoppos = nodeTo2DCoords(node->nodes.at(i)); |
|
436 | 436 | this->end.setNode(node->nodes.at(i)); |
|
437 | 437 | } |
|
438 | 438 | if(node->nodes.at(i)->name==QIlib::Lexique::angle_c) |
|
439 | 439 | { |
|
440 | 440 | this->angle.setNode(node->nodes.at(i)); |
|
441 | 441 | } |
|
442 | 442 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
443 | 443 | { |
|
444 | 444 | this->p_layers = node->nodes.at(i)->Values; |
|
445 | 445 | this->layer.setNode(node->nodes.at(i)); |
|
446 | 446 | } |
|
447 | 447 | if(node->nodes.at(i)->name==QIlib::Lexique::width_c) |
|
448 | 448 | { |
|
449 | 449 | this->p_width = nodeValueToDouble(node->nodes.at(i)); |
|
450 | 450 | this->width.setNode(node->nodes.at(i)); |
|
451 | 451 | } |
|
452 | 452 | } |
|
453 | 453 | } |
|
454 | 454 | } |
|
455 | 455 | |
|
456 | 456 | |
|
457 | 457 | QIlib::QIcadPcbModule::QIcadPcbModule(QIlib::AbstractNode *node) |
|
458 | 458 | :QIcadAbstractNodeWrapper(node),p_angle(0.0) |
|
459 | 459 | { |
|
460 | 460 | this->setNode(node); |
|
461 | 461 | } |
|
462 | 462 | |
|
463 | 463 | const QPointF &QIlib::QIcadPcbModule::pos() |
|
464 | 464 | { |
|
465 | 465 | return p_pos; |
|
466 | 466 | } |
|
467 | 467 | |
|
468 | 468 | double QIlib::QIcadPcbModule::angle() |
|
469 | 469 | { |
|
470 | 470 | return - p_angle; |
|
471 | 471 | } |
|
472 | 472 | |
|
473 | 473 | void QIlib::QIcadPcbModule::setNode(QIlib::AbstractNode *node) |
|
474 | 474 | { |
|
475 | 475 | this->clrPads(); |
|
476 | 476 | if(node->name==QIlib::Lexique::module_c) |
|
477 | 477 | { |
|
478 | 478 | this->p_node = node; |
|
479 | 479 | for(int i=0;i<node->nodes.count();i++) |
|
480 | 480 | { |
|
481 | 481 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
482 | 482 | { |
|
483 | 483 | this->layer.setNode(node->nodes.at(i)); |
|
484 | 484 | } |
|
485 | 485 | if(node->nodes.at(i)->name==QIlib::Lexique::tedit_c) |
|
486 | 486 | { |
|
487 | 487 | this->tedit.setNode(node->nodes.at(i)); |
|
488 | 488 | } |
|
489 | 489 | if(node->nodes.at(i)->name==QIlib::Lexique::tstamp_c) |
|
490 | 490 | { |
|
491 | 491 | this->tstamp.setNode(node->nodes.at(i)); |
|
492 | 492 | } |
|
493 | 493 | if(node->nodes.at(i)->name==QIlib::Lexique::at_c) |
|
494 | 494 | { |
|
495 | 495 | this->at.setNode(node->nodes.at(i)); |
|
496 | 496 | QStringList coords=node->nodes.at(i)->Values; |
|
497 | 497 | p_pos = nodeTo2DCoords(node->nodes.at(i)); |
|
498 | 498 | if(coords.count()==3) |
|
499 | 499 | { |
|
500 | 500 | p_angle = coords.at(2).toDouble(); |
|
501 | 501 | this->updatePadsAngle(); |
|
502 | 502 | } |
|
503 | 503 | } |
|
504 | 504 | if(node->nodes.at(i)->name==QIlib::Lexique::tags_c) |
|
505 | 505 | { |
|
506 | 506 | this->tags.setNode(node->nodes.at(i)); |
|
507 | 507 | } |
|
508 | 508 | if(node->nodes.at(i)->name==QIlib::Lexique::path_c) |
|
509 | 509 | { |
|
510 | 510 | this->path.setNode(node->nodes.at(i)); |
|
511 | 511 | } |
|
512 | 512 | if(node->nodes.at(i)->name==QIlib::Lexique::attr_c) |
|
513 | 513 | { |
|
514 | 514 | this->attr.setNode(node->nodes.at(i)); |
|
515 | 515 | } |
|
516 | 516 | if(node->nodes.at(i)->name==QIlib::Lexique::pad_c) |
|
517 | 517 | { |
|
518 | 518 | this->apendPad(node->nodes.at(i)); |
|
519 | 519 | } |
|
520 | 520 | if(node->nodes.at(i)->name==QIlib::Lexique::fp_line_c) |
|
521 | 521 | { |
|
522 | 522 | this->apendLine(node->nodes.at(i)); |
|
523 | 523 | } |
|
524 | 524 | if(node->nodes.at(i)->name==QIlib::Lexique::fp_text_c) |
|
525 | 525 | { |
|
526 | 526 | this->apendText(node->nodes.at(i)); |
|
527 | 527 | } |
|
528 | 528 | if(node->nodes.at(i)->name==QIlib::Lexique::fp_circle_c) |
|
529 | 529 | { |
|
530 | 530 | this->apendCircle(node->nodes.at(i)); |
|
531 | 531 | } |
|
532 | 532 | } |
|
533 | 533 | } |
|
534 | 534 | } |
|
535 | 535 | |
|
536 | 536 | void QIlib::QIcadPcbModule::clrPads() |
|
537 | 537 | { |
|
538 | 538 | while(pads.count()) |
|
539 | 539 | { |
|
540 | 540 | QIcadPcbPad* pad; |
|
541 | 541 | pad = pads.last(); |
|
542 | 542 | pads.removeLast(); |
|
543 | 543 | delete pad; |
|
544 | 544 | } |
|
545 | 545 | } |
|
546 | 546 | |
|
547 | 547 | void QIlib::QIcadPcbModule::apendPad(QIlib::AbstractNode *node) |
|
548 | 548 | { |
|
549 | 549 | if(node->name==QIlib::Lexique::pad_c) |
|
550 | 550 | { |
|
551 | 551 | this->pads.append(new QIcadPcbPad(node, this->p_angle)); |
|
552 | 552 | } |
|
553 | 553 | } |
|
554 | 554 | |
|
555 | 555 | void QIlib::QIcadPcbModule::clrTexts() |
|
556 | 556 | { |
|
557 | 557 | while(fp_texts.count()) |
|
558 | 558 | { |
|
559 | 559 | QIcadPcbFPText* text; |
|
560 | 560 | text = fp_texts.last(); |
|
561 | 561 | fp_texts.removeLast(); |
|
562 | 562 | delete text; |
|
563 | 563 | } |
|
564 | 564 | } |
|
565 | 565 | |
|
566 | 566 | void QIlib::QIcadPcbModule::apendText(QIlib::AbstractNode *node) |
|
567 | 567 | { |
|
568 | 568 | if(node->name==QIlib::Lexique::fp_text_c) |
|
569 | 569 | { |
|
570 | 570 | this->fp_texts.append(new QIcadPcbFPText(node)); |
|
571 | 571 | } |
|
572 | 572 | } |
|
573 | 573 | |
|
574 | 574 | void QIlib::QIcadPcbModule::clrLines() |
|
575 | 575 | { |
|
576 | 576 | while(fp_lines.count()) |
|
577 | 577 | { |
|
578 | 578 | QIcadPcbFPLine* line; |
|
579 | 579 | line = fp_lines.last(); |
|
580 | 580 | fp_lines.removeLast(); |
|
581 | 581 | delete line; |
|
582 | 582 | } |
|
583 | 583 | } |
|
584 | 584 | |
|
585 | 585 | void QIlib::QIcadPcbModule::apendLine(QIlib::AbstractNode *node) |
|
586 | 586 | { |
|
587 | 587 | if(node->name==QIlib::Lexique::fp_line_c) |
|
588 | 588 | { |
|
589 | 589 | this->fp_lines.append(new QIcadPcbFPLine(node)); |
|
590 | 590 | } |
|
591 | 591 | } |
|
592 | 592 | |
|
593 | 593 | void QIlib::QIcadPcbModule::clrCircles() |
|
594 | 594 | { |
|
595 | 595 | while(fp_circles.count()) |
|
596 | 596 | { |
|
597 | 597 | QIcadPcbFPCircle* circle; |
|
598 | 598 | circle = fp_circles.last(); |
|
599 | 599 | fp_circles.removeLast(); |
|
600 | 600 | delete circle; |
|
601 | 601 | } |
|
602 | 602 | } |
|
603 | 603 | |
|
604 | 604 | void QIlib::QIcadPcbModule::apendCircle(QIlib::AbstractNode *node) |
|
605 | 605 | { |
|
606 | 606 | if(node->name==QIlib::Lexique::fp_circle_c) |
|
607 | 607 | { |
|
608 | 608 | this->fp_circles.append(new QIcadPcbFPCircle(node)); |
|
609 | 609 | } |
|
610 | 610 | } |
|
611 | 611 | |
|
612 | 612 | void QIlib::QIcadPcbModule::updatePadsAngle() |
|
613 | 613 | { |
|
614 | 614 | for(int i=0;i<this->pads.count();i++) |
|
615 | 615 | { |
|
616 | 616 | this->pads.at(i)->setModuleAngle(this->p_angle); |
|
617 | 617 | } |
|
618 | 618 | } |
|
619 | 619 | |
|
620 | 620 | |
|
621 | 621 | QIlib::QIcadPcbDimension::QIcadPcbDimension(QIlib::AbstractNode *node) |
|
622 | 622 | :QIcadAbstractNodeWrapper(node) |
|
623 | 623 | { |
|
624 | 624 | this->setNode(node); |
|
625 | 625 | } |
|
626 | 626 | |
|
627 | 627 | void QIlib::QIcadPcbDimension::setNode(QIlib::AbstractNode *node) |
|
628 | 628 | { |
|
629 | 629 | if(node->name==QIlib::Lexique::dimension_c) |
|
630 | 630 | { |
|
631 | 631 | this->p_node = node; |
|
632 | 632 | for(int i=0;i<node->nodes.count();i++) |
|
633 | 633 | { |
|
634 | 634 | if(node->nodes.at(i)->name==QIlib::Lexique::width_c) |
|
635 | 635 | { |
|
636 | 636 | this->width.setNode(node->nodes.at(i)); |
|
637 | 637 | } |
|
638 | 638 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
639 | 639 | { |
|
640 | 640 | this->layer.setNode(node->nodes.at(i)); |
|
641 | 641 | } |
|
642 | 642 | if(node->nodes.at(i)->name==QIlib::Lexique::gr_text_c) |
|
643 | 643 | { |
|
644 | 644 | this->gr_text.setNode(node->nodes.at(i)); |
|
645 | 645 | } |
|
646 | 646 | if(node->nodes.at(i)->name==QIlib::Lexique::feature1_c) |
|
647 | 647 | { |
|
648 | 648 | this->feature1.setNode(node->nodes.at(i)); |
|
649 | 649 | } |
|
650 | 650 | if(node->nodes.at(i)->name==QIlib::Lexique::crossbar_c) |
|
651 | 651 | { |
|
652 | 652 | this->crossbar.setNode(node->nodes.at(i)); |
|
653 | 653 | } |
|
654 | 654 | if(node->nodes.at(i)->name==QIlib::Lexique::arrow1a_c) |
|
655 | 655 | { |
|
656 | 656 | this->arrow1a.setNode(node->nodes.at(i)); |
|
657 | 657 | } |
|
658 | 658 | if(node->nodes.at(i)->name==QIlib::Lexique::arrow1b_c) |
|
659 | 659 | { |
|
660 | 660 | this->arrow1b.setNode(node->nodes.at(i)); |
|
661 | 661 | } |
|
662 | 662 | if(node->nodes.at(i)->name==QIlib::Lexique::arrow2a_c) |
|
663 | 663 | { |
|
664 | 664 | this->arrow2a.setNode(node->nodes.at(i)); |
|
665 | 665 | } |
|
666 | 666 | if(node->nodes.at(i)->name==QIlib::Lexique::arrow2b_c) |
|
667 | 667 | { |
|
668 | 668 | this->arrow2b.setNode(node->nodes.at(i)); |
|
669 | 669 | } |
|
670 | 670 | } |
|
671 | 671 | } |
|
672 | 672 | } |
|
673 | 673 | |
|
674 | 674 | |
|
675 | 675 | QIlib::QIcadPcbModuleModel::QIcadPcbModuleModel(QIlib::AbstractNode *node) |
|
676 | 676 | :QIcadAbstractNodeWrapper(node) |
|
677 | 677 | { |
|
678 | 678 | this->setNode(node); |
|
679 | 679 | } |
|
680 | 680 | |
|
681 | 681 | void QIlib::QIcadPcbModuleModel::setNode(QIlib::AbstractNode *node) |
|
682 | 682 | { |
|
683 | 683 | this->p_node = node; |
|
684 | 684 | } |
|
685 | 685 | |
|
686 | 686 | |
|
687 | 687 | QIlib::QIcadPcbFPText::QIcadPcbFPText(QIlib::AbstractNode *node) |
|
688 | 688 | :QIcadAbstractNodeWrapper(node) |
|
689 | 689 | { |
|
690 | 690 | this->setNode(node); |
|
691 | 691 | } |
|
692 | 692 | |
|
693 | 693 | void QIlib::QIcadPcbFPText::setNode(QIlib::AbstractNode *node) |
|
694 | 694 | { |
|
695 | 695 | if(node->name==QIlib::Lexique::pad_c) |
|
696 | 696 | { |
|
697 | 697 | this->p_node = node; |
|
698 | 698 | for(int i=0;i<node->nodes.count();i++) |
|
699 | 699 | { |
|
700 | 700 | if(node->nodes.at(i)->name==QIlib::Lexique::at_c) |
|
701 | 701 | { |
|
702 | 702 | this->at.setNode(node->nodes.at(i)); |
|
703 | 703 | } |
|
704 | 704 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
705 | 705 | { |
|
706 | 706 | this->layer.setNode(node->nodes.at(i)); |
|
707 | 707 | } |
|
708 | 708 | if(node->nodes.at(i)->name==QIlib::Lexique::effects_c) |
|
709 | 709 | { |
|
710 | 710 | this->effects.setNode(node->nodes.at(i)); |
|
711 | 711 | } |
|
712 | 712 | } |
|
713 | 713 | } |
|
714 | 714 | } |
|
715 | 715 | |
|
716 | 716 | |
|
717 | 717 | QIlib::QIcadPcbFpTextEffects::QIcadPcbFpTextEffects(QIlib::AbstractNode *node) |
|
718 | 718 | :QIcadAbstractNodeWrapper(node) |
|
719 | 719 | { |
|
720 | 720 | this->setNode(node); |
|
721 | 721 | } |
|
722 | 722 | |
|
723 | 723 | void QIlib::QIcadPcbFpTextEffects::setNode(QIlib::AbstractNode *node) |
|
724 | 724 | { |
|
725 | 725 | this->p_node = node; |
|
726 | 726 | } |
|
727 | 727 | |
|
728 | 728 | |
|
729 | 729 | QIlib::QIcadPcbFpTextEffectsFont::QIcadPcbFpTextEffectsFont(QIlib::AbstractNode *node) |
|
730 | 730 | :QIcadAbstractNodeWrapper(node) |
|
731 | 731 | { |
|
732 | 732 | this->setNode(node); |
|
733 | 733 | } |
|
734 | 734 | |
|
735 | 735 | void QIlib::QIcadPcbFpTextEffectsFont::setNode(QIlib::AbstractNode *node) |
|
736 | 736 | { |
|
737 | 737 | this->p_node = node; |
|
738 | 738 | } |
|
739 | 739 | |
|
740 | 740 | |
|
741 | 741 | QIlib::QIcadPcbNetClass::QIcadPcbNetClass(QIlib::AbstractNode *node) |
|
742 | 742 | :QIcadAbstractNodeWrapper(node) |
|
743 | 743 | { |
|
744 | 744 | this->setNode(node); |
|
745 | 745 | } |
|
746 | 746 | |
|
747 | 747 | void QIlib::QIcadPcbNetClass::setNode(QIlib::AbstractNode *node) |
|
748 | 748 | { |
|
749 | 749 | this->p_node = node; |
|
750 | 750 | } |
|
751 | 751 | |
|
752 | 752 | |
|
753 | 753 | QIlib::QIcadPcbSetup::QIcadPcbSetup(QIlib::AbstractNode *node) |
|
754 | 754 | :QIcadAbstractNodeWrapper(node) |
|
755 | 755 | { |
|
756 | 756 | this->setNode(node); |
|
757 | 757 | } |
|
758 | 758 | |
|
759 | 759 | void QIlib::QIcadPcbSetup::setNode(QIlib::AbstractNode *node) |
|
760 | 760 | { |
|
761 | 761 | if(node->name==QIlib::Lexique::setup_c) |
|
762 | 762 | { |
|
763 | 763 | this->p_node = node; |
|
764 | 764 | for(int i=0;i<node->nodes.count();i++) |
|
765 | 765 | { |
|
766 | 766 | if(node->nodes.at(i)->name==QIlib::Lexique::via_drill_c) |
|
767 | 767 | { |
|
768 | 768 | this->via_dril.setNode(node->nodes.at(i)); |
|
769 | 769 | this->p_defaultViaDrillSize = nodeValueToDouble(node->nodes.at(i)); |
|
770 | 770 | } |
|
771 | 771 | } |
|
772 | 772 | } |
|
773 | 773 | } |
|
774 | 774 | |
|
775 | 775 | |
|
776 | 776 | QIlib::QIcadPcbPlotParams::QIcadPcbPlotParams(QIlib::AbstractNode *node) |
|
777 | 777 | :QIcadAbstractNodeWrapper(node) |
|
778 | 778 | { |
|
779 | 779 | this->setNode(node); |
|
780 | 780 | } |
|
781 | 781 | |
|
782 | 782 | void QIlib::QIcadPcbPlotParams::setNode(QIlib::AbstractNode *node) |
|
783 | 783 | { |
|
784 | 784 | this->p_node = node; |
|
785 | 785 | } |
|
786 | 786 | |
|
787 | 787 | |
|
788 | 788 | QIlib::QIcadPcbSegment::QIcadPcbSegment(QIlib::AbstractNode *node) |
|
789 | 789 | :QIcadAbstractPcbLine(node) |
|
790 | 790 | { |
|
791 | 791 | this->setNode(node); |
|
792 | 792 | } |
|
793 | 793 | |
|
794 | 794 | void QIlib::QIcadPcbSegment::setNode(QIlib::AbstractNode *node) |
|
795 | 795 | { |
|
796 | 796 | if(node->name==QIlib::Lexique::segment_c) |
|
797 | 797 | { |
|
798 | 798 | this->p_node = node; |
|
799 | 799 | for(int i=0;i<node->nodes.count();i++) |
|
800 | 800 | { |
|
801 | 801 | if(node->nodes.at(i)->name==QIlib::Lexique::start_c) |
|
802 | 802 | { |
|
803 | 803 | this->p_startpos = nodeTo2DCoords(node->nodes.at(i)); |
|
804 | 804 | this->start.setNode(node->nodes.at(i)); |
|
805 | 805 | } |
|
806 | 806 | if(node->nodes.at(i)->name==QIlib::Lexique::end_c) |
|
807 | 807 | { |
|
808 | 808 | this->p_stoppos = nodeTo2DCoords(node->nodes.at(i)); |
|
809 | 809 | this->end.setNode(node->nodes.at(i)); |
|
810 | 810 | } |
|
811 | 811 | if(node->nodes.at(i)->name==QIlib::Lexique::width_c) |
|
812 | 812 | { |
|
813 | 813 | this->p_width = nodeValueToDouble(node->nodes.at(i)); |
|
814 | 814 | this->width.setNode(node->nodes.at(i)); |
|
815 | 815 | } |
|
816 | 816 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
817 | 817 | { |
|
818 | 818 | this->p_layers = node->nodes.at(i)->Values; |
|
819 | 819 | this->layer.setNode(node->nodes.at(i)); |
|
820 | 820 | } |
|
821 | 821 | if(node->nodes.at(i)->name==QIlib::Lexique::net_c) |
|
822 | 822 | { |
|
823 | 823 | this->net.setNode(node->nodes.at(i)); |
|
824 | 824 | } |
|
825 | 825 | } |
|
826 | 826 | } |
|
827 | 827 | } |
|
828 | 828 | |
|
829 | 829 | |
|
830 | 830 | QIlib::QIcadPcbVia::QIcadPcbVia(QIlib::AbstractNode *node, double defaultDrill) |
|
831 | 831 | :QIcadAbstractNodeWrapper(node),p_drill(defaultDrill) |
|
832 | 832 | { |
|
833 | 833 | this->setNode(node); |
|
834 | 834 | } |
|
835 | 835 | |
|
836 | 836 | void QIlib::QIcadPcbVia::setNode(QIlib::AbstractNode *node) |
|
837 | 837 | { |
|
838 | 838 | if(node->name==QIlib::Lexique::via_c) |
|
839 | 839 | { |
|
840 | 840 | this->p_node = node; |
|
841 | 841 | for(int i=0;i<node->nodes.count();i++) |
|
842 | 842 | { |
|
843 | 843 | if(node->nodes.at(i)->name==QIlib::Lexique::at_c) |
|
844 | 844 | { |
|
845 | 845 | this->at.setNode(node->nodes.at(i)); |
|
846 | 846 | p_pos = nodeTo2DCoords(node->nodes.at(i)); |
|
847 | 847 | } |
|
848 | 848 | if(node->nodes.at(i)->name==QIlib::Lexique::size_c) |
|
849 | 849 | { |
|
850 | 850 | this->sizeNode.setNode(node->nodes.at(i)); |
|
851 | 851 | p_size = QSizeF(nodeValueToDouble(node->nodes.at(i)),nodeValueToDouble(node->nodes.at(i))); |
|
852 | 852 | } |
|
853 | 853 | if(node->nodes.at(i)->name==QIlib::Lexique::drill_c) |
|
854 | 854 | { |
|
855 | 855 | this->drillNode.setNode(node->nodes.at(i)); |
|
856 | 856 | p_drill = nodeValueToDouble(node->nodes.at(i)); |
|
857 | 857 | } |
|
858 | 858 | if(node->nodes.at(i)->name==QIlib::Lexique::layers_c) |
|
859 | 859 | { |
|
860 | 860 | this->layersNode.setNode(node->nodes.at(i)); |
|
861 | 861 | p_layers = node->nodes.at(i)->Values; |
|
862 | 862 | } |
|
863 | 863 | if(node->nodes.at(i)->name==QIlib::Lexique::net_c) |
|
864 | 864 | { |
|
865 | 865 | this->net.setNode(node->nodes.at(i)); |
|
866 | 866 | } |
|
867 | 867 | if(node->nodes.at(i)->name==QIlib::Lexique::tstamp_c) |
|
868 | 868 | { |
|
869 | 869 | this->tstamp.setNode(node->nodes.at(i)); |
|
870 | 870 | } |
|
871 | 871 | } |
|
872 | 872 | } |
|
873 | 873 | } |
|
874 | 874 | |
|
875 | 875 | |
|
876 | 876 | QIlib::QIcadPcbPad::QIcadPcbPad(QIlib::AbstractNode *node, double modAngle) |
|
877 | 877 | :QIcadAbstractNodeWrapper(node),p_Mod_angle(modAngle),p_angle(0.0) |
|
878 | 878 | { |
|
879 | 879 | this->setNode(node); |
|
880 | 880 | } |
|
881 | 881 | |
|
882 | 882 | |
|
883 | 883 | |
|
884 | 884 | void QIlib::QIcadPcbPad::setNode(QIlib::AbstractNode *node) |
|
885 | 885 | { |
|
886 | 886 | if(node->name==QIlib::Lexique::pad_c) |
|
887 | 887 | { |
|
888 | 888 | this->p_node = node; |
|
889 | 889 | if(p_node->Values.count()>=3) |
|
890 | 890 | { |
|
891 | 891 | if(!this->p_node->Values.at((2)).compare("rect")) |
|
892 | 892 | { |
|
893 | 893 | this->p_shape = rectangle; |
|
894 | 894 | } |
|
895 | 895 | else |
|
896 | 896 | if(!this->p_node->Values.at((2)).compare("circle")) |
|
897 | 897 | { |
|
898 | 898 | this->p_shape = circle; |
|
899 | 899 | } |
|
900 | 900 | this->p_padNumber = nodeValueToInt(node,0); |
|
901 | 901 | } |
|
902 | 902 | for(int i=0;i<node->nodes.count();i++) |
|
903 | 903 | { |
|
904 | 904 | if(node->nodes.at(i)->name==QIlib::Lexique::at_c) |
|
905 | 905 | { |
|
906 | 906 | this->at.setNode(node->nodes.at(i)); |
|
907 | 907 | this->p_pos = nodeTo2DCoords(node->nodes.at(i)); |
|
908 | 908 | this->p_angle = nodeValueToDouble(node->nodes.at(i),2); |
|
909 | 909 | } |
|
910 | 910 | if(node->nodes.at(i)->name==QIlib::Lexique::size_c) |
|
911 | 911 | { |
|
912 | 912 | this->sizeNode.setNode(node->nodes.at(i)); |
|
913 | 913 | this->p_size = nodeTo2DSize(node->nodes.at(i)); |
|
914 | 914 | } |
|
915 | 915 | if(node->nodes.at(i)->name==QIlib::Lexique::layers_c) |
|
916 | 916 | { |
|
917 | 917 | this->layer.setNode(node->nodes.at(i)); |
|
918 | 918 | this->p_layers = node->nodes.at(i)->Values; |
|
919 | 919 | } |
|
920 | 920 | if(node->nodes.at(i)->name==QIlib::Lexique::net_c) |
|
921 | 921 | { |
|
922 | 922 | this->netNode.setNode(node->nodes.at(i)); |
|
923 | 923 | } |
|
924 | 924 | if(node->nodes.at(i)->name==QIlib::Lexique::drill_c) |
|
925 | 925 | { |
|
926 | 926 | this->drillNode.setNode(node->nodes.at(i)); |
|
927 | 927 | this->p_drill = nodeValueToDouble(node->nodes.at(i)); |
|
928 | 928 | } |
|
929 | 929 | } |
|
930 | 930 | } |
|
931 | 931 | } |
|
932 | 932 | |
|
933 | 933 | |
|
934 | 934 | QIlib::QIcadPcbFPLine::QIcadPcbFPLine(QIlib::AbstractNode *node) |
|
935 | 935 | :QIcadAbstractPcbLine(node) |
|
936 | 936 | { |
|
937 | 937 | this->setNode(node); |
|
938 | 938 | } |
|
939 | 939 | |
|
940 | 940 | void QIlib::QIcadPcbFPLine::setNode(QIlib::AbstractNode *node) |
|
941 | 941 | { |
|
942 | 942 | if(node->name==QIlib::Lexique::fp_line_c) |
|
943 | 943 | { |
|
944 | 944 | this->p_node = node; |
|
945 | 945 | for(int i=0;i<node->nodes.count();i++) |
|
946 | 946 | { |
|
947 | 947 | if(node->nodes.at(i)->name==QIlib::Lexique::start_c) |
|
948 | 948 | { |
|
949 | 949 | this->p_startpos = nodeTo2DCoords(node->nodes.at(i)); |
|
950 | 950 | this->start.setNode(node->nodes.at(i)); |
|
951 | 951 | } |
|
952 | 952 | if(node->nodes.at(i)->name==QIlib::Lexique::end_c) |
|
953 | 953 | { |
|
954 | 954 | this->p_stoppos = nodeTo2DCoords(node->nodes.at(i)); |
|
955 | 955 | this->end.setNode(node->nodes.at(i)); |
|
956 | 956 | } |
|
957 | 957 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
958 | 958 | { |
|
959 | 959 | this->p_layers = node->nodes.at(i)->Values; |
|
960 | 960 | this->layer.setNode(node->nodes.at(i)); |
|
961 | 961 | } |
|
962 | 962 | if(node->nodes.at(i)->name==QIlib::Lexique::width_c) |
|
963 | 963 | { |
|
964 | 964 | this->p_width = nodeValueToDouble(node->nodes.at(i)); |
|
965 | 965 | this->width.setNode(node->nodes.at(i)); |
|
966 | 966 | } |
|
967 | 967 | } |
|
968 | 968 | } |
|
969 | 969 | } |
|
970 | 970 | |
|
971 | 971 | |
|
972 | 972 | QIlib::QIcadPcbFPCircle::QIcadPcbFPCircle(QIlib::AbstractNode *node) |
|
973 | 973 | :QIcadAbstractNodeWrapper(node) |
|
974 | 974 | { |
|
975 | 975 | this->setNode(node); |
|
976 | 976 | } |
|
977 | 977 | |
|
978 | 978 | void QIlib::QIcadPcbFPCircle::setNode(QIlib::AbstractNode *node) |
|
979 | 979 | { |
|
980 | 980 | if(node->name==QIlib::Lexique::fp_circle_c) |
|
981 | 981 | { |
|
982 | 982 | this->p_node = node; |
|
983 | 983 | for(int i=0;i<node->nodes.count();i++) |
|
984 | 984 | { |
|
985 | 985 | if(node->nodes.at(i)->name==QIlib::Lexique::center_c) |
|
986 | 986 | { |
|
987 | 987 | this->center.setNode(node->nodes.at(i)); |
|
988 | 988 | } |
|
989 | 989 | if(node->nodes.at(i)->name==QIlib::Lexique::end_c) |
|
990 | 990 | { |
|
991 | 991 | this->end.setNode(node->nodes.at(i)); |
|
992 | 992 | } |
|
993 | 993 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
994 | 994 | { |
|
995 | 995 | this->layer.setNode(node->nodes.at(i)); |
|
996 | 996 | } |
|
997 | 997 | if(node->nodes.at(i)->name==QIlib::Lexique::width_c) |
|
998 | 998 | { |
|
999 | 999 | this->width.setNode(node->nodes.at(i)); |
|
1000 | 1000 | } |
|
1001 | 1001 | } |
|
1002 | 1002 | } |
|
1003 | 1003 | } |
|
1004 | 1004 | |
|
1005 | 1005 | |
|
1006 | 1006 | QIlib::QIcadPcbText::QIcadPcbText(QIlib::AbstractNode *node) |
|
1007 | 1007 | :QIcadAbstractNodeWrapper(node) |
|
1008 | 1008 | { |
|
1009 | 1009 | this->setNode(node); |
|
1010 | 1010 | } |
|
1011 | 1011 | |
|
1012 | 1012 | void QIlib::QIcadPcbText::setNode(QIlib::AbstractNode *node) |
|
1013 | 1013 | { |
|
1014 | 1014 | if(node->name==QIlib::Lexique::gr_text_c) |
|
1015 | 1015 | { |
|
1016 | 1016 | this->p_node = node; |
|
1017 | 1017 | for(int i=0;i<node->nodes.count();i++) |
|
1018 | 1018 | { |
|
1019 | 1019 | if(node->nodes.at(i)->name==QIlib::Lexique::at_c) |
|
1020 | 1020 | { |
|
1021 | 1021 | this->at.setNode(node->nodes.at(i)); |
|
1022 | 1022 | } |
|
1023 | 1023 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
1024 | 1024 | { |
|
1025 | 1025 | this->layer.setNode(node->nodes.at(i)); |
|
1026 | 1026 | } |
|
1027 | 1027 | if(node->nodes.at(i)->name==QIlib::Lexique::width_c) |
|
1028 | 1028 | { |
|
1029 | 1029 | this->width.setNode(node->nodes.at(i)); |
|
1030 | 1030 | } |
|
1031 | 1031 | if(node->nodes.at(i)->name==QIlib::Lexique::effects_c) |
|
1032 | 1032 | { |
|
1033 | 1033 | this->effects.setNode(node->nodes.at(i)); |
|
1034 | 1034 | } |
|
1035 | 1035 | } |
|
1036 | 1036 | } |
|
1037 | 1037 | } |
|
1038 | 1038 | |
|
1039 | 1039 | |
|
1040 | 1040 | QIlib::QIcadPcbCircle::QIcadPcbCircle(QIlib::AbstractNode *node) |
|
1041 | 1041 | :QIcadAbstractNodeWrapper(node) |
|
1042 | 1042 | { |
|
1043 | 1043 | this->setNode(node); |
|
1044 | 1044 | } |
|
1045 | 1045 | |
|
1046 | 1046 | void QIlib::QIcadPcbCircle::setNode(QIlib::AbstractNode *node) |
|
1047 | 1047 | { |
|
1048 | 1048 | if(node->name==QIlib::Lexique::gr_circle_c) |
|
1049 | 1049 | { |
|
1050 | 1050 | this->p_node = node; |
|
1051 | 1051 | for(int i=0;i<node->nodes.count();i++) |
|
1052 | 1052 | { |
|
1053 | 1053 | if(node->nodes.at(i)->name==QIlib::Lexique::center_c) |
|
1054 | 1054 | { |
|
1055 | 1055 | this->center.setNode(node->nodes.at(i)); |
|
1056 | 1056 | } |
|
1057 | 1057 | if(node->nodes.at(i)->name==QIlib::Lexique::end_c) |
|
1058 | 1058 | { |
|
1059 | 1059 | this->end.setNode(node->nodes.at(i)); |
|
1060 | 1060 | } |
|
1061 | 1061 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
1062 | 1062 | { |
|
1063 | 1063 | this->layer.setNode(node->nodes.at(i)); |
|
1064 | 1064 | } |
|
1065 | 1065 | if(node->nodes.at(i)->name==QIlib::Lexique::width_c) |
|
1066 | 1066 | { |
|
1067 | 1067 | this->width.setNode(node->nodes.at(i)); |
|
1068 | 1068 | } |
|
1069 | 1069 | } |
|
1070 | 1070 | } |
|
1071 | 1071 | } |
|
1072 | 1072 | |
|
1073 | 1073 | |
|
1074 | 1074 | QIlib::QIcadPcbArc::QIcadPcbArc(QIlib::AbstractNode *node) |
|
1075 | 1075 | :QIcadAbstractNodeWrapper(node) |
|
1076 | 1076 | { |
|
1077 | 1077 | this->setNode(node); |
|
1078 | 1078 | } |
|
1079 | 1079 | |
|
1080 | 1080 | void QIlib::QIcadPcbArc::setNode(QIlib::AbstractNode *node) |
|
1081 | 1081 | { |
|
1082 | 1082 | if(node->name==QIlib::Lexique::gr_arc_c) |
|
1083 | 1083 | { |
|
1084 | 1084 | this->p_node = node; |
|
1085 | 1085 | for(int i=0;i<node->nodes.count();i++) |
|
1086 | 1086 | { |
|
1087 | 1087 | if(node->nodes.at(i)->name==QIlib::Lexique::start_c) |
|
1088 | 1088 | { |
|
1089 | 1089 | this->start.setNode(node->nodes.at(i)); |
|
1090 | 1090 | } |
|
1091 | 1091 | if(node->nodes.at(i)->name==QIlib::Lexique::end_c) |
|
1092 | 1092 | { |
|
1093 | 1093 | this->end.setNode(node->nodes.at(i)); |
|
1094 | 1094 | } |
|
1095 | 1095 | if(node->nodes.at(i)->name==QIlib::Lexique::angle_c) |
|
1096 | 1096 | { |
|
1097 | 1097 | this->angle.setNode(node->nodes.at(i)); |
|
1098 | 1098 | } |
|
1099 | 1099 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) |
|
1100 | 1100 | { |
|
1101 | 1101 | this->layer.setNode(node->nodes.at(i)); |
|
1102 | 1102 | } |
|
1103 | 1103 | if(node->nodes.at(i)->name==QIlib::Lexique::width_c) |
|
1104 | 1104 | { |
|
1105 | 1105 | this->width.setNode(node->nodes.at(i)); |
|
1106 | 1106 | } |
|
1107 | 1107 | } |
|
1108 | 1108 | } |
|
1109 | 1109 | } |
|
1110 | 1110 | |
|
1111 | 1111 | |
|
1112 | 1112 | QIlib::QIcadPcbZone::QIcadPcbZone(QIlib::AbstractNode *node) |
|
1113 | 1113 | :QIcadAbstractNodeWrapper(node) |
|
1114 | 1114 | { |
|
1115 | 1115 | this->setNode(node); |
|
1116 | 1116 | } |
|
1117 | 1117 | |
|
1118 | 1118 | void QIlib::QIcadPcbZone::setNode(QIlib::AbstractNode *node) |
|
1119 | 1119 | { |
|
1120 | 1120 | if(node->name==QIlib::Lexique::zone_c) |
|
1121 | 1121 | { |
|
1122 | 1122 | this->p_node = node; |
|
1123 | for(int i=0;i<node->nodes.count();i++) | |
|
1124 | { | |
|
1125 | if(node->nodes.at(i)->name==QIlib::Lexique::polygon_c) | |
|
1126 | { | |
|
1127 | this->polygon.setNode(node->nodes.at(i)); | |
|
1128 | } | |
|
1129 | if(node->nodes.at(i)->name==QIlib::Lexique::filled_polygon_c) | |
|
1130 | { | |
|
1131 | this->filledPolygon.setNode(node->nodes.at(i)); | |
|
1132 | } | |
|
1133 | if(node->nodes.at(i)->name==QIlib::Lexique::layer_c) | |
|
1134 | { | |
|
1135 | this->layer.setNode(node->nodes.at(i)); | |
|
1136 | } | |
|
1137 | } | |
|
1138 | } | |
|
1139 | } | |
|
1140 | ||
|
1141 | ||
|
1142 | QIlib::QIcadPcbPolygonPoint::QIcadPcbPolygonPoint(QIlib::AbstractNode *node) | |
|
1143 | :QIcadAbstractNodeWrapper(node) | |
|
1144 | { | |
|
1145 | this->p_pos.setX(0.0); | |
|
1146 | this->p_pos.setY(0.0); | |
|
1147 | this->setNode(node); | |
|
1148 | } | |
|
1149 | ||
|
1150 | void QIlib::QIcadPcbPolygonPoint::setNode(QIlib::AbstractNode *node) | |
|
1151 | { | |
|
1152 | if(node->name==QIlib::Lexique::xy_c) | |
|
1153 | { | |
|
1154 | this->p_node = node; | |
|
1155 | this->p_pos = nodeTo2DCoords(node); | |
|
1123 | 1156 | } |
|
1124 | 1157 | } |
|
1125 | 1158 | |
|
1126 | 1159 | |
|
1160 | QIlib::QIcadPcbPolygon::QIcadPcbPolygon(QIlib::AbstractNode *node) | |
|
1161 | :QIcadAbstractNodeWrapper(node) | |
|
1162 | { | |
|
1163 | this->setNode(node); | |
|
1164 | } | |
|
1165 | ||
|
1166 | void QIlib::QIcadPcbPolygon::setNode(QIlib::AbstractNode *node) | |
|
1167 | { | |
|
1168 | if(node->name==QIlib::Lexique::polygon_c) | |
|
1169 | { | |
|
1170 | this->p_node = node; | |
|
1171 | this->p_filled = false; | |
|
1172 | for(int i=0;i<node->nodes.count();i++) | |
|
1173 | { | |
|
1174 | if(node->nodes.at(i)->name==QIlib::Lexique::pts_c) | |
|
1175 | { | |
|
1176 | this->points.setNode(node->nodes.at(i)); | |
|
1177 | } | |
|
1178 | } | |
|
1179 | } | |
|
1180 | if(node->name==QIlib::Lexique::filled_polygon_c) | |
|
1181 | { | |
|
1182 | this->p_node = node; | |
|
1183 | this->p_filled = true; | |
|
1184 | for(int i=0;i<node->nodes.count();i++) | |
|
1185 | { | |
|
1186 | if(node->nodes.at(i)->name==QIlib::Lexique::pts_c) | |
|
1187 | { | |
|
1188 | this->points.setNode(node->nodes.at(i)); | |
|
1189 | } | |
|
1190 | } | |
|
1191 | } | |
|
1192 | } | |
|
1193 | ||
|
1194 | QIlib::QIcadPcbPolygonPoints::QIcadPcbPolygonPoints(QIlib::AbstractNode *node) | |
|
1195 | :QIcadAbstractNodeWrapper(node) | |
|
1196 | { | |
|
1197 | this->setNode(node); | |
|
1198 | } | |
|
1199 | ||
|
1200 | void QIlib::QIcadPcbPolygonPoints::setNode(QIlib::AbstractNode *node) | |
|
1201 | { | |
|
1202 | this->clrPoints(); | |
|
1203 | if(node->name==QIlib::Lexique::pts_c) | |
|
1204 | { | |
|
1205 | this->p_node = node; | |
|
1206 | for(int i=0;i<node->nodes.count();i++) | |
|
1207 | { | |
|
1208 | if(node->nodes.at(i)->name==QIlib::Lexique::xy_c) | |
|
1209 | { | |
|
1210 | this->apendPoint(node->nodes.at(i)); | |
|
1211 | } | |
|
1212 | } | |
|
1213 | } | |
|
1214 | } | |
|
1215 | ||
|
1216 | void QIlib::QIcadPcbPolygonPoints::clrPoints() | |
|
1217 | { | |
|
1218 | while(points.count()) | |
|
1219 | { | |
|
1220 | QIcadPcbPolygonPoint* point; | |
|
1221 | point = points.last(); | |
|
1222 | points.removeLast(); | |
|
1223 | delete point; | |
|
1224 | } | |
|
1225 | } | |
|
1226 | ||
|
1227 | void QIlib::QIcadPcbPolygonPoints::apendPoint(QIlib::AbstractNode *node) | |
|
1228 | { | |
|
1229 | if(node->name==QIlib::Lexique::xy_c) | |
|
1230 | { | |
|
1231 | this->points.append(new QIcadPcbPolygonPoint(node)); | |
|
1232 | } | |
|
1233 | } | |
|
1234 | ||
|
1127 | 1235 | const QPointF QIlib::nodeTo2DCoords(QIlib::AbstractNode *node) |
|
1128 | 1236 | { |
|
1129 | 1237 | QPointF point; |
|
1130 | 1238 | QStringList coords=node->Values; |
|
1131 | 1239 | if(coords.count()>=2) |
|
1132 | 1240 | { |
|
1133 | 1241 | point.setX(coords.at(0).toDouble()); |
|
1134 | 1242 | point.setY(coords.at(1).toDouble()); |
|
1135 | 1243 | } |
|
1136 | 1244 | return point; |
|
1137 | 1245 | } |
|
1138 | 1246 | |
|
1139 | 1247 | |
|
1140 | 1248 | double QIlib::nodeValueToDouble(QIlib::AbstractNode *node, int index) |
|
1141 | 1249 | { |
|
1142 | 1250 | if(node->Values.count()>index) |
|
1143 | 1251 | { |
|
1144 | 1252 | return node->Values.at(index).toDouble(); |
|
1145 | 1253 | } |
|
1146 | 1254 | return 0.0; |
|
1147 | 1255 | } |
|
1148 | 1256 | |
|
1149 | 1257 | |
|
1150 | 1258 | int QIlib::nodeValueToInt(QIlib::AbstractNode *node, int index) |
|
1151 | 1259 | { |
|
1152 | 1260 | if(node->Values.count()>index) |
|
1153 | 1261 | { |
|
1154 | 1262 | return node->Values.at(index).toInt(); |
|
1155 | 1263 | } |
|
1156 | 1264 | return 0; |
|
1157 | 1265 | } |
|
1158 | 1266 | |
|
1159 | 1267 | |
|
1160 | 1268 | QIlib::QIcadPcbLayer::QIcadPcbLayer(QIlib::AbstractNode *node) |
|
1161 | 1269 | :QIcadAbstractNodeWrapper(node) |
|
1162 | 1270 | { |
|
1163 | 1271 | this->p_index = QString(this->p_node->name).remove('(').toInt(); |
|
1164 | 1272 | if(this->p_node->Values.count()>=1) |
|
1165 | 1273 | { |
|
1166 | 1274 | this->p_name = this->p_node->Values.at(0); |
|
1167 | 1275 | } |
|
1168 | 1276 | if(this->p_node->Values.count()>=2) |
|
1169 | 1277 | { |
|
1170 | 1278 | QString typestr=this->p_node->Values.at(1); |
|
1171 | 1279 | this->p_type = none; |
|
1172 | 1280 | if(!typestr.compare("signal")) |
|
1173 | 1281 | { |
|
1174 | 1282 | this->p_type = signal; |
|
1175 | 1283 | } |
|
1176 | 1284 | else |
|
1177 | 1285 | if(!typestr.compare("user")) |
|
1178 | 1286 | { |
|
1179 | 1287 | this->p_type = user; |
|
1180 | 1288 | } |
|
1181 | 1289 | } |
|
1182 | 1290 | } |
|
1183 | 1291 | |
|
1184 | 1292 | |
|
1185 | 1293 | const QSizeF QIlib::nodeTo2DSize(QIlib::AbstractNode *node) |
|
1186 | 1294 | { |
|
1187 | 1295 | QSizeF size; |
|
1188 | 1296 | QStringList sz=node->Values; |
|
1189 | 1297 | if(sz.count()>=2) |
|
1190 | 1298 | { |
|
1191 | 1299 | size.setWidth(sz.at(0).toDouble()); |
|
1192 | 1300 | size.setHeight(sz.at(1).toDouble()); |
|
1193 | 1301 | } |
|
1194 | 1302 | return size; |
|
1195 | 1303 | } |
|
1304 | ||
|
1305 | ||
|
1306 | ||
|
1307 | ||
|
1308 |
@@ -1,498 +1,539 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2014, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef QICADPCB_H |
|
23 | 23 | #define QICADPCB_H |
|
24 | 24 | #include <QString> |
|
25 | 25 | #include <QStringList> |
|
26 | 26 | #include <QList> |
|
27 | 27 | #include <QFile> |
|
28 | 28 | #include <parsers/lispLike_driver.h> |
|
29 | 29 | #include <qicadlisplikelexique.h> |
|
30 | 30 | #include <QPointF> |
|
31 | 31 | #include <QRectF> |
|
32 | 32 | |
|
33 | 33 | namespace QIlib{ |
|
34 | 34 | const QPointF nodeTo2DCoords(QIlib::AbstractNode* node); |
|
35 | 35 | const QSizeF nodeTo2DSize(QIlib::AbstractNode* node); |
|
36 | 36 | double nodeValueToDouble(QIlib::AbstractNode* node,int index=0); |
|
37 | 37 | int nodeValueToInt(QIlib::AbstractNode* node,int index=0); |
|
38 | 38 | |
|
39 | 39 | class QIcadAbstractPcbLine : public QIcadAbstractNodeWrapper |
|
40 | 40 | { |
|
41 | 41 | public: |
|
42 | 42 | QIcadAbstractPcbLine(QIlib::AbstractNode* node) |
|
43 | 43 | :QIcadAbstractNodeWrapper(node) |
|
44 | 44 | {} |
|
45 | 45 | QIcadAbstractPcbLine(){} |
|
46 | 46 | virtual const QPointF& startPos(){return p_startpos;} |
|
47 | 47 | virtual const QPointF& stopPos(){return p_stoppos;} |
|
48 | 48 | virtual double width(){return p_width;} |
|
49 | 49 | virtual const QStringList& layers(){return p_layers;} |
|
50 | 50 | protected: |
|
51 | 51 | double p_width; |
|
52 | 52 | QPointF p_startpos; |
|
53 | 53 | QPointF p_stoppos; |
|
54 | 54 | QStringList p_layers; |
|
55 | 55 | }; |
|
56 | 56 | |
|
57 | 57 | class QIcadPcbLayer : public QIcadAbstractNodeWrapper |
|
58 | 58 | { |
|
59 | 59 | public: |
|
60 | 60 | typedef enum |
|
61 | 61 | { |
|
62 | 62 | signal, |
|
63 | 63 | user, |
|
64 | 64 | none |
|
65 | 65 | }layetType_t; |
|
66 | 66 | QIcadPcbLayer(QIlib::AbstractNode* node); |
|
67 | 67 | QIcadPcbLayer(){} |
|
68 | 68 | int index(){return p_index;} |
|
69 | 69 | const QString& name(){return p_name;} |
|
70 | 70 | layetType_t type(){return p_type;} |
|
71 | 71 | protected: |
|
72 | 72 | int p_index; |
|
73 | 73 | QString p_name; |
|
74 | 74 | layetType_t p_type; |
|
75 | 75 | }; |
|
76 | 76 | |
|
77 | 77 | class QIcadPcbPlotParams : public QIcadAbstractNodeWrapper |
|
78 | 78 | { |
|
79 | 79 | public: |
|
80 | 80 | QIcadPcbPlotParams(QIlib::AbstractNode* node); |
|
81 | 81 | QIcadPcbPlotParams(){} |
|
82 | 82 | QIcadAbstractNodeWrapper layerselection; |
|
83 | 83 | QIcadAbstractNodeWrapper usegerberextensions; |
|
84 | 84 | QIcadAbstractNodeWrapper excludeedgelayer; |
|
85 | 85 | QIcadAbstractNodeWrapper linewidth; |
|
86 | 86 | QIcadAbstractNodeWrapper plotframeref; |
|
87 | 87 | QIcadAbstractNodeWrapper viasonmask; |
|
88 | 88 | QIcadAbstractNodeWrapper mode; |
|
89 | 89 | QIcadAbstractNodeWrapper useauxorigin; |
|
90 | 90 | QIcadAbstractNodeWrapper hpglpennumber; |
|
91 | 91 | QIcadAbstractNodeWrapper hpglpenspeed; |
|
92 | 92 | QIcadAbstractNodeWrapper hpglpendiameter; |
|
93 | 93 | QIcadAbstractNodeWrapper hpglpenoverlay; |
|
94 | 94 | QIcadAbstractNodeWrapper psnegative; |
|
95 | 95 | QIcadAbstractNodeWrapper psa4output; |
|
96 | 96 | QIcadAbstractNodeWrapper plotreference; |
|
97 | 97 | QIcadAbstractNodeWrapper plotvalue; |
|
98 | 98 | QIcadAbstractNodeWrapper plotothertext; |
|
99 | 99 | QIcadAbstractNodeWrapper plotinvisibletext; |
|
100 | 100 | QIcadAbstractNodeWrapper padsonsilk; |
|
101 | 101 | QIcadAbstractNodeWrapper subtractmaskfromsilk; |
|
102 | 102 | QIcadAbstractNodeWrapper outputformat; |
|
103 | 103 | QIcadAbstractNodeWrapper mirror; |
|
104 | 104 | QIcadAbstractNodeWrapper drillshape; |
|
105 | 105 | QIcadAbstractNodeWrapper scaleselection; |
|
106 | 106 | QIcadAbstractNodeWrapper outputdirectory; |
|
107 | 107 | void setNode(QIlib::AbstractNode* node); |
|
108 | 108 | }; |
|
109 | 109 | |
|
110 | 110 | class QIcadPcbSetup : public QIcadAbstractNodeWrapper |
|
111 | 111 | { |
|
112 | 112 | public: |
|
113 | 113 | QIcadPcbSetup(QIlib::AbstractNode* node); |
|
114 | 114 | QIcadPcbSetup(){} |
|
115 | 115 | QIcadAbstractNodeWrapper last_trace_width; |
|
116 | 116 | QIcadAbstractNodeWrapper trace_clearance; |
|
117 | 117 | QIcadAbstractNodeWrapper zone_clearance; |
|
118 | 118 | QIcadAbstractNodeWrapper zone_45_only; |
|
119 | 119 | QIcadAbstractNodeWrapper trace_min; |
|
120 | 120 | QIcadAbstractNodeWrapper segment_width; |
|
121 | 121 | QIcadAbstractNodeWrapper edge_width; |
|
122 | 122 | QIcadAbstractNodeWrapper via_size; |
|
123 | 123 | QIcadAbstractNodeWrapper via_dril; |
|
124 | 124 | QIcadAbstractNodeWrapper via_min_size; |
|
125 | 125 | QIcadAbstractNodeWrapper via_min_drill; |
|
126 | 126 | QIcadAbstractNodeWrapper uvia_size; |
|
127 | 127 | QIcadAbstractNodeWrapper uvia_drill; |
|
128 | 128 | QIcadAbstractNodeWrapper uvias_allowed; |
|
129 | 129 | QIcadAbstractNodeWrapper uvia_min_size; |
|
130 | 130 | QIcadAbstractNodeWrapper uvia_min_drill; |
|
131 | 131 | QIcadAbstractNodeWrapper pcb_text_width; |
|
132 | 132 | QIcadAbstractNodeWrapper pcb_text_size; |
|
133 | 133 | QIcadAbstractNodeWrapper mod_edge_width; |
|
134 | 134 | QIcadAbstractNodeWrapper mod_text_size; |
|
135 | 135 | QIcadAbstractNodeWrapper mod_text_width; |
|
136 | 136 | QIcadAbstractNodeWrapper pad_size; |
|
137 | 137 | QIcadAbstractNodeWrapper pad_drill; |
|
138 | 138 | QIcadAbstractNodeWrapper pad_to_mask_clearance; |
|
139 | 139 | QIcadAbstractNodeWrapper aux_axis_origin; |
|
140 | 140 | QIcadAbstractNodeWrapper visible_elements; |
|
141 | 141 | QIcadPcbPlotParams plotParams; |
|
142 | 142 | void setNode(QIlib::AbstractNode* node); |
|
143 | 143 | double defaultViaDrillSize(){return p_defaultViaDrillSize;} |
|
144 | 144 | private: |
|
145 | 145 | double p_defaultViaDrillSize; |
|
146 | 146 | }; |
|
147 | 147 | |
|
148 | 148 | class QIcadPcbNetClass : public QIcadAbstractNodeWrapper |
|
149 | 149 | { |
|
150 | 150 | public: |
|
151 | 151 | QIcadPcbNetClass(QIlib::AbstractNode* node); |
|
152 | 152 | QIcadPcbNetClass(){} |
|
153 | 153 | QIcadAbstractNodeWrapper clearance; |
|
154 | 154 | QIcadAbstractNodeWrapper trace_width; |
|
155 | 155 | QIcadAbstractNodeWrapper via_dia; |
|
156 | 156 | QIcadAbstractNodeWrapper via_drill; |
|
157 | 157 | QIcadAbstractNodeWrapper uvia_dia; |
|
158 | 158 | QIcadAbstractNodeWrapper uvia_drill; |
|
159 | 159 | QList<QIcadAbstractNodeWrapper*> nets; |
|
160 | 160 | void setNode(QIlib::AbstractNode* node); |
|
161 | 161 | }; |
|
162 | 162 | |
|
163 | 163 | class QIcadPcbFpTextEffectsFont : public QIcadAbstractNodeWrapper |
|
164 | 164 | { |
|
165 | 165 | public: |
|
166 | 166 | QIcadPcbFpTextEffectsFont(QIlib::AbstractNode* node); |
|
167 | 167 | QIcadAbstractNodeWrapper size; |
|
168 | 168 | void setNode(QIlib::AbstractNode* node); |
|
169 | 169 | }; |
|
170 | 170 | |
|
171 | 171 | class QIcadPcbFpTextEffects : public QIcadAbstractNodeWrapper |
|
172 | 172 | { |
|
173 | 173 | public: |
|
174 | 174 | QIcadPcbFpTextEffects(QIlib::AbstractNode* node); |
|
175 | 175 | QIcadPcbFpTextEffects(){} |
|
176 | 176 | QIcadAbstractNodeWrapper font; |
|
177 | 177 | QIcadAbstractNodeWrapper thickness; |
|
178 | 178 | void setNode(QIlib::AbstractNode* node); |
|
179 | 179 | }; |
|
180 | 180 | |
|
181 | 181 | class QIcadPcbFPText : public QIcadAbstractNodeWrapper |
|
182 | 182 | { |
|
183 | 183 | public: |
|
184 | 184 | QIcadPcbFPText(QIlib::AbstractNode* node); |
|
185 | 185 | QIcadPcbFPText(){} |
|
186 | 186 | QIcadAbstractNodeWrapper at; |
|
187 | 187 | QIcadAbstractNodeWrapper layer; |
|
188 | 188 | QIcadPcbFpTextEffects effects; |
|
189 | 189 | void setNode(QIlib::AbstractNode* node); |
|
190 | 190 | }; |
|
191 | 191 | |
|
192 | 192 | class QIcadPcbModuleModel : public QIcadAbstractNodeWrapper |
|
193 | 193 | { |
|
194 | 194 | public: |
|
195 | 195 | QIcadPcbModuleModel(QIlib::AbstractNode* node); |
|
196 | 196 | QIcadPcbModuleModel(){} |
|
197 | 197 | QIcadAbstractNodeWrapper at; |
|
198 | 198 | QIcadAbstractNodeWrapper scale; |
|
199 | 199 | QIcadAbstractNodeWrapper rotate; |
|
200 | 200 | void setNode(QIlib::AbstractNode* node); |
|
201 | 201 | }; |
|
202 | 202 | |
|
203 | 203 | class QIcadPcbDimension : public QIcadAbstractNodeWrapper |
|
204 | 204 | { |
|
205 | 205 | public: |
|
206 | 206 | QIcadPcbDimension(QIlib::AbstractNode* node); |
|
207 | 207 | QIcadPcbDimension(){} |
|
208 | 208 | QIcadAbstractNodeWrapper width; |
|
209 | 209 | QIcadAbstractNodeWrapper layer; |
|
210 | 210 | QIcadAbstractNodeWrapper gr_text; |
|
211 | 211 | QIcadAbstractNodeWrapper feature1; |
|
212 | 212 | QIcadAbstractNodeWrapper feature2; |
|
213 | 213 | QIcadAbstractNodeWrapper crossbar; |
|
214 | 214 | QIcadAbstractNodeWrapper arrow1a; |
|
215 | 215 | QIcadAbstractNodeWrapper arrow1b; |
|
216 | 216 | QIcadAbstractNodeWrapper arrow2a; |
|
217 | 217 | QIcadAbstractNodeWrapper arrow2b; |
|
218 | 218 | void setNode(QIlib::AbstractNode* node); |
|
219 | 219 | }; |
|
220 | 220 | |
|
221 | 221 | class QIcadPcbPad : public QIcadAbstractNodeWrapper |
|
222 | 222 | { |
|
223 | 223 | public: |
|
224 | 224 | typedef enum |
|
225 | 225 | { |
|
226 | 226 | rectangle, |
|
227 | 227 | circle |
|
228 | 228 | }padShape; |
|
229 | 229 | QIcadPcbPad(QIlib::AbstractNode* node,double modAngle=0.0); |
|
230 | 230 | QIcadPcbPad(){} |
|
231 | 231 | QIcadAbstractNodeWrapper at; |
|
232 | 232 | QIcadAbstractNodeWrapper sizeNode; |
|
233 | 233 | QIcadAbstractNodeWrapper layer; |
|
234 | 234 | QIcadAbstractNodeWrapper netNode; |
|
235 | 235 | QIcadAbstractNodeWrapper drillNode; |
|
236 | 236 | const QStringList& layers(){return p_layers;} |
|
237 | 237 | const QSizeF& size(){return p_size;} |
|
238 | 238 | const QPointF& pos(){return p_pos;} |
|
239 | 239 | double drill(){return p_drill;} |
|
240 | 240 | void setModuleAngle(double modAngle){p_Mod_angle= modAngle;} |
|
241 | 241 | double angle(){return - (p_angle - p_Mod_angle);} |
|
242 | 242 | padShape shape(){return p_shape;} |
|
243 | 243 | int padNumber(){return p_padNumber;} |
|
244 | 244 | void setNode(QIlib::AbstractNode* node); |
|
245 | 245 | private: |
|
246 | 246 | int p_padNumber; |
|
247 | 247 | padShape p_shape; |
|
248 | 248 | double p_drill; |
|
249 | 249 | double p_angle; |
|
250 | 250 | // Dirty fix to transform pad angle from |
|
251 | 251 | // PCB coordinates to Module coordinates |
|
252 | 252 | double p_Mod_angle; |
|
253 | 253 | QSizeF p_size; |
|
254 | 254 | QPointF p_pos; |
|
255 | 255 | QStringList p_layers; |
|
256 | 256 | }; |
|
257 | 257 | |
|
258 | 258 | class QIcadPcbFPLine : public QIcadAbstractPcbLine |
|
259 | 259 | { |
|
260 | 260 | public: |
|
261 | 261 | QIcadPcbFPLine(QIlib::AbstractNode* node); |
|
262 | 262 | QIcadPcbFPLine(){} |
|
263 | 263 | QIcadAbstractNodeWrapper start; |
|
264 | 264 | QIcadAbstractNodeWrapper end; |
|
265 | 265 | QIcadAbstractNodeWrapper layer; |
|
266 | 266 | QIcadAbstractNodeWrapper width; |
|
267 | 267 | void setNode(QIlib::AbstractNode* node); |
|
268 | 268 | }; |
|
269 | 269 | |
|
270 | 270 | class QIcadPcbFPCircle : public QIcadAbstractNodeWrapper |
|
271 | 271 | { |
|
272 | 272 | public: |
|
273 | 273 | QIcadPcbFPCircle(QIlib::AbstractNode* node); |
|
274 | 274 | QIcadPcbFPCircle(){} |
|
275 | 275 | QIcadAbstractNodeWrapper center; |
|
276 | 276 | QIcadAbstractNodeWrapper end; |
|
277 | 277 | QIcadAbstractNodeWrapper layer; |
|
278 | 278 | QIcadAbstractNodeWrapper width; |
|
279 | 279 | void setNode(QIlib::AbstractNode* node); |
|
280 | 280 | }; |
|
281 | 281 | |
|
282 | 282 | class QIcadPcbModule : public QIcadAbstractNodeWrapper |
|
283 | 283 | { |
|
284 | 284 | public: |
|
285 | 285 | QIcadPcbModule(QIlib::AbstractNode* node); |
|
286 | 286 | QIcadPcbModule(){} |
|
287 | 287 | const QPointF& pos(); |
|
288 | 288 | double angle(); |
|
289 | 289 | QIcadAbstractNodeWrapper layer; |
|
290 | 290 | QIcadAbstractNodeWrapper tedit; |
|
291 | 291 | QIcadAbstractNodeWrapper tstamp; |
|
292 | 292 | QIcadAbstractNodeWrapper at; |
|
293 | 293 | QIcadAbstractNodeWrapper descr; |
|
294 | 294 | QIcadAbstractNodeWrapper tags; |
|
295 | 295 | QIcadAbstractNodeWrapper path; |
|
296 | 296 | QIcadAbstractNodeWrapper attr; |
|
297 | 297 | QList<QIcadPcbFPText*> fp_texts; |
|
298 | 298 | QList<QIcadPcbFPLine*> fp_lines; |
|
299 | 299 | QList<QIcadPcbFPCircle*> fp_circles; |
|
300 | 300 | QList<QIcadPcbPad*> pads; |
|
301 | 301 | QIcadPcbModuleModel model; |
|
302 | 302 | void setNode(QIlib::AbstractNode* node); |
|
303 | 303 | void clrPads(); |
|
304 | 304 | void apendPad(QIlib::AbstractNode* node); |
|
305 | 305 | void clrTexts(); |
|
306 | 306 | void apendText(QIlib::AbstractNode* node); |
|
307 | 307 | void clrLines(); |
|
308 | 308 | void apendLine(QIlib::AbstractNode* node); |
|
309 | 309 | void clrCircles(); |
|
310 | 310 | void apendCircle(QIlib::AbstractNode* node); |
|
311 | 311 | private: |
|
312 | 312 | void updatePadsAngle(); |
|
313 | 313 | QPointF p_pos; |
|
314 | 314 | double p_angle; |
|
315 | 315 | }; |
|
316 | 316 | |
|
317 | 317 | class QIcadPcbSegment : public QIcadAbstractPcbLine |
|
318 | 318 | { |
|
319 | 319 | public: |
|
320 | 320 | QIcadPcbSegment(QIlib::AbstractNode* node); |
|
321 | 321 | QIcadPcbSegment(){} |
|
322 | 322 | QIcadAbstractNodeWrapper start; |
|
323 | 323 | QIcadAbstractNodeWrapper end; |
|
324 | 324 | QIcadAbstractNodeWrapper width; |
|
325 | 325 | QIcadAbstractNodeWrapper layer; |
|
326 | 326 | QIcadAbstractNodeWrapper net; |
|
327 | 327 | void setNode(QIlib::AbstractNode* node); |
|
328 | 328 | }; |
|
329 | 329 | |
|
330 | 330 | class QIcadPcbVia : public QIcadAbstractNodeWrapper |
|
331 | 331 | { |
|
332 | 332 | public: |
|
333 | 333 | QIcadPcbVia(QIlib::AbstractNode* node, double defaultDrill=0); |
|
334 | 334 | QIcadPcbVia(){} |
|
335 | 335 | QIcadAbstractNodeWrapper at; |
|
336 | 336 | QIcadAbstractNodeWrapper sizeNode; |
|
337 | 337 | QIcadAbstractNodeWrapper drillNode; |
|
338 | 338 | QIcadAbstractNodeWrapper layersNode; |
|
339 | 339 | QIcadAbstractNodeWrapper net; |
|
340 | 340 | QIcadAbstractNodeWrapper tstamp; |
|
341 | 341 | void setNode(QIlib::AbstractNode* node); |
|
342 | 342 | const QStringList& layers(){return p_layers;} |
|
343 | 343 | const QSizeF& size(){return p_size;} |
|
344 | 344 | const QPointF& pos(){return p_pos;} |
|
345 | 345 | double drill(){return p_drill;} |
|
346 | 346 | private: |
|
347 | 347 | double p_drill; |
|
348 | 348 | QSizeF p_size; |
|
349 | 349 | QPointF p_pos; |
|
350 | 350 | QStringList p_layers; |
|
351 | 351 | }; |
|
352 | 352 | |
|
353 | 353 | class QIcadPcbLine : public QIcadAbstractPcbLine |
|
354 | 354 | { |
|
355 | 355 | public: |
|
356 | 356 | QIcadPcbLine(QIlib::AbstractNode* node); |
|
357 | 357 | QIcadPcbLine(){} |
|
358 | 358 | QIcadAbstractNodeWrapper start; |
|
359 | 359 | QIcadAbstractNodeWrapper end; |
|
360 | 360 | QIcadAbstractNodeWrapper angle; |
|
361 | 361 | QIcadAbstractNodeWrapper layer; |
|
362 | 362 | QIcadAbstractNodeWrapper width; |
|
363 | 363 | void setNode(QIlib::AbstractNode* node); |
|
364 | 364 | }; |
|
365 | 365 | |
|
366 | ||
|
367 | class QIcadPcbPolygonPoint : public QIcadAbstractNodeWrapper | |
|
368 | { | |
|
369 | public: | |
|
370 | QIcadPcbPolygonPoint(QIlib::AbstractNode* node); | |
|
371 | QIcadPcbPolygonPoint(){} | |
|
372 | void setNode(QIlib::AbstractNode* node); | |
|
373 | const QPointF& pos(){return p_pos;} | |
|
374 | private: | |
|
375 | QPointF p_pos; | |
|
376 | }; | |
|
377 | ||
|
378 | ||
|
379 | class QIcadPcbPolygonPoints : public QIcadAbstractNodeWrapper | |
|
380 | { | |
|
381 | public: | |
|
382 | QIcadPcbPolygonPoints(QIlib::AbstractNode* node); | |
|
383 | QIcadPcbPolygonPoints(){} | |
|
384 | void setNode(QIlib::AbstractNode* node); | |
|
385 | QList<QIcadPcbPolygonPoint*> points; | |
|
386 | void clrPoints(); | |
|
387 | void apendPoint(QIlib::AbstractNode* node); | |
|
388 | private: | |
|
389 | QPointF p_pos; | |
|
390 | }; | |
|
391 | ||
|
392 | class QIcadPcbPolygon : public QIcadAbstractNodeWrapper | |
|
393 | { | |
|
394 | public: | |
|
395 | QIcadPcbPolygon(QIlib::AbstractNode* node); | |
|
396 | QIcadPcbPolygon(){} | |
|
397 | QIcadPcbPolygonPoints points; | |
|
398 | void setNode(QIlib::AbstractNode* node); | |
|
399 | bool isFilled(){return p_filled;} | |
|
400 | private: | |
|
401 | bool p_filled; | |
|
402 | }; | |
|
403 | ||
|
366 | 404 | class QIcadPcbZone : public QIcadAbstractNodeWrapper |
|
367 | 405 | { |
|
368 | 406 | public: |
|
369 | 407 | QIcadPcbZone(QIlib::AbstractNode* node); |
|
370 | 408 | QIcadPcbZone(){} |
|
409 | QIcadPcbPolygon polygon; | |
|
410 | QIcadPcbPolygon filledPolygon; | |
|
411 | QIcadAbstractNodeWrapper layer; | |
|
371 | 412 | void setNode(QIlib::AbstractNode* node); |
|
372 | 413 | }; |
|
373 | 414 | |
|
374 | 415 | class QIcadPcbArc : public QIcadAbstractNodeWrapper |
|
375 | 416 | { |
|
376 | 417 | public: |
|
377 | 418 | QIcadPcbArc(QIlib::AbstractNode* node); |
|
378 | 419 | QIcadPcbArc(){} |
|
379 | 420 | QIcadAbstractNodeWrapper start; |
|
380 | 421 | QIcadAbstractNodeWrapper end; |
|
381 | 422 | QIcadAbstractNodeWrapper angle; |
|
382 | 423 | QIcadAbstractNodeWrapper layer; |
|
383 | 424 | QIcadAbstractNodeWrapper width; |
|
384 | 425 | void setNode(QIlib::AbstractNode* node); |
|
385 | 426 | }; |
|
386 | 427 | |
|
387 | 428 | class QIcadPcbCircle : public QIcadAbstractNodeWrapper |
|
388 | 429 | { |
|
389 | 430 | public: |
|
390 | 431 | QIcadPcbCircle(QIlib::AbstractNode* node); |
|
391 | 432 | QIcadPcbCircle(){} |
|
392 | 433 | QIcadAbstractNodeWrapper center; |
|
393 | 434 | QIcadAbstractNodeWrapper end; |
|
394 | 435 | QIcadAbstractNodeWrapper layer; |
|
395 | 436 | QIcadAbstractNodeWrapper width; |
|
396 | 437 | void setNode(QIlib::AbstractNode* node); |
|
397 | 438 | }; |
|
398 | 439 | |
|
399 | 440 | class QIcadPcbText : public QIcadAbstractNodeWrapper |
|
400 | 441 | { |
|
401 | 442 | public: |
|
402 | 443 | QIcadPcbText(QIlib::AbstractNode* node); |
|
403 | 444 | QIcadPcbText(){} |
|
404 | 445 | QIcadAbstractNodeWrapper at; |
|
405 | 446 | QIcadAbstractNodeWrapper layer; |
|
406 | 447 | QIcadAbstractNodeWrapper width; |
|
407 | 448 | QIcadPcbFpTextEffects effects; |
|
408 | 449 | void setNode(QIlib::AbstractNode* node); |
|
409 | 450 | }; |
|
410 | 451 | |
|
411 | 452 | class QIcadPcbLayers : public QIcadAbstractNodeWrapper |
|
412 | 453 | { |
|
413 | 454 | public: |
|
414 | 455 | QIcadPcbLayers(QIlib::AbstractNode* node); |
|
415 | 456 | QIcadPcbLayers(){} |
|
416 | 457 | QList<QIcadPcbLayer*> layers; |
|
417 | 458 | void setNode(QIlib::AbstractNode* node); |
|
418 | 459 | void clrLayers(); |
|
419 | 460 | void apendLayer(QIlib::AbstractNode* node); |
|
420 | 461 | }; |
|
421 | 462 | |
|
422 | 463 | class QIcadPcbGeneralInfo : public QIcadAbstractNodeWrapper |
|
423 | 464 | { |
|
424 | 465 | public: |
|
425 | 466 | QIcadPcbGeneralInfo(QIlib::AbstractNode* node); |
|
426 | 467 | QIcadPcbGeneralInfo(){} |
|
427 | 468 | QIcadAbstractNodeWrapper links; |
|
428 | 469 | QIcadAbstractNodeWrapper no_connections; |
|
429 | 470 | QIcadAbstractNodeWrapper area; |
|
430 | 471 | QIcadAbstractNodeWrapper thickness; |
|
431 | 472 | QIcadAbstractNodeWrapper drawings; |
|
432 | 473 | QIcadAbstractNodeWrapper tracks; |
|
433 | 474 | QIcadAbstractNodeWrapper zones; |
|
434 | 475 | QIcadAbstractNodeWrapper modules; |
|
435 | 476 | QIcadAbstractNodeWrapper nets; |
|
436 | 477 | void setNode(QIlib::AbstractNode* node); |
|
437 | 478 | }; |
|
438 | 479 | |
|
439 | 480 | class QIcadPcbRoot : public QIcadAbstractNodeWrapper |
|
440 | 481 | { |
|
441 | 482 | public: |
|
442 | 483 | QIcadPcbRoot(QIlib::AbstractNode* node); |
|
443 | 484 | QIcadAbstractNodeWrapper version; |
|
444 | 485 | QIcadAbstractNodeWrapper host; |
|
445 | 486 | QIcadAbstractNodeWrapper page; |
|
446 | 487 | QIcadPcbGeneralInfo general; |
|
447 | 488 | QIcadPcbLayers layers; |
|
448 | 489 | QIcadPcbSetup setup; |
|
449 | 490 | QList<QIcadAbstractNodeWrapper*> nets; |
|
450 | 491 | QList<QIcadPcbModule*> modules; |
|
451 | 492 | QList<QIcadPcbDimension*> dimensions; |
|
452 | 493 | QList<QIcadPcbLine*> lines; |
|
453 | 494 | QList<QIcadPcbSegment*> segments; |
|
454 | 495 | QList<QIcadPcbVia*> vias; |
|
455 | 496 | QList<QIcadPcbArc*> arcs; |
|
456 | 497 | QList<QIcadPcbCircle*> circles; |
|
457 | 498 | QList<QIcadPcbText*> texts; |
|
458 | 499 | QList<QIcadPcbZone*> zones; |
|
459 | 500 | void setNode(QIlib::AbstractNode* node); |
|
460 | 501 | void clrNets(); |
|
461 | 502 | void apendNet(QIlib::AbstractNode* node); |
|
462 | 503 | void clrModules(); |
|
463 | 504 | void apendModule(QIlib::AbstractNode* node); |
|
464 | 505 | void clrDimensions(); |
|
465 | 506 | void apendDimension(QIlib::AbstractNode* node); |
|
466 | 507 | void apendLine(QIlib::AbstractNode* node); |
|
467 | 508 | void clrLines(); |
|
468 | 509 | void clrSegments(); |
|
469 | 510 | void apendSegment(QIlib::AbstractNode* node); |
|
470 | 511 | void clrVias(); |
|
471 | 512 | void apendVia(QIlib::AbstractNode* node); |
|
472 | 513 | void clrArcs(); |
|
473 | 514 | void apendArc(QIlib::AbstractNode* node); |
|
474 | 515 | void clrCircles(); |
|
475 | 516 | void apendCircle(QIlib::AbstractNode* node); |
|
476 | 517 | void clrTexts(); |
|
477 | 518 | void apendText(QIlib::AbstractNode* node); |
|
478 | 519 | void clrZones(); |
|
479 | 520 | void apendZone(QIlib::AbstractNode* node); |
|
480 | 521 | }; |
|
481 | 522 | |
|
482 | 523 | class QIcadPcb : private lispLike_Driver |
|
483 | 524 | { |
|
484 | 525 | public: |
|
485 | 526 | QIcadPcb(); |
|
486 | 527 | bool parsePcb(const QString& pcb); |
|
487 | 528 | QString toString(); |
|
488 | 529 | QString fileName; |
|
489 | 530 | QString print(); |
|
490 | 531 | |
|
491 | 532 | QIcadPcbRoot* pcbRoot; |
|
492 | 533 | private: |
|
493 | 534 | void updateConcreteTree(); |
|
494 | 535 | }; |
|
495 | 536 | |
|
496 | 537 | |
|
497 | 538 | } |
|
498 | 539 | #endif // QICADPCB_H |
@@ -1,42 +1,44 | |||
|
1 | 1 | #------------------------------------------------- |
|
2 | 2 | # |
|
3 | 3 | # Project created by QtCreator 2015-06-11T21:37:25 |
|
4 | 4 | # |
|
5 | 5 | #------------------------------------------------- |
|
6 | 6 | |
|
7 | 7 | QT += core gui opengl |
|
8 | 8 | CONFIG += qilib |
|
9 | 9 | |
|
10 | 10 | greaterThan(QT_MAJOR_VERSION, 4): QT += widgets |
|
11 | 11 | |
|
12 | 12 | TARGET = PCBView |
|
13 | 13 | TEMPLATE = app |
|
14 | 14 | |
|
15 | 15 | MOC_DIR = moc |
|
16 | 16 | RCC_DIR = resources |
|
17 | 17 | OBJECTS_DIR = obj |
|
18 | 18 | DESTDIR = ../../bin |
|
19 | 19 | |
|
20 | 20 | INCLUDEPATH += $$top_builddir/../../qilib \ |
|
21 | 21 | $$top_srcdir/../../qilib |
|
22 | 22 | |
|
23 | 23 | LIBS += -L../../bin -lQIlib |
|
24 | 24 | |
|
25 | 25 | SOURCES += main.cpp\ |
|
26 | 26 | mainwindow.cpp \ |
|
27 | 27 | pcbgraphicview.cpp \ |
|
28 | pcbrectpad.cpp \ | |
|
29 | 28 | pcbmodule.cpp \ |
|
30 | 29 | pcbline.cpp \ |
|
31 | 30 | pcbcontext.cpp \ |
|
32 | pcbvia.cpp | |
|
31 | pcbvia.cpp \ | |
|
32 | pcbpad.cpp \ | |
|
33 | pcbzone.cpp | |
|
33 | 34 | |
|
34 | 35 | HEADERS += mainwindow.h \ |
|
35 | 36 | pcbgraphicview.h \ |
|
36 | pcbrectpad.h \ | |
|
37 | 37 | pcbmodule.h \ |
|
38 | 38 | pcbline.h \ |
|
39 | 39 | pcbcontext.h \ |
|
40 | pcbvia.h | |
|
40 | pcbvia.h \ | |
|
41 | pcbpad.h \ | |
|
42 | pcbzone.h | |
|
41 | 43 | |
|
42 | 44 | FORMS += mainwindow.ui |
@@ -1,105 +1,108 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "mainwindow.h" |
|
23 | 23 | #include "ui_mainwindow.h" |
|
24 | 24 | #include "pcbmodule.h" |
|
25 | 25 | #include "pcbline.h" |
|
26 | 26 | #include "pcbvia.h" |
|
27 | #include "pcbzone.h" | |
|
27 | 28 | #include <QFileDialog> |
|
28 | 29 | |
|
29 | 30 | |
|
30 | 31 | MainWindow::MainWindow(QWidget *parent) : |
|
31 | 32 | QMainWindow(parent), |
|
32 | 33 | ui(new Ui::MainWindow) |
|
33 | 34 | { |
|
34 | 35 | ui->setupUi(this); |
|
35 | 36 | this->p_scene = new QGraphicsScene(); |
|
37 | // this->p_scene->setItemIndexMethod(QGraphicsScene::NoIndex); | |
|
36 | 38 | this->context = new PCBContext(); |
|
37 | 39 | this->ui->graphicsView->setScene(this->p_scene); |
|
38 | 40 | this->pcbDriver =NULL; |
|
39 | 41 | connect(this->ui->actionRedraw,SIGNAL(triggered(bool)),this,SLOT(redraw())); |
|
40 | 42 | connect(this->ui->actionOpen,SIGNAL(triggered(bool)),this,SLOT(openFile())); |
|
41 | 43 | } |
|
42 | 44 | |
|
43 | 45 | MainWindow::~MainWindow() |
|
44 | 46 | { |
|
45 | 47 | delete ui; |
|
46 | 48 | } |
|
47 | 49 | |
|
48 | 50 | void MainWindow::redraw() |
|
49 | 51 | { |
|
50 | 52 | this->p_scene->update(); |
|
51 | 53 | } |
|
52 | 54 | |
|
53 | 55 | void MainWindow::openFile() |
|
54 | 56 | { |
|
55 | 57 | QString file = QFileDialog::getOpenFileName(this,tr("Open kicad PCB file"), |
|
56 | 58 | "", |
|
57 | 59 | tr("PCB file (*.kicad_pcb)")); |
|
58 | 60 | if(QFile::exists(file)) |
|
59 | 61 | loadFile(file); |
|
60 | 62 | } |
|
61 | 63 | |
|
62 | 64 | void MainWindow::changeEvent(QEvent *e) |
|
63 | 65 | { |
|
64 | 66 | QMainWindow::changeEvent(e); |
|
65 | 67 | switch (e->type()) { |
|
66 | 68 | case QEvent::LanguageChange: |
|
67 | 69 | ui->retranslateUi(this); |
|
68 | 70 | break; |
|
69 | 71 | default: |
|
70 | 72 | break; |
|
71 | 73 | } |
|
72 | 74 | } |
|
73 | 75 | |
|
74 | 76 | void MainWindow::loadFile(const QString &file) |
|
75 | 77 | { |
|
76 | 78 | this->p_scene->setSceneRect(0, 0, 500, 200); |
|
77 | 79 | if(pcbDriver!=NULL)delete pcbDriver; |
|
78 | 80 | pcbDriver = new QIlib::QIcadPcb(); |
|
79 | 81 | this->context->clear(); |
|
80 | 82 | this->p_scene->clear(); |
|
81 | // pcbDriver.parsePcb("/opt/kicadTools/test/testFiles/pcb2.kicad_pcb"); | |
|
82 | // pcbDriver.parsePcb("/home/jeandet/Documents/PCB/ADC_STAMP/ADC_STAMP.kicad_pcb"); | |
|
83 | 83 | pcbDriver->parsePcb(file); |
|
84 | // pcbDriver.parsePcb("/usr/share/kicad/demos/kit-dev-coldfire-xilinx_5213/kit-dev-coldfire-xilinx_5213.kicad_pcb"); | |
|
85 | 84 | for(int i=0;i<pcbDriver->pcbRoot->layers.layers.count();i++) |
|
86 | 85 | { |
|
87 | 86 | this->context->addlayer(pcbDriver->pcbRoot->layers.layers.at(i)->name(),pcbDriver->pcbRoot->layers.layers.at(i)->index()); |
|
88 | 87 | } |
|
89 | 88 | for(int i=0;i<pcbDriver->pcbRoot->modules.count();i++) |
|
90 | 89 | { |
|
91 | 90 | this->p_scene->addItem(new PCBModule(pcbDriver->pcbRoot->modules.at(i),this->context)); |
|
92 | 91 | } |
|
93 | 92 | for(int i=0;i<pcbDriver->pcbRoot->lines.count();i++) |
|
94 | 93 | { |
|
95 | 94 | this->p_scene->addItem(new PCBLine((QIlib::QIcadAbstractPcbLine*)pcbDriver->pcbRoot->lines.at(i),this->context)); |
|
96 | 95 | } |
|
97 | 96 | for(int i=0;i<pcbDriver->pcbRoot->segments.count();i++) |
|
98 | 97 | { |
|
99 | 98 | this->p_scene->addItem(new PCBLine((QIlib::QIcadAbstractPcbLine*)pcbDriver->pcbRoot->segments.at(i),this->context)); |
|
100 | 99 | } |
|
101 | 100 | for(int i=0;i<pcbDriver->pcbRoot->vias.count();i++) |
|
102 | 101 | { |
|
103 | 102 | this->p_scene->addItem(new PCBVia(pcbDriver->pcbRoot->vias.at(i),this->context)); |
|
104 | 103 | } |
|
104 | for(int i=0;i<pcbDriver->pcbRoot->zones.count();i++) | |
|
105 | { | |
|
106 | this->p_scene->addItem(new PCBZone(pcbDriver->pcbRoot->zones.at(i),this->context)); | |
|
107 | } | |
|
105 | 108 | } |
@@ -1,145 +1,147 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "pcbgraphicview.h" |
|
23 | 23 | |
|
24 | 24 | #include <math.h> |
|
25 | 25 | #include <QGLWidget> |
|
26 | #include <QOpenGLWidget> | |
|
27 | #include <QPixmapCache> | |
|
26 | 28 | |
|
27 | 29 | PCBGraphicView::PCBGraphicView(QWidget *parent) |
|
28 | 30 | :QGraphicsView(parent) |
|
29 | 31 | { |
|
30 | ||
|
31 | 32 | this->setRenderHint(QPainter::Antialiasing, true); |
|
32 | 33 | this->setDragMode(QGraphicsView::RubberBandDrag); |
|
33 | 34 | this->setOptimizationFlags(QGraphicsView::DontSavePainterState); |
|
34 | 35 | this->setViewportUpdateMode(QGraphicsView::SmartViewportUpdate); |
|
35 | 36 | |
|
36 | 37 | this->setContextMenuPolicy(Qt::ActionsContextMenu); |
|
37 | 38 | this->setTransformationAnchor(AnchorUnderMouse); |
|
38 | 39 | this->scale(qreal(0.8), qreal(0.8)); |
|
39 | 40 | this->setRubberBandSelectionMode(Qt::ContainsItemBoundingRect); |
|
40 | this->setDragMode(RubberBandDrag); | |
|
41 | 41 | this->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
42 | 42 | this->setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); |
|
43 | ||
|
43 | // this->setViewport(new QOpenGLWidget()); | |
|
44 | QPixmapCache::setCacheLimit(1024*1024*4); | |
|
44 | 45 | this->ctrl_pressed = false; |
|
45 | 46 | this->shift_pressed = false; |
|
46 | 47 | } |
|
47 | 48 | |
|
48 | 49 | |
|
49 | 50 | void PCBGraphicView::keyPressEvent(QKeyEvent *event) |
|
50 | 51 | { |
|
51 | 52 | switch (event->key()) { |
|
52 | 53 | case Qt::Key_Plus: |
|
53 | 54 | zoomIn(); |
|
54 | 55 | break; |
|
55 | 56 | case Qt::Key_Minus: |
|
56 | 57 | zoomOut(); |
|
57 | 58 | break; |
|
58 | 59 | case Qt::Key_Shift: |
|
59 | 60 | this->shift_pressed = true; |
|
60 | 61 | break; |
|
61 | 62 | case Qt::Key_Control: |
|
62 | 63 | this->ctrl_pressed = true; |
|
63 | 64 | break; |
|
64 | 65 | default: |
|
65 | 66 | QGraphicsView::keyPressEvent(event); |
|
66 | 67 | } |
|
67 | 68 | } |
|
68 | 69 | |
|
69 | 70 | void PCBGraphicView::keyReleaseEvent(QKeyEvent *event) |
|
70 | 71 | { |
|
71 | 72 | switch (event->key()) { |
|
72 | 73 | case Qt::Key_Shift: |
|
73 | 74 | this->shift_pressed = false; |
|
74 | 75 | break; |
|
75 | 76 | case Qt::Key_Control: |
|
76 | 77 | this->ctrl_pressed = false; |
|
77 | 78 | break; |
|
78 | 79 | default: |
|
79 | 80 | QGraphicsView::keyReleaseEvent(event); |
|
80 | 81 | } |
|
81 | 82 | } |
|
82 | 83 | |
|
83 | 84 | void PCBGraphicView::wheelEvent(QWheelEvent *event) |
|
84 | 85 | { |
|
85 | ||
|
86 | if (event->modifiers() & Qt::ControlModifier) | |
|
87 | { | |
|
88 | if (event->orientation()== Qt::Vertical) | |
|
89 | scaleView(pow((double)2, event->delta() / 240.0)); | |
|
90 | } | |
|
91 | else | |
|
92 | { | |
|
93 | if (event->modifiers() & Qt::ShiftModifier) | |
|
86 | if (event->modifiers() & Qt::ControlModifier) | |
|
94 | 87 | { |
|
95 | QWheelEvent* tempevent = new QWheelEvent(event->pos(),(event->delta()/10),event->buttons(),event->modifiers(),Qt::Horizontal); | |
|
96 | QGraphicsView::wheelEvent(tempevent); | |
|
88 | event->accept(); | |
|
89 | if (event->orientation()== Qt::Vertical) | |
|
90 | scaleView(pow((double)2, event->delta() / 240.0)); | |
|
97 | 91 | } |
|
98 | 92 | else |
|
99 | QGraphicsView::wheelEvent(event); | |
|
100 | } | |
|
93 | { | |
|
94 | if (event->modifiers() & Qt::ShiftModifier) | |
|
95 | { | |
|
96 | event->accept(); | |
|
97 | QWheelEvent* tempevent = new QWheelEvent(event->pos(),(event->delta()/10),event->buttons(),event->modifiers(),Qt::Horizontal); | |
|
98 | QGraphicsView::wheelEvent(tempevent); | |
|
99 | } | |
|
100 | else | |
|
101 | QGraphicsView::wheelEvent(event); | |
|
102 | } | |
|
101 | 103 | } |
|
102 | 104 | |
|
103 | 105 | |
|
104 | 106 | |
|
105 | 107 | void PCBGraphicView::drawBackground(QPainter *painter, const QRectF &rect) |
|
106 | 108 | { |
|
107 | 109 | Q_UNUSED(rect); |
|
108 | 110 | |
|
109 | 111 | // Shadow |
|
110 | 112 | QRectF sceneRect = this->sceneRect(); |
|
111 | 113 | QRectF rightShadow(sceneRect.right(), sceneRect.top() + 20, 20, sceneRect.height()); |
|
112 | 114 | QRectF bottomShadow(sceneRect.left() + 20, sceneRect.bottom(), sceneRect.width(), 20); |
|
113 | 115 | if (rightShadow.intersects(rect) || rightShadow.contains(rect)) |
|
114 | 116 | painter->fillRect(rightShadow, Qt::darkGray); |
|
115 | 117 | if (bottomShadow.intersects(rect) || bottomShadow.contains(rect)) |
|
116 | 118 | painter->fillRect(bottomShadow, Qt::darkGray); |
|
117 | 119 | |
|
118 | 120 | // Fill |
|
119 | 121 | QLinearGradient gradient(sceneRect.topLeft(), sceneRect.bottomRight()); |
|
120 | 122 | gradient.setColorAt(0, Qt::white); |
|
121 | 123 | gradient.setColorAt(1, Qt::lightGray); |
|
122 | 124 | painter->fillRect(rect.intersected(sceneRect), gradient); |
|
123 | 125 | painter->setBrush(Qt::NoBrush); |
|
124 | 126 | painter->drawRect(sceneRect); |
|
125 | 127 | } |
|
126 | 128 | |
|
127 | 129 | |
|
128 | 130 | void PCBGraphicView::scaleView(qreal scaleFactor) |
|
129 | 131 | { |
|
130 | 132 | qreal factor = transform().scale(scaleFactor, scaleFactor).mapRect(QRectF(0, 0, 1, 1)).width(); |
|
131 | 133 | if (factor < 0.02 || factor > 1000) |
|
132 | 134 | return; |
|
133 | 135 | scale(scaleFactor, scaleFactor); |
|
134 | 136 | } |
|
135 | 137 | |
|
136 | 138 | |
|
137 | 139 | void PCBGraphicView::zoomIn() |
|
138 | 140 | { |
|
139 | 141 | scaleView(qreal(1.2)); |
|
140 | 142 | } |
|
141 | 143 | |
|
142 | 144 | void PCBGraphicView::zoomOut() |
|
143 | 145 | { |
|
144 | 146 | scaleView(1 / qreal(1.2)); |
|
145 | 147 | } |
@@ -1,54 +1,55 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #ifndef PCBGRAPHICVIEW_H |
|
23 | 23 | #define PCBGRAPHICVIEW_H |
|
24 | 24 | |
|
25 | 25 | #include <QGraphicsView> |
|
26 | 26 | #include <QObject> |
|
27 | 27 | #include <QWidget> |
|
28 | 28 | #include <QKeyEvent> |
|
29 | 29 | #include <QPainter> |
|
30 | 30 | #include <QMap> |
|
31 | #include <QElapsedTimer> | |
|
31 | 32 | |
|
32 | 33 | class PCBGraphicView : public QGraphicsView |
|
33 | 34 | { |
|
34 | 35 | public: |
|
35 | 36 | PCBGraphicView(QWidget *parent = 0); |
|
36 | 37 | void itemMoved(); |
|
37 | 38 | |
|
38 | 39 | public slots: |
|
39 | 40 | void zoomIn(); |
|
40 | 41 | void zoomOut(); |
|
41 | 42 | |
|
42 | 43 | protected: |
|
43 | 44 | void keyPressEvent(QKeyEvent *event); |
|
44 | 45 | void keyReleaseEvent(QKeyEvent *event); |
|
45 | 46 | void wheelEvent(QWheelEvent *event); |
|
46 | 47 | void drawBackground(QPainter *painter, const QRectF &rect); |
|
47 | 48 | |
|
48 | 49 | void scaleView(qreal scaleFactor); |
|
49 | 50 | private: |
|
50 | 51 | bool ctrl_pressed; |
|
51 | 52 | bool shift_pressed; |
|
52 | 53 | }; |
|
53 | 54 | |
|
54 | 55 | #endif // PCBGRAPHICVIEW_H |
@@ -1,44 +1,42 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "pcbmodule.h" |
|
23 | 23 | #include "pcbline.h" |
|
24 |
#include "pcb |
|
|
24 | #include "pcbpad.h" | |
|
25 | 25 | |
|
26 | 26 | PCBModule::PCBModule(QIlib::QIcadPcbModule *moduleNode, PCBContext *context) |
|
27 | 27 | :QGraphicsItemGroup(),context(context) |
|
28 | 28 | { |
|
29 | 29 | this->setCacheMode(QGraphicsItem::DeviceCoordinateCache); |
|
30 | 30 | this->setFlags(ItemIsMovable|ItemIsSelectable|ItemIsFocusable); |
|
31 | // this->setFlag(QGraphicsItem::ItemSendsGeometryChanges, true); | |
|
32 | // this->addToGroup(new QGraphicsRectItem(0,0,2,2)); | |
|
33 | 31 | this->setPos(moduleNode->pos()); |
|
34 | 32 | for(int i=0;i<moduleNode->fp_lines.count();i++) |
|
35 | 33 | { |
|
36 | 34 | this->addToGroup(new PCBLine((QIlib::QIcadAbstractPcbLine*)moduleNode->fp_lines.at(i),moduleNode->pos(),context)); |
|
37 | 35 | } |
|
38 | 36 | for(int i=0;i<moduleNode->pads.count();i++) |
|
39 | 37 | { |
|
40 |
this->addToGroup(new PCB |
|
|
38 | this->addToGroup(new PCBPad((QIlib::QIcadPcbPad*)moduleNode->pads.at(i),moduleNode->pos(),context)); | |
|
41 | 39 | } |
|
42 | 40 | this->setRotation(moduleNode->angle()); |
|
43 | 41 | } |
|
44 | 42 |
@@ -1,88 +1,88 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 |
#include "pcb |
|
|
22 | #include "pcbpad.h" | |
|
23 | 23 | #include <QPen> |
|
24 | 24 | |
|
25 |
PCB |
|
|
25 | PCBPad::PCBPad(QIlib::QIcadPcbPad *padNode, PCBContext *context) | |
|
26 | 26 | :QGraphicsItemGroup(),padNode(padNode),context(context) |
|
27 | 27 | { |
|
28 | 28 | this->init(QPointF(0.0,0.0)); |
|
29 | 29 | } |
|
30 | 30 | |
|
31 | 31 | |
|
32 | 32 | |
|
33 |
PCB |
|
|
33 | PCBPad::PCBPad(QIlib::QIcadPcbPad *padNode, QPointF offset, PCBContext *context) | |
|
34 | 34 | :QGraphicsItemGroup(),padNode(padNode),context(context) |
|
35 | 35 | { |
|
36 | 36 | this->init(offset); |
|
37 | 37 | } |
|
38 | 38 | |
|
39 |
void PCB |
|
|
39 | void PCBPad::init( QPointF offset) | |
|
40 | 40 | { |
|
41 | 41 | this->setCacheMode(QGraphicsItem::DeviceCoordinateCache); |
|
42 | 42 | offset-=QPointF(this->padNode->size().width()/2,this->padNode->size().height()/2); |
|
43 | 43 | if(this->padNode->shape()==QIlib::QIcadPcbPad::rectangle) |
|
44 | 44 | { |
|
45 | 45 | QRectF rec(this->padNode->pos()+offset,this->padNode->size()); |
|
46 | 46 | for(int i=0;i<this->padNode->layers().count();i++) |
|
47 | 47 | { |
|
48 | 48 | QGraphicsRectItem* rect = new QGraphicsRectItem(); |
|
49 | 49 | rect->setTransformOriginPoint(rec.center()); |
|
50 | 50 | QPen pen = rect->pen(); |
|
51 | 51 | pen.setWidthF(0.01); |
|
52 | 52 | rect->setPen(pen); |
|
53 | 53 | QBrush brush = rect->brush(); |
|
54 | 54 | brush.setStyle(Qt::SolidPattern); |
|
55 | 55 | brush.setColor(context->layerColor(this->padNode->layers().at(i))); |
|
56 | 56 | rect->setBrush(brush); |
|
57 | 57 | rect->setRect(rec); |
|
58 | 58 | rect->setZValue(-context->layer(padNode->layers().at(i))); |
|
59 | 59 | rect->setRotation(padNode->angle()); |
|
60 | 60 | this->addToGroup(rect); |
|
61 | 61 | } |
|
62 | 62 | QGraphicsTextItem* text=new QGraphicsTextItem(QString::number(padNode->padNumber())); |
|
63 | 63 | text->setPos(rec.center()); |
|
64 | 64 | text->setScale(0.01); |
|
65 | 65 | text->setZValue(1); |
|
66 | 66 | this->addToGroup(text); |
|
67 | 67 | |
|
68 | 68 | } |
|
69 | 69 | if(this->padNode->shape()==QIlib::QIcadPcbPad::circle) |
|
70 | 70 | { |
|
71 | 71 | for(int i=0;i<this->padNode->layers().count();i++) |
|
72 | 72 | { |
|
73 | 73 | QGraphicsEllipseItem* ellipse = new QGraphicsEllipseItem(); |
|
74 | 74 | QPen pen = ellipse->pen(); |
|
75 | 75 | pen.setWidthF(0.01); |
|
76 | 76 | ellipse->setPen(pen); |
|
77 | 77 | QBrush brush = ellipse->brush(); |
|
78 | 78 | brush.setStyle(Qt::SolidPattern); |
|
79 | 79 | brush.setColor(context->layerColor(this->padNode->layers().at(i))); |
|
80 | 80 | ellipse->setBrush(brush); |
|
81 | 81 | QRectF rec(this->padNode->pos()+offset,this->padNode->size()); |
|
82 | 82 | ellipse->setRect(rec); |
|
83 | 83 | ellipse->setZValue(-context->layer(padNode->layers().at(i))); |
|
84 | 84 | this->addToGroup(ellipse); |
|
85 | 85 | } |
|
86 | 86 | } |
|
87 | 87 | setOpacity(0.6); |
|
88 | 88 | } |
@@ -1,48 +1,48 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 |
#ifndef PCB |
|
|
23 |
#define PCB |
|
|
22 | #ifndef PCBPAD_H | |
|
23 | #define PCBPAD_H | |
|
24 | 24 | |
|
25 | 25 | #include <QObject> |
|
26 | 26 | #include <QWidget> |
|
27 | 27 | #include <QGraphicsRectItem> |
|
28 | 28 | #include <QGraphicsItemGroup> |
|
29 | 29 | #include <pcbcontext.h> |
|
30 | 30 | #include <qicadpcb.h> |
|
31 | 31 | |
|
32 |
class PCB |
|
|
32 | class PCBPad : public QGraphicsItemGroup | |
|
33 | 33 | { |
|
34 | 34 | public: |
|
35 |
PCB |
|
|
36 |
PCB |
|
|
35 | PCBPad(QIlib::QIcadPcbPad* padNode,PCBContext* context); | |
|
36 | PCBPad(QIlib::QIcadPcbPad* padNode,QPointF offset,PCBContext* context); | |
|
37 | 37 | |
|
38 | 38 | private: |
|
39 | 39 | void init(QPointF offset); |
|
40 | 40 | QIlib::QIcadPcbPad* padNode; |
|
41 | 41 | QString name; |
|
42 | 42 | QPointF pos; |
|
43 | 43 | QRectF size; |
|
44 | 44 | QList<int> layers; |
|
45 | 45 | PCBContext* context; |
|
46 | 46 | }; |
|
47 | 47 | |
|
48 |
#endif // PCB |
|
|
48 | #endif // PCBPAD_H |
@@ -1,66 +1,66 | |||
|
1 | 1 | /*------------------------------------------------------------------------------ |
|
2 | 2 | -- This file is a part of the Kicad Tools Software |
|
3 | 3 | -- Copyright (C) 2015, Plasma Physics Laboratory - CNRS |
|
4 | 4 | -- |
|
5 | 5 | -- This program is free software; you can redistribute it and/or modify |
|
6 | 6 | -- it under the terms of the GNU General Public License as published by |
|
7 | 7 | -- the Free Software Foundation; either version 2 of the License, or |
|
8 | 8 | -- (at your option) any later version. |
|
9 | 9 | -- |
|
10 | 10 | -- This program is distributed in the hope that it will be useful, |
|
11 | 11 | -- but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
12 | 12 | -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
13 | 13 | -- GNU General Public License for more details. |
|
14 | 14 | -- |
|
15 | 15 | -- You should have received a copy of the GNU General Public License |
|
16 | 16 | -- along with this program; if not, write to the Free Software |
|
17 | 17 | -- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
|
18 | 18 | -------------------------------------------------------------------------------*/ |
|
19 | 19 | /*-- Author : Alexis Jeandet |
|
20 | 20 | -- Mail : alexis.jeandet@member.fsf.org |
|
21 | 21 | ----------------------------------------------------------------------------*/ |
|
22 | 22 | #include "pcbvia.h" |
|
23 | 23 | #include <QPen> |
|
24 | 24 | |
|
25 | 25 | |
|
26 | 26 | PCBVia::PCBVia(QIlib::QIcadPcbVia *viaNode, PCBContext *context) |
|
27 | 27 | :QGraphicsItemGroup(),viaNode(viaNode),context(context) |
|
28 | 28 | { |
|
29 | 29 | this->init(QPointF(0.0,0.0)); |
|
30 | 30 | } |
|
31 | 31 | |
|
32 | 32 | PCBVia::PCBVia(QIlib::QIcadPcbVia *viaNode, QPointF offset, PCBContext *context) |
|
33 | 33 | :QGraphicsItemGroup(),viaNode(viaNode),context(context) |
|
34 | 34 | { |
|
35 | 35 | this->init(offset); |
|
36 | 36 | } |
|
37 | 37 | |
|
38 | 38 | void PCBVia::init(QPointF offset) |
|
39 | 39 | { |
|
40 | this->setCacheMode(QGraphicsItem::DeviceCoordinateCache); | |
|
41 | this->setFlags(ItemIsMovable|ItemIsSelectable|ItemIsFocusable); | |
|
40 | 42 | this->path.addEllipse(this->viaNode->pos(),this->viaNode->size().width()/2,this->viaNode->size().height()/2); |
|
41 | 43 | double thickness = (this->viaNode->size().width()-this->viaNode->drill())/2; |
|
42 | 44 | this->path.addEllipse(this->viaNode->pos(),(this->viaNode->size().width()/2)-thickness,(this->viaNode->size().height()/2)-thickness); |
|
43 | this->setCacheMode(QGraphicsItem::DeviceCoordinateCache); | |
|
44 | this->setFlags(ItemIsMovable|ItemIsSelectable|ItemIsFocusable); | |
|
45 | 45 | offset-=QPointF(this->viaNode->size().width()/2,this->viaNode->size().height()/2); |
|
46 | 46 | |
|
47 | 47 | for(int i=0;i<this->viaNode->layers().count();i++) |
|
48 | 48 | { |
|
49 | 49 | QGraphicsPathItem* pathitem = new QGraphicsPathItem(); |
|
50 | 50 | QPen pen = pathitem->pen(); |
|
51 | 51 | pen.setWidthF(0.01); |
|
52 | 52 | |
|
53 | 53 | pathitem->setPen(pen); |
|
54 | 54 | QBrush brush = pathitem->brush(); |
|
55 | 55 | brush.setStyle(Qt::SolidPattern); |
|
56 | 56 | brush.setColor(context->layerColor(this->viaNode->layers().at(i))); |
|
57 | 57 | pathitem->setBrush(brush); |
|
58 | 58 | // QRectF rec(this->viaNode->pos()+offset,QSizeF(this->viaNode->size().width()-thickness,this->viaNode->size().width()-thickness)); |
|
59 | 59 | // pathitem->setRect(rec); |
|
60 | 60 | pathitem->setZValue(-context->layer(viaNode->layers().at(i))); |
|
61 | 61 | pathitem->setPath(path); |
|
62 | 62 | this->addToGroup(pathitem); |
|
63 | 63 | } |
|
64 | 64 | |
|
65 | 65 | setOpacity(0.6); |
|
66 | 66 | } |
General Comments 0
You need to be logged in to leave comments.
Login now