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