##// END OF EJS Templates
Non working pad rendering.. Rotation issue.
jeandet -
r12:93ef9e74723d default
parent child
Show More
@@ -1,1183 +1,1184
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)
458 :QIcadAbstractNodeWrapper(node)
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 }
501 }
502 }
502 }
503 if(node->nodes.at(i)->name==QIlib::Lexique::tags_c)
503 if(node->nodes.at(i)->name==QIlib::Lexique::tags_c)
504 {
504 {
505 this->tags.setNode(node->nodes.at(i));
505 this->tags.setNode(node->nodes.at(i));
506 }
506 }
507 if(node->nodes.at(i)->name==QIlib::Lexique::path_c)
507 if(node->nodes.at(i)->name==QIlib::Lexique::path_c)
508 {
508 {
509 this->path.setNode(node->nodes.at(i));
509 this->path.setNode(node->nodes.at(i));
510 }
510 }
511 if(node->nodes.at(i)->name==QIlib::Lexique::attr_c)
511 if(node->nodes.at(i)->name==QIlib::Lexique::attr_c)
512 {
512 {
513 this->attr.setNode(node->nodes.at(i));
513 this->attr.setNode(node->nodes.at(i));
514 }
514 }
515 if(node->nodes.at(i)->name==QIlib::Lexique::pad_c)
515 if(node->nodes.at(i)->name==QIlib::Lexique::pad_c)
516 {
516 {
517 this->apendPad(node->nodes.at(i));
517 this->apendPad(node->nodes.at(i));
518 }
518 }
519 if(node->nodes.at(i)->name==QIlib::Lexique::fp_line_c)
519 if(node->nodes.at(i)->name==QIlib::Lexique::fp_line_c)
520 {
520 {
521 this->apendLine(node->nodes.at(i));
521 this->apendLine(node->nodes.at(i));
522 }
522 }
523 if(node->nodes.at(i)->name==QIlib::Lexique::fp_text_c)
523 if(node->nodes.at(i)->name==QIlib::Lexique::fp_text_c)
524 {
524 {
525 this->apendText(node->nodes.at(i));
525 this->apendText(node->nodes.at(i));
526 }
526 }
527 if(node->nodes.at(i)->name==QIlib::Lexique::fp_circle_c)
527 if(node->nodes.at(i)->name==QIlib::Lexique::fp_circle_c)
528 {
528 {
529 this->apendCircle(node->nodes.at(i));
529 this->apendCircle(node->nodes.at(i));
530 }
530 }
531 }
531 }
532 }
532 }
533 }
533 }
534
534
535 void QIlib::QIcadPcbModule::clrPads()
535 void QIlib::QIcadPcbModule::clrPads()
536 {
536 {
537 while(pads.count())
537 while(pads.count())
538 {
538 {
539 QIcadPcbPad* pad;
539 QIcadPcbPad* pad;
540 pad = pads.last();
540 pad = pads.last();
541 pads.removeLast();
541 pads.removeLast();
542 delete pad;
542 delete pad;
543 }
543 }
544 }
544 }
545
545
546 void QIlib::QIcadPcbModule::apendPad(QIlib::AbstractNode *node)
546 void QIlib::QIcadPcbModule::apendPad(QIlib::AbstractNode *node)
547 {
547 {
548 if(node->name==QIlib::Lexique::pad_c)
548 if(node->name==QIlib::Lexique::pad_c)
549 {
549 {
550 this->pads.append(new QIcadPcbPad(node));
550 this->pads.append(new QIcadPcbPad(node));
551 }
551 }
552 }
552 }
553
553
554 void QIlib::QIcadPcbModule::clrTexts()
554 void QIlib::QIcadPcbModule::clrTexts()
555 {
555 {
556 while(fp_texts.count())
556 while(fp_texts.count())
557 {
557 {
558 QIcadPcbFPText* text;
558 QIcadPcbFPText* text;
559 text = fp_texts.last();
559 text = fp_texts.last();
560 fp_texts.removeLast();
560 fp_texts.removeLast();
561 delete text;
561 delete text;
562 }
562 }
563 }
563 }
564
564
565 void QIlib::QIcadPcbModule::apendText(QIlib::AbstractNode *node)
565 void QIlib::QIcadPcbModule::apendText(QIlib::AbstractNode *node)
566 {
566 {
567 if(node->name==QIlib::Lexique::fp_text_c)
567 if(node->name==QIlib::Lexique::fp_text_c)
568 {
568 {
569 this->fp_texts.append(new QIcadPcbFPText(node));
569 this->fp_texts.append(new QIcadPcbFPText(node));
570 }
570 }
571 }
571 }
572
572
573 void QIlib::QIcadPcbModule::clrLines()
573 void QIlib::QIcadPcbModule::clrLines()
574 {
574 {
575 while(fp_lines.count())
575 while(fp_lines.count())
576 {
576 {
577 QIcadPcbFPLine* line;
577 QIcadPcbFPLine* line;
578 line = fp_lines.last();
578 line = fp_lines.last();
579 fp_lines.removeLast();
579 fp_lines.removeLast();
580 delete line;
580 delete line;
581 }
581 }
582 }
582 }
583
583
584 void QIlib::QIcadPcbModule::apendLine(QIlib::AbstractNode *node)
584 void QIlib::QIcadPcbModule::apendLine(QIlib::AbstractNode *node)
585 {
585 {
586 if(node->name==QIlib::Lexique::fp_line_c)
586 if(node->name==QIlib::Lexique::fp_line_c)
587 {
587 {
588 this->fp_lines.append(new QIcadPcbFPLine(node));
588 this->fp_lines.append(new QIcadPcbFPLine(node));
589 }
589 }
590 }
590 }
591
591
592 void QIlib::QIcadPcbModule::clrCircles()
592 void QIlib::QIcadPcbModule::clrCircles()
593 {
593 {
594 while(fp_circles.count())
594 while(fp_circles.count())
595 {
595 {
596 QIcadPcbFPCircle* circle;
596 QIcadPcbFPCircle* circle;
597 circle = fp_circles.last();
597 circle = fp_circles.last();
598 fp_circles.removeLast();
598 fp_circles.removeLast();
599 delete circle;
599 delete circle;
600 }
600 }
601 }
601 }
602
602
603 void QIlib::QIcadPcbModule::apendCircle(QIlib::AbstractNode *node)
603 void QIlib::QIcadPcbModule::apendCircle(QIlib::AbstractNode *node)
604 {
604 {
605 if(node->name==QIlib::Lexique::fp_circle_c)
605 if(node->name==QIlib::Lexique::fp_circle_c)
606 {
606 {
607 this->fp_circles.append(new QIcadPcbFPCircle(node));
607 this->fp_circles.append(new QIcadPcbFPCircle(node));
608 }
608 }
609 }
609 }
610
610
611
611
612 QIlib::QIcadPcbDimension::QIcadPcbDimension(QIlib::AbstractNode *node)
612 QIlib::QIcadPcbDimension::QIcadPcbDimension(QIlib::AbstractNode *node)
613 :QIcadAbstractNodeWrapper(node)
613 :QIcadAbstractNodeWrapper(node)
614 {
614 {
615 this->setNode(node);
615 this->setNode(node);
616 }
616 }
617
617
618 void QIlib::QIcadPcbDimension::setNode(QIlib::AbstractNode *node)
618 void QIlib::QIcadPcbDimension::setNode(QIlib::AbstractNode *node)
619 {
619 {
620 if(node->name==QIlib::Lexique::dimension_c)
620 if(node->name==QIlib::Lexique::dimension_c)
621 {
621 {
622 this->p_node = node;
622 this->p_node = node;
623 for(int i=0;i<node->nodes.count();i++)
623 for(int i=0;i<node->nodes.count();i++)
624 {
624 {
625 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
625 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
626 {
626 {
627 this->width.setNode(node->nodes.at(i));
627 this->width.setNode(node->nodes.at(i));
628 }
628 }
629 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
629 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
630 {
630 {
631 this->layer.setNode(node->nodes.at(i));
631 this->layer.setNode(node->nodes.at(i));
632 }
632 }
633 if(node->nodes.at(i)->name==QIlib::Lexique::gr_text_c)
633 if(node->nodes.at(i)->name==QIlib::Lexique::gr_text_c)
634 {
634 {
635 this->gr_text.setNode(node->nodes.at(i));
635 this->gr_text.setNode(node->nodes.at(i));
636 }
636 }
637 if(node->nodes.at(i)->name==QIlib::Lexique::feature1_c)
637 if(node->nodes.at(i)->name==QIlib::Lexique::feature1_c)
638 {
638 {
639 this->feature1.setNode(node->nodes.at(i));
639 this->feature1.setNode(node->nodes.at(i));
640 }
640 }
641 if(node->nodes.at(i)->name==QIlib::Lexique::crossbar_c)
641 if(node->nodes.at(i)->name==QIlib::Lexique::crossbar_c)
642 {
642 {
643 this->crossbar.setNode(node->nodes.at(i));
643 this->crossbar.setNode(node->nodes.at(i));
644 }
644 }
645 if(node->nodes.at(i)->name==QIlib::Lexique::arrow1a_c)
645 if(node->nodes.at(i)->name==QIlib::Lexique::arrow1a_c)
646 {
646 {
647 this->arrow1a.setNode(node->nodes.at(i));
647 this->arrow1a.setNode(node->nodes.at(i));
648 }
648 }
649 if(node->nodes.at(i)->name==QIlib::Lexique::arrow1b_c)
649 if(node->nodes.at(i)->name==QIlib::Lexique::arrow1b_c)
650 {
650 {
651 this->arrow1b.setNode(node->nodes.at(i));
651 this->arrow1b.setNode(node->nodes.at(i));
652 }
652 }
653 if(node->nodes.at(i)->name==QIlib::Lexique::arrow2a_c)
653 if(node->nodes.at(i)->name==QIlib::Lexique::arrow2a_c)
654 {
654 {
655 this->arrow2a.setNode(node->nodes.at(i));
655 this->arrow2a.setNode(node->nodes.at(i));
656 }
656 }
657 if(node->nodes.at(i)->name==QIlib::Lexique::arrow2b_c)
657 if(node->nodes.at(i)->name==QIlib::Lexique::arrow2b_c)
658 {
658 {
659 this->arrow2b.setNode(node->nodes.at(i));
659 this->arrow2b.setNode(node->nodes.at(i));
660 }
660 }
661 }
661 }
662 }
662 }
663 }
663 }
664
664
665
665
666 QIlib::QIcadPcbModuleModel::QIcadPcbModuleModel(QIlib::AbstractNode *node)
666 QIlib::QIcadPcbModuleModel::QIcadPcbModuleModel(QIlib::AbstractNode *node)
667 :QIcadAbstractNodeWrapper(node)
667 :QIcadAbstractNodeWrapper(node)
668 {
668 {
669 this->setNode(node);
669 this->setNode(node);
670 }
670 }
671
671
672 void QIlib::QIcadPcbModuleModel::setNode(QIlib::AbstractNode *node)
672 void QIlib::QIcadPcbModuleModel::setNode(QIlib::AbstractNode *node)
673 {
673 {
674 this->p_node = node;
674 this->p_node = node;
675 }
675 }
676
676
677
677
678 QIlib::QIcadPcbFPText::QIcadPcbFPText(QIlib::AbstractNode *node)
678 QIlib::QIcadPcbFPText::QIcadPcbFPText(QIlib::AbstractNode *node)
679 :QIcadAbstractNodeWrapper(node)
679 :QIcadAbstractNodeWrapper(node)
680 {
680 {
681 this->setNode(node);
681 this->setNode(node);
682 }
682 }
683
683
684 void QIlib::QIcadPcbFPText::setNode(QIlib::AbstractNode *node)
684 void QIlib::QIcadPcbFPText::setNode(QIlib::AbstractNode *node)
685 {
685 {
686 if(node->name==QIlib::Lexique::pad_c)
686 if(node->name==QIlib::Lexique::pad_c)
687 {
687 {
688 this->p_node = node;
688 this->p_node = node;
689 for(int i=0;i<node->nodes.count();i++)
689 for(int i=0;i<node->nodes.count();i++)
690 {
690 {
691 if(node->nodes.at(i)->name==QIlib::Lexique::at_c)
691 if(node->nodes.at(i)->name==QIlib::Lexique::at_c)
692 {
692 {
693 this->at.setNode(node->nodes.at(i));
693 this->at.setNode(node->nodes.at(i));
694 }
694 }
695 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
695 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
696 {
696 {
697 this->layer.setNode(node->nodes.at(i));
697 this->layer.setNode(node->nodes.at(i));
698 }
698 }
699 if(node->nodes.at(i)->name==QIlib::Lexique::effects_c)
699 if(node->nodes.at(i)->name==QIlib::Lexique::effects_c)
700 {
700 {
701 this->effects.setNode(node->nodes.at(i));
701 this->effects.setNode(node->nodes.at(i));
702 }
702 }
703 }
703 }
704 }
704 }
705 }
705 }
706
706
707
707
708 QIlib::QIcadPcbFpTextEffects::QIcadPcbFpTextEffects(QIlib::AbstractNode *node)
708 QIlib::QIcadPcbFpTextEffects::QIcadPcbFpTextEffects(QIlib::AbstractNode *node)
709 :QIcadAbstractNodeWrapper(node)
709 :QIcadAbstractNodeWrapper(node)
710 {
710 {
711 this->setNode(node);
711 this->setNode(node);
712 }
712 }
713
713
714 void QIlib::QIcadPcbFpTextEffects::setNode(QIlib::AbstractNode *node)
714 void QIlib::QIcadPcbFpTextEffects::setNode(QIlib::AbstractNode *node)
715 {
715 {
716 this->p_node = node;
716 this->p_node = node;
717 }
717 }
718
718
719
719
720 QIlib::QIcadPcbFpTextEffectsFont::QIcadPcbFpTextEffectsFont(QIlib::AbstractNode *node)
720 QIlib::QIcadPcbFpTextEffectsFont::QIcadPcbFpTextEffectsFont(QIlib::AbstractNode *node)
721 :QIcadAbstractNodeWrapper(node)
721 :QIcadAbstractNodeWrapper(node)
722 {
722 {
723 this->setNode(node);
723 this->setNode(node);
724 }
724 }
725
725
726 void QIlib::QIcadPcbFpTextEffectsFont::setNode(QIlib::AbstractNode *node)
726 void QIlib::QIcadPcbFpTextEffectsFont::setNode(QIlib::AbstractNode *node)
727 {
727 {
728 this->p_node = node;
728 this->p_node = node;
729 }
729 }
730
730
731
731
732 QIlib::QIcadPcbNetClass::QIcadPcbNetClass(QIlib::AbstractNode *node)
732 QIlib::QIcadPcbNetClass::QIcadPcbNetClass(QIlib::AbstractNode *node)
733 :QIcadAbstractNodeWrapper(node)
733 :QIcadAbstractNodeWrapper(node)
734 {
734 {
735 this->setNode(node);
735 this->setNode(node);
736 }
736 }
737
737
738 void QIlib::QIcadPcbNetClass::setNode(QIlib::AbstractNode *node)
738 void QIlib::QIcadPcbNetClass::setNode(QIlib::AbstractNode *node)
739 {
739 {
740 this->p_node = node;
740 this->p_node = node;
741 }
741 }
742
742
743
743
744 QIlib::QIcadPcbSetup::QIcadPcbSetup(QIlib::AbstractNode *node)
744 QIlib::QIcadPcbSetup::QIcadPcbSetup(QIlib::AbstractNode *node)
745 :QIcadAbstractNodeWrapper(node)
745 :QIcadAbstractNodeWrapper(node)
746 {
746 {
747 this->setNode(node);
747 this->setNode(node);
748 }
748 }
749
749
750 void QIlib::QIcadPcbSetup::setNode(QIlib::AbstractNode *node)
750 void QIlib::QIcadPcbSetup::setNode(QIlib::AbstractNode *node)
751 {
751 {
752 if(node->name==QIlib::Lexique::setup_c)
752 if(node->name==QIlib::Lexique::setup_c)
753 {
753 {
754 this->p_node = node;
754 this->p_node = node;
755 for(int i=0;i<node->nodes.count();i++)
755 for(int i=0;i<node->nodes.count();i++)
756 {
756 {
757 if(node->nodes.at(i)->name==QIlib::Lexique::via_drill_c)
757 if(node->nodes.at(i)->name==QIlib::Lexique::via_drill_c)
758 {
758 {
759 this->via_dril.setNode(node->nodes.at(i));
759 this->via_dril.setNode(node->nodes.at(i));
760 this->p_defaultViaDrillSize = nodeValueToDouble(node->nodes.at(i));
760 this->p_defaultViaDrillSize = nodeValueToDouble(node->nodes.at(i));
761 }
761 }
762 }
762 }
763 }
763 }
764 }
764 }
765
765
766
766
767 QIlib::QIcadPcbPlotParams::QIcadPcbPlotParams(QIlib::AbstractNode *node)
767 QIlib::QIcadPcbPlotParams::QIcadPcbPlotParams(QIlib::AbstractNode *node)
768 :QIcadAbstractNodeWrapper(node)
768 :QIcadAbstractNodeWrapper(node)
769 {
769 {
770 this->setNode(node);
770 this->setNode(node);
771 }
771 }
772
772
773 void QIlib::QIcadPcbPlotParams::setNode(QIlib::AbstractNode *node)
773 void QIlib::QIcadPcbPlotParams::setNode(QIlib::AbstractNode *node)
774 {
774 {
775 this->p_node = node;
775 this->p_node = node;
776 }
776 }
777
777
778
778
779 QIlib::QIcadPcbSegment::QIcadPcbSegment(QIlib::AbstractNode *node)
779 QIlib::QIcadPcbSegment::QIcadPcbSegment(QIlib::AbstractNode *node)
780 :QIcadAbstractPcbLine(node)
780 :QIcadAbstractPcbLine(node)
781 {
781 {
782 this->setNode(node);
782 this->setNode(node);
783 }
783 }
784
784
785 void QIlib::QIcadPcbSegment::setNode(QIlib::AbstractNode *node)
785 void QIlib::QIcadPcbSegment::setNode(QIlib::AbstractNode *node)
786 {
786 {
787 if(node->name==QIlib::Lexique::segment_c)
787 if(node->name==QIlib::Lexique::segment_c)
788 {
788 {
789 this->p_node = node;
789 this->p_node = node;
790 for(int i=0;i<node->nodes.count();i++)
790 for(int i=0;i<node->nodes.count();i++)
791 {
791 {
792 if(node->nodes.at(i)->name==QIlib::Lexique::start_c)
792 if(node->nodes.at(i)->name==QIlib::Lexique::start_c)
793 {
793 {
794 this->p_startpos = nodeTo2DCoords(node->nodes.at(i));
794 this->p_startpos = nodeTo2DCoords(node->nodes.at(i));
795 this->start.setNode(node->nodes.at(i));
795 this->start.setNode(node->nodes.at(i));
796 }
796 }
797 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
797 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
798 {
798 {
799 this->p_stoppos = nodeTo2DCoords(node->nodes.at(i));
799 this->p_stoppos = nodeTo2DCoords(node->nodes.at(i));
800 this->end.setNode(node->nodes.at(i));
800 this->end.setNode(node->nodes.at(i));
801 }
801 }
802 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
802 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
803 {
803 {
804 this->p_width = nodeValueToDouble(node->nodes.at(i));
804 this->p_width = nodeValueToDouble(node->nodes.at(i));
805 this->width.setNode(node->nodes.at(i));
805 this->width.setNode(node->nodes.at(i));
806 }
806 }
807 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
807 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
808 {
808 {
809 this->p_layers = node->nodes.at(i)->Values;
809 this->p_layers = node->nodes.at(i)->Values;
810 this->layer.setNode(node->nodes.at(i));
810 this->layer.setNode(node->nodes.at(i));
811 }
811 }
812 if(node->nodes.at(i)->name==QIlib::Lexique::net_c)
812 if(node->nodes.at(i)->name==QIlib::Lexique::net_c)
813 {
813 {
814 this->net.setNode(node->nodes.at(i));
814 this->net.setNode(node->nodes.at(i));
815 }
815 }
816 }
816 }
817 }
817 }
818 }
818 }
819
819
820
820
821 QIlib::QIcadPcbVia::QIcadPcbVia(QIlib::AbstractNode *node, double defaultDrill)
821 QIlib::QIcadPcbVia::QIcadPcbVia(QIlib::AbstractNode *node, double defaultDrill)
822 :QIcadAbstractNodeWrapper(node),p_drill(defaultDrill)
822 :QIcadAbstractNodeWrapper(node),p_drill(defaultDrill)
823 {
823 {
824 this->setNode(node);
824 this->setNode(node);
825 }
825 }
826
826
827 void QIlib::QIcadPcbVia::setNode(QIlib::AbstractNode *node)
827 void QIlib::QIcadPcbVia::setNode(QIlib::AbstractNode *node)
828 {
828 {
829 if(node->name==QIlib::Lexique::via_c)
829 if(node->name==QIlib::Lexique::via_c)
830 {
830 {
831 this->p_node = node;
831 this->p_node = node;
832 for(int i=0;i<node->nodes.count();i++)
832 for(int i=0;i<node->nodes.count();i++)
833 {
833 {
834 if(node->nodes.at(i)->name==QIlib::Lexique::at_c)
834 if(node->nodes.at(i)->name==QIlib::Lexique::at_c)
835 {
835 {
836 this->at.setNode(node->nodes.at(i));
836 this->at.setNode(node->nodes.at(i));
837 p_pos = nodeTo2DCoords(node->nodes.at(i));
837 p_pos = nodeTo2DCoords(node->nodes.at(i));
838 }
838 }
839 if(node->nodes.at(i)->name==QIlib::Lexique::size_c)
839 if(node->nodes.at(i)->name==QIlib::Lexique::size_c)
840 {
840 {
841 this->sizeNode.setNode(node->nodes.at(i));
841 this->sizeNode.setNode(node->nodes.at(i));
842 p_size = QSizeF(nodeValueToDouble(node->nodes.at(i)),nodeValueToDouble(node->nodes.at(i)));
842 p_size = QSizeF(nodeValueToDouble(node->nodes.at(i)),nodeValueToDouble(node->nodes.at(i)));
843 }
843 }
844 if(node->nodes.at(i)->name==QIlib::Lexique::drill_c)
844 if(node->nodes.at(i)->name==QIlib::Lexique::drill_c)
845 {
845 {
846 this->drillNode.setNode(node->nodes.at(i));
846 this->drillNode.setNode(node->nodes.at(i));
847 p_drill = nodeValueToDouble(node->nodes.at(i));
847 p_drill = nodeValueToDouble(node->nodes.at(i));
848 }
848 }
849 if(node->nodes.at(i)->name==QIlib::Lexique::layers_c)
849 if(node->nodes.at(i)->name==QIlib::Lexique::layers_c)
850 {
850 {
851 this->layersNode.setNode(node->nodes.at(i));
851 this->layersNode.setNode(node->nodes.at(i));
852 p_layers = node->nodes.at(i)->Values;
852 p_layers = node->nodes.at(i)->Values;
853 }
853 }
854 if(node->nodes.at(i)->name==QIlib::Lexique::net_c)
854 if(node->nodes.at(i)->name==QIlib::Lexique::net_c)
855 {
855 {
856 this->net.setNode(node->nodes.at(i));
856 this->net.setNode(node->nodes.at(i));
857 }
857 }
858 if(node->nodes.at(i)->name==QIlib::Lexique::tstamp_c)
858 if(node->nodes.at(i)->name==QIlib::Lexique::tstamp_c)
859 {
859 {
860 this->tstamp.setNode(node->nodes.at(i));
860 this->tstamp.setNode(node->nodes.at(i));
861 }
861 }
862 }
862 }
863 }
863 }
864 }
864 }
865
865
866
866
867 QIlib::QIcadPcbPad::QIcadPcbPad(QIlib::AbstractNode *node)
867 QIlib::QIcadPcbPad::QIcadPcbPad(QIlib::AbstractNode *node)
868 :QIcadAbstractNodeWrapper(node)
868 :QIcadAbstractNodeWrapper(node)
869 {
869 {
870 this->setNode(node);
870 this->setNode(node);
871 }
871 }
872
872
873 void QIlib::QIcadPcbPad::setNode(QIlib::AbstractNode *node)
873 void QIlib::QIcadPcbPad::setNode(QIlib::AbstractNode *node)
874 {
874 {
875 if(node->name==QIlib::Lexique::pad_c)
875 if(node->name==QIlib::Lexique::pad_c)
876 {
876 {
877 this->p_node = node;
877 this->p_node = node;
878 if(p_node->Values.count()>=3)
878 if(p_node->Values.count()>=3)
879 {
879 {
880 if(!this->p_node->Values.at((2)).compare("rect"))
880 if(!this->p_node->Values.at((2)).compare("rect"))
881 {
881 {
882 this->p_shape = rectangle;
882 this->p_shape = rectangle;
883 }
883 }
884 else
884 else
885 if(!this->p_node->Values.at((2)).compare("circle"))
885 if(!this->p_node->Values.at((2)).compare("circle"))
886 {
886 {
887 this->p_shape = circle;
887 this->p_shape = circle;
888 }
888 }
889
889 this->p_padNumber = nodeValueToInt(node,0);
890 }
890 }
891 for(int i=0;i<node->nodes.count();i++)
891 for(int i=0;i<node->nodes.count();i++)
892 {
892 {
893 if(node->nodes.at(i)->name==QIlib::Lexique::at_c)
893 if(node->nodes.at(i)->name==QIlib::Lexique::at_c)
894 {
894 {
895 this->at.setNode(node->nodes.at(i));
895 this->at.setNode(node->nodes.at(i));
896 this->p_pos = nodeTo2DCoords(node->nodes.at(i));
896 this->p_pos = nodeTo2DCoords(node->nodes.at(i));
897 this->p_angle = nodeValueToDouble(node->nodes.at(i),2);
897 }
898 }
898 if(node->nodes.at(i)->name==QIlib::Lexique::size_c)
899 if(node->nodes.at(i)->name==QIlib::Lexique::size_c)
899 {
900 {
900 this->sizeNode.setNode(node->nodes.at(i));
901 this->sizeNode.setNode(node->nodes.at(i));
901 this->p_size = nodeTo2DSize(node->nodes.at(i));
902 this->p_size = nodeTo2DSize(node->nodes.at(i));
902 }
903 }
903 if(node->nodes.at(i)->name==QIlib::Lexique::layers_c)
904 if(node->nodes.at(i)->name==QIlib::Lexique::layers_c)
904 {
905 {
905 this->layer.setNode(node->nodes.at(i));
906 this->layer.setNode(node->nodes.at(i));
906 this->p_layers = node->nodes.at(i)->Values;
907 this->p_layers = node->nodes.at(i)->Values;
907 }
908 }
908 if(node->nodes.at(i)->name==QIlib::Lexique::net_c)
909 if(node->nodes.at(i)->name==QIlib::Lexique::net_c)
909 {
910 {
910 this->netNode.setNode(node->nodes.at(i));
911 this->netNode.setNode(node->nodes.at(i));
911 }
912 }
912 if(node->nodes.at(i)->name==QIlib::Lexique::drill_c)
913 if(node->nodes.at(i)->name==QIlib::Lexique::drill_c)
913 {
914 {
914 this->drillNode.setNode(node->nodes.at(i));
915 this->drillNode.setNode(node->nodes.at(i));
915 this->p_drill = nodeValueToDouble(node->nodes.at(i));
916 this->p_drill = nodeValueToDouble(node->nodes.at(i));
916 }
917 }
917 }
918 }
918 }
919 }
919 }
920 }
920
921
921
922
922 QIlib::QIcadPcbFPLine::QIcadPcbFPLine(QIlib::AbstractNode *node)
923 QIlib::QIcadPcbFPLine::QIcadPcbFPLine(QIlib::AbstractNode *node)
923 :QIcadAbstractPcbLine(node)
924 :QIcadAbstractPcbLine(node)
924 {
925 {
925 this->setNode(node);
926 this->setNode(node);
926 }
927 }
927
928
928 void QIlib::QIcadPcbFPLine::setNode(QIlib::AbstractNode *node)
929 void QIlib::QIcadPcbFPLine::setNode(QIlib::AbstractNode *node)
929 {
930 {
930 if(node->name==QIlib::Lexique::fp_line_c)
931 if(node->name==QIlib::Lexique::fp_line_c)
931 {
932 {
932 this->p_node = node;
933 this->p_node = node;
933 for(int i=0;i<node->nodes.count();i++)
934 for(int i=0;i<node->nodes.count();i++)
934 {
935 {
935 if(node->nodes.at(i)->name==QIlib::Lexique::start_c)
936 if(node->nodes.at(i)->name==QIlib::Lexique::start_c)
936 {
937 {
937 this->p_startpos = nodeTo2DCoords(node->nodes.at(i));
938 this->p_startpos = nodeTo2DCoords(node->nodes.at(i));
938 this->start.setNode(node->nodes.at(i));
939 this->start.setNode(node->nodes.at(i));
939 }
940 }
940 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
941 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
941 {
942 {
942 this->p_stoppos = nodeTo2DCoords(node->nodes.at(i));
943 this->p_stoppos = nodeTo2DCoords(node->nodes.at(i));
943 this->end.setNode(node->nodes.at(i));
944 this->end.setNode(node->nodes.at(i));
944 }
945 }
945 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
946 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
946 {
947 {
947 this->p_layers = node->nodes.at(i)->Values;
948 this->p_layers = node->nodes.at(i)->Values;
948 this->layer.setNode(node->nodes.at(i));
949 this->layer.setNode(node->nodes.at(i));
949 }
950 }
950 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
951 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
951 {
952 {
952 this->p_width = nodeValueToDouble(node->nodes.at(i));
953 this->p_width = nodeValueToDouble(node->nodes.at(i));
953 this->width.setNode(node->nodes.at(i));
954 this->width.setNode(node->nodes.at(i));
954 }
955 }
955 }
956 }
956 }
957 }
957 }
958 }
958
959
959
960
960 QIlib::QIcadPcbFPCircle::QIcadPcbFPCircle(QIlib::AbstractNode *node)
961 QIlib::QIcadPcbFPCircle::QIcadPcbFPCircle(QIlib::AbstractNode *node)
961 :QIcadAbstractNodeWrapper(node)
962 :QIcadAbstractNodeWrapper(node)
962 {
963 {
963 this->setNode(node);
964 this->setNode(node);
964 }
965 }
965
966
966 void QIlib::QIcadPcbFPCircle::setNode(QIlib::AbstractNode *node)
967 void QIlib::QIcadPcbFPCircle::setNode(QIlib::AbstractNode *node)
967 {
968 {
968 if(node->name==QIlib::Lexique::fp_circle_c)
969 if(node->name==QIlib::Lexique::fp_circle_c)
969 {
970 {
970 this->p_node = node;
971 this->p_node = node;
971 for(int i=0;i<node->nodes.count();i++)
972 for(int i=0;i<node->nodes.count();i++)
972 {
973 {
973 if(node->nodes.at(i)->name==QIlib::Lexique::center_c)
974 if(node->nodes.at(i)->name==QIlib::Lexique::center_c)
974 {
975 {
975 this->center.setNode(node->nodes.at(i));
976 this->center.setNode(node->nodes.at(i));
976 }
977 }
977 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
978 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
978 {
979 {
979 this->end.setNode(node->nodes.at(i));
980 this->end.setNode(node->nodes.at(i));
980 }
981 }
981 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
982 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
982 {
983 {
983 this->layer.setNode(node->nodes.at(i));
984 this->layer.setNode(node->nodes.at(i));
984 }
985 }
985 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
986 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
986 {
987 {
987 this->width.setNode(node->nodes.at(i));
988 this->width.setNode(node->nodes.at(i));
988 }
989 }
989 }
990 }
990 }
991 }
991 }
992 }
992
993
993
994
994 QIlib::QIcadPcbText::QIcadPcbText(QIlib::AbstractNode *node)
995 QIlib::QIcadPcbText::QIcadPcbText(QIlib::AbstractNode *node)
995 :QIcadAbstractNodeWrapper(node)
996 :QIcadAbstractNodeWrapper(node)
996 {
997 {
997 this->setNode(node);
998 this->setNode(node);
998 }
999 }
999
1000
1000 void QIlib::QIcadPcbText::setNode(QIlib::AbstractNode *node)
1001 void QIlib::QIcadPcbText::setNode(QIlib::AbstractNode *node)
1001 {
1002 {
1002 if(node->name==QIlib::Lexique::gr_text_c)
1003 if(node->name==QIlib::Lexique::gr_text_c)
1003 {
1004 {
1004 this->p_node = node;
1005 this->p_node = node;
1005 for(int i=0;i<node->nodes.count();i++)
1006 for(int i=0;i<node->nodes.count();i++)
1006 {
1007 {
1007 if(node->nodes.at(i)->name==QIlib::Lexique::at_c)
1008 if(node->nodes.at(i)->name==QIlib::Lexique::at_c)
1008 {
1009 {
1009 this->at.setNode(node->nodes.at(i));
1010 this->at.setNode(node->nodes.at(i));
1010 }
1011 }
1011 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
1012 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
1012 {
1013 {
1013 this->layer.setNode(node->nodes.at(i));
1014 this->layer.setNode(node->nodes.at(i));
1014 }
1015 }
1015 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
1016 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
1016 {
1017 {
1017 this->width.setNode(node->nodes.at(i));
1018 this->width.setNode(node->nodes.at(i));
1018 }
1019 }
1019 if(node->nodes.at(i)->name==QIlib::Lexique::effects_c)
1020 if(node->nodes.at(i)->name==QIlib::Lexique::effects_c)
1020 {
1021 {
1021 this->effects.setNode(node->nodes.at(i));
1022 this->effects.setNode(node->nodes.at(i));
1022 }
1023 }
1023 }
1024 }
1024 }
1025 }
1025 }
1026 }
1026
1027
1027
1028
1028 QIlib::QIcadPcbCircle::QIcadPcbCircle(QIlib::AbstractNode *node)
1029 QIlib::QIcadPcbCircle::QIcadPcbCircle(QIlib::AbstractNode *node)
1029 :QIcadAbstractNodeWrapper(node)
1030 :QIcadAbstractNodeWrapper(node)
1030 {
1031 {
1031 this->setNode(node);
1032 this->setNode(node);
1032 }
1033 }
1033
1034
1034 void QIlib::QIcadPcbCircle::setNode(QIlib::AbstractNode *node)
1035 void QIlib::QIcadPcbCircle::setNode(QIlib::AbstractNode *node)
1035 {
1036 {
1036 if(node->name==QIlib::Lexique::gr_circle_c)
1037 if(node->name==QIlib::Lexique::gr_circle_c)
1037 {
1038 {
1038 this->p_node = node;
1039 this->p_node = node;
1039 for(int i=0;i<node->nodes.count();i++)
1040 for(int i=0;i<node->nodes.count();i++)
1040 {
1041 {
1041 if(node->nodes.at(i)->name==QIlib::Lexique::center_c)
1042 if(node->nodes.at(i)->name==QIlib::Lexique::center_c)
1042 {
1043 {
1043 this->center.setNode(node->nodes.at(i));
1044 this->center.setNode(node->nodes.at(i));
1044 }
1045 }
1045 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
1046 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
1046 {
1047 {
1047 this->end.setNode(node->nodes.at(i));
1048 this->end.setNode(node->nodes.at(i));
1048 }
1049 }
1049 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
1050 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
1050 {
1051 {
1051 this->layer.setNode(node->nodes.at(i));
1052 this->layer.setNode(node->nodes.at(i));
1052 }
1053 }
1053 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
1054 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
1054 {
1055 {
1055 this->width.setNode(node->nodes.at(i));
1056 this->width.setNode(node->nodes.at(i));
1056 }
1057 }
1057 }
1058 }
1058 }
1059 }
1059 }
1060 }
1060
1061
1061
1062
1062 QIlib::QIcadPcbArc::QIcadPcbArc(QIlib::AbstractNode *node)
1063 QIlib::QIcadPcbArc::QIcadPcbArc(QIlib::AbstractNode *node)
1063 :QIcadAbstractNodeWrapper(node)
1064 :QIcadAbstractNodeWrapper(node)
1064 {
1065 {
1065 this->setNode(node);
1066 this->setNode(node);
1066 }
1067 }
1067
1068
1068 void QIlib::QIcadPcbArc::setNode(QIlib::AbstractNode *node)
1069 void QIlib::QIcadPcbArc::setNode(QIlib::AbstractNode *node)
1069 {
1070 {
1070 if(node->name==QIlib::Lexique::gr_arc_c)
1071 if(node->name==QIlib::Lexique::gr_arc_c)
1071 {
1072 {
1072 this->p_node = node;
1073 this->p_node = node;
1073 for(int i=0;i<node->nodes.count();i++)
1074 for(int i=0;i<node->nodes.count();i++)
1074 {
1075 {
1075 if(node->nodes.at(i)->name==QIlib::Lexique::start_c)
1076 if(node->nodes.at(i)->name==QIlib::Lexique::start_c)
1076 {
1077 {
1077 this->start.setNode(node->nodes.at(i));
1078 this->start.setNode(node->nodes.at(i));
1078 }
1079 }
1079 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
1080 if(node->nodes.at(i)->name==QIlib::Lexique::end_c)
1080 {
1081 {
1081 this->end.setNode(node->nodes.at(i));
1082 this->end.setNode(node->nodes.at(i));
1082 }
1083 }
1083 if(node->nodes.at(i)->name==QIlib::Lexique::angle_c)
1084 if(node->nodes.at(i)->name==QIlib::Lexique::angle_c)
1084 {
1085 {
1085 this->angle.setNode(node->nodes.at(i));
1086 this->angle.setNode(node->nodes.at(i));
1086 }
1087 }
1087 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
1088 if(node->nodes.at(i)->name==QIlib::Lexique::layer_c)
1088 {
1089 {
1089 this->layer.setNode(node->nodes.at(i));
1090 this->layer.setNode(node->nodes.at(i));
1090 }
1091 }
1091 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
1092 if(node->nodes.at(i)->name==QIlib::Lexique::width_c)
1092 {
1093 {
1093 this->width.setNode(node->nodes.at(i));
1094 this->width.setNode(node->nodes.at(i));
1094 }
1095 }
1095 }
1096 }
1096 }
1097 }
1097 }
1098 }
1098
1099
1099
1100
1100 QIlib::QIcadPcbZone::QIcadPcbZone(QIlib::AbstractNode *node)
1101 QIlib::QIcadPcbZone::QIcadPcbZone(QIlib::AbstractNode *node)
1101 :QIcadAbstractNodeWrapper(node)
1102 :QIcadAbstractNodeWrapper(node)
1102 {
1103 {
1103 this->setNode(node);
1104 this->setNode(node);
1104 }
1105 }
1105
1106
1106 void QIlib::QIcadPcbZone::setNode(QIlib::AbstractNode *node)
1107 void QIlib::QIcadPcbZone::setNode(QIlib::AbstractNode *node)
1107 {
1108 {
1108 if(node->name==QIlib::Lexique::zone_c)
1109 if(node->name==QIlib::Lexique::zone_c)
1109 {
1110 {
1110 this->p_node = node;
1111 this->p_node = node;
1111 }
1112 }
1112 }
1113 }
1113
1114
1114
1115
1115 const QPointF QIlib::nodeTo2DCoords(QIlib::AbstractNode *node)
1116 const QPointF QIlib::nodeTo2DCoords(QIlib::AbstractNode *node)
1116 {
1117 {
1117 QPointF point;
1118 QPointF point;
1118 QStringList coords=node->Values;
1119 QStringList coords=node->Values;
1119 if(coords.count()>=2)
1120 if(coords.count()>=2)
1120 {
1121 {
1121 point.setX(coords.at(0).toDouble());
1122 point.setX(coords.at(0).toDouble());
1122 point.setY(coords.at(1).toDouble());
1123 point.setY(coords.at(1).toDouble());
1123 }
1124 }
1124 return point;
1125 return point;
1125 }
1126 }
1126
1127
1127
1128
1128 double QIlib::nodeValueToDouble(QIlib::AbstractNode *node, int index)
1129 double QIlib::nodeValueToDouble(QIlib::AbstractNode *node, int index)
1129 {
1130 {
1130 if(node->Values.count()>index)
1131 if(node->Values.count()>index)
1131 {
1132 {
1132 return node->Values.at(index).toDouble();
1133 return node->Values.at(index).toDouble();
1133 }
1134 }
1134 return 0.0;
1135 return 0.0;
1135 }
1136 }
1136
1137
1137
1138
1138 int QIlib::nodeValueToInt(QIlib::AbstractNode *node, int index)
1139 int QIlib::nodeValueToInt(QIlib::AbstractNode *node, int index)
1139 {
1140 {
1140 if(node->Values.count()>index)
1141 if(node->Values.count()>index)
1141 {
1142 {
1142 return node->Values.at(index).toInt();
1143 return node->Values.at(index).toInt();
1143 }
1144 }
1144 return 0;
1145 return 0;
1145 }
1146 }
1146
1147
1147
1148
1148 QIlib::QIcadPcbLayer::QIcadPcbLayer(QIlib::AbstractNode *node)
1149 QIlib::QIcadPcbLayer::QIcadPcbLayer(QIlib::AbstractNode *node)
1149 :QIcadAbstractNodeWrapper(node)
1150 :QIcadAbstractNodeWrapper(node)
1150 {
1151 {
1151 this->p_index = QString(this->p_node->name).remove('(').toInt();
1152 this->p_index = QString(this->p_node->name).remove('(').toInt();
1152 if(this->p_node->Values.count()>=1)
1153 if(this->p_node->Values.count()>=1)
1153 {
1154 {
1154 this->p_name = this->p_node->Values.at(0);
1155 this->p_name = this->p_node->Values.at(0);
1155 }
1156 }
1156 if(this->p_node->Values.count()>=2)
1157 if(this->p_node->Values.count()>=2)
1157 {
1158 {
1158 QString typestr=this->p_node->Values.at(1);
1159 QString typestr=this->p_node->Values.at(1);
1159 this->p_type = none;
1160 this->p_type = none;
1160 if(!typestr.compare("signal"))
1161 if(!typestr.compare("signal"))
1161 {
1162 {
1162 this->p_type = signal;
1163 this->p_type = signal;
1163 }
1164 }
1164 else
1165 else
1165 if(!typestr.compare("user"))
1166 if(!typestr.compare("user"))
1166 {
1167 {
1167 this->p_type = user;
1168 this->p_type = user;
1168 }
1169 }
1169 }
1170 }
1170 }
1171 }
1171
1172
1172
1173
1173 const QSizeF QIlib::nodeTo2DSize(QIlib::AbstractNode *node)
1174 const QSizeF QIlib::nodeTo2DSize(QIlib::AbstractNode *node)
1174 {
1175 {
1175 QSizeF size;
1176 QSizeF size;
1176 QStringList sz=node->Values;
1177 QStringList sz=node->Values;
1177 if(sz.count()>=2)
1178 if(sz.count()>=2)
1178 {
1179 {
1179 size.setWidth(sz.at(0).toDouble());
1180 size.setWidth(sz.at(0).toDouble());
1180 size.setHeight(sz.at(1).toDouble());
1181 size.setHeight(sz.at(1).toDouble());
1181 }
1182 }
1182 return size;
1183 return size;
1183 }
1184 }
@@ -1,490 +1,494
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
34
35 const QPointF nodeTo2DCoords(QIlib::AbstractNode* node);
35 const QPointF nodeTo2DCoords(QIlib::AbstractNode* node);
36 const QSizeF nodeTo2DSize(QIlib::AbstractNode* node);
36 const QSizeF nodeTo2DSize(QIlib::AbstractNode* node);
37 double nodeValueToDouble(QIlib::AbstractNode* node,int index=0);
37 double nodeValueToDouble(QIlib::AbstractNode* node,int index=0);
38 int nodeValueToInt(QIlib::AbstractNode* node,int index=0);
38 int nodeValueToInt(QIlib::AbstractNode* node,int index=0);
39
39
40 class QIcadAbstractPcbLine : public QIcadAbstractNodeWrapper
40 class QIcadAbstractPcbLine : public QIcadAbstractNodeWrapper
41 {
41 {
42 public:
42 public:
43 QIcadAbstractPcbLine(QIlib::AbstractNode* node)
43 QIcadAbstractPcbLine(QIlib::AbstractNode* node)
44 :QIcadAbstractNodeWrapper(node)
44 :QIcadAbstractNodeWrapper(node)
45 {}
45 {}
46 QIcadAbstractPcbLine(){}
46 QIcadAbstractPcbLine(){}
47 virtual const QPointF& startPos(){return p_startpos;}
47 virtual const QPointF& startPos(){return p_startpos;}
48 virtual const QPointF& stopPos(){return p_stoppos;}
48 virtual const QPointF& stopPos(){return p_stoppos;}
49 virtual double width(){return p_width;}
49 virtual double width(){return p_width;}
50 virtual const QStringList& layers(){return p_layers;}
50 virtual const QStringList& layers(){return p_layers;}
51 protected:
51 protected:
52 double p_width;
52 double p_width;
53 QPointF p_startpos;
53 QPointF p_startpos;
54 QPointF p_stoppos;
54 QPointF p_stoppos;
55 QStringList p_layers;
55 QStringList p_layers;
56 };
56 };
57
57
58 class QIcadPcbLayer : public QIcadAbstractNodeWrapper
58 class QIcadPcbLayer : public QIcadAbstractNodeWrapper
59 {
59 {
60 public:
60 public:
61 typedef enum
61 typedef enum
62 {
62 {
63 signal,
63 signal,
64 user,
64 user,
65 none
65 none
66 }layetType_t;
66 }layetType_t;
67 QIcadPcbLayer(QIlib::AbstractNode* node);
67 QIcadPcbLayer(QIlib::AbstractNode* node);
68 QIcadPcbLayer(){}
68 QIcadPcbLayer(){}
69 int index(){return p_index;}
69 int index(){return p_index;}
70 const QString& name(){return p_name;}
70 const QString& name(){return p_name;}
71 layetType_t type(){return p_type;}
71 layetType_t type(){return p_type;}
72 protected:
72 protected:
73 int p_index;
73 int p_index;
74 QString p_name;
74 QString p_name;
75 layetType_t p_type;
75 layetType_t p_type;
76 };
76 };
77
77
78 class QIcadPcbPlotParams : public QIcadAbstractNodeWrapper
78 class QIcadPcbPlotParams : public QIcadAbstractNodeWrapper
79 {
79 {
80 public:
80 public:
81 QIcadPcbPlotParams(QIlib::AbstractNode* node);
81 QIcadPcbPlotParams(QIlib::AbstractNode* node);
82 QIcadPcbPlotParams(){}
82 QIcadPcbPlotParams(){}
83 QIcadAbstractNodeWrapper layerselection;
83 QIcadAbstractNodeWrapper layerselection;
84 QIcadAbstractNodeWrapper usegerberextensions;
84 QIcadAbstractNodeWrapper usegerberextensions;
85 QIcadAbstractNodeWrapper excludeedgelayer;
85 QIcadAbstractNodeWrapper excludeedgelayer;
86 QIcadAbstractNodeWrapper linewidth;
86 QIcadAbstractNodeWrapper linewidth;
87 QIcadAbstractNodeWrapper plotframeref;
87 QIcadAbstractNodeWrapper plotframeref;
88 QIcadAbstractNodeWrapper viasonmask;
88 QIcadAbstractNodeWrapper viasonmask;
89 QIcadAbstractNodeWrapper mode;
89 QIcadAbstractNodeWrapper mode;
90 QIcadAbstractNodeWrapper useauxorigin;
90 QIcadAbstractNodeWrapper useauxorigin;
91 QIcadAbstractNodeWrapper hpglpennumber;
91 QIcadAbstractNodeWrapper hpglpennumber;
92 QIcadAbstractNodeWrapper hpglpenspeed;
92 QIcadAbstractNodeWrapper hpglpenspeed;
93 QIcadAbstractNodeWrapper hpglpendiameter;
93 QIcadAbstractNodeWrapper hpglpendiameter;
94 QIcadAbstractNodeWrapper hpglpenoverlay;
94 QIcadAbstractNodeWrapper hpglpenoverlay;
95 QIcadAbstractNodeWrapper psnegative;
95 QIcadAbstractNodeWrapper psnegative;
96 QIcadAbstractNodeWrapper psa4output;
96 QIcadAbstractNodeWrapper psa4output;
97 QIcadAbstractNodeWrapper plotreference;
97 QIcadAbstractNodeWrapper plotreference;
98 QIcadAbstractNodeWrapper plotvalue;
98 QIcadAbstractNodeWrapper plotvalue;
99 QIcadAbstractNodeWrapper plotothertext;
99 QIcadAbstractNodeWrapper plotothertext;
100 QIcadAbstractNodeWrapper plotinvisibletext;
100 QIcadAbstractNodeWrapper plotinvisibletext;
101 QIcadAbstractNodeWrapper padsonsilk;
101 QIcadAbstractNodeWrapper padsonsilk;
102 QIcadAbstractNodeWrapper subtractmaskfromsilk;
102 QIcadAbstractNodeWrapper subtractmaskfromsilk;
103 QIcadAbstractNodeWrapper outputformat;
103 QIcadAbstractNodeWrapper outputformat;
104 QIcadAbstractNodeWrapper mirror;
104 QIcadAbstractNodeWrapper mirror;
105 QIcadAbstractNodeWrapper drillshape;
105 QIcadAbstractNodeWrapper drillshape;
106 QIcadAbstractNodeWrapper scaleselection;
106 QIcadAbstractNodeWrapper scaleselection;
107 QIcadAbstractNodeWrapper outputdirectory;
107 QIcadAbstractNodeWrapper outputdirectory;
108 void setNode(QIlib::AbstractNode* node);
108 void setNode(QIlib::AbstractNode* node);
109 };
109 };
110
110
111 class QIcadPcbSetup : public QIcadAbstractNodeWrapper
111 class QIcadPcbSetup : public QIcadAbstractNodeWrapper
112 {
112 {
113 public:
113 public:
114 QIcadPcbSetup(QIlib::AbstractNode* node);
114 QIcadPcbSetup(QIlib::AbstractNode* node);
115 QIcadPcbSetup(){}
115 QIcadPcbSetup(){}
116 QIcadAbstractNodeWrapper last_trace_width;
116 QIcadAbstractNodeWrapper last_trace_width;
117 QIcadAbstractNodeWrapper trace_clearance;
117 QIcadAbstractNodeWrapper trace_clearance;
118 QIcadAbstractNodeWrapper zone_clearance;
118 QIcadAbstractNodeWrapper zone_clearance;
119 QIcadAbstractNodeWrapper zone_45_only;
119 QIcadAbstractNodeWrapper zone_45_only;
120 QIcadAbstractNodeWrapper trace_min;
120 QIcadAbstractNodeWrapper trace_min;
121 QIcadAbstractNodeWrapper segment_width;
121 QIcadAbstractNodeWrapper segment_width;
122 QIcadAbstractNodeWrapper edge_width;
122 QIcadAbstractNodeWrapper edge_width;
123 QIcadAbstractNodeWrapper via_size;
123 QIcadAbstractNodeWrapper via_size;
124 QIcadAbstractNodeWrapper via_dril;
124 QIcadAbstractNodeWrapper via_dril;
125 QIcadAbstractNodeWrapper via_min_size;
125 QIcadAbstractNodeWrapper via_min_size;
126 QIcadAbstractNodeWrapper via_min_drill;
126 QIcadAbstractNodeWrapper via_min_drill;
127 QIcadAbstractNodeWrapper uvia_size;
127 QIcadAbstractNodeWrapper uvia_size;
128 QIcadAbstractNodeWrapper uvia_drill;
128 QIcadAbstractNodeWrapper uvia_drill;
129 QIcadAbstractNodeWrapper uvias_allowed;
129 QIcadAbstractNodeWrapper uvias_allowed;
130 QIcadAbstractNodeWrapper uvia_min_size;
130 QIcadAbstractNodeWrapper uvia_min_size;
131 QIcadAbstractNodeWrapper uvia_min_drill;
131 QIcadAbstractNodeWrapper uvia_min_drill;
132 QIcadAbstractNodeWrapper pcb_text_width;
132 QIcadAbstractNodeWrapper pcb_text_width;
133 QIcadAbstractNodeWrapper pcb_text_size;
133 QIcadAbstractNodeWrapper pcb_text_size;
134 QIcadAbstractNodeWrapper mod_edge_width;
134 QIcadAbstractNodeWrapper mod_edge_width;
135 QIcadAbstractNodeWrapper mod_text_size;
135 QIcadAbstractNodeWrapper mod_text_size;
136 QIcadAbstractNodeWrapper mod_text_width;
136 QIcadAbstractNodeWrapper mod_text_width;
137 QIcadAbstractNodeWrapper pad_size;
137 QIcadAbstractNodeWrapper pad_size;
138 QIcadAbstractNodeWrapper pad_drill;
138 QIcadAbstractNodeWrapper pad_drill;
139 QIcadAbstractNodeWrapper pad_to_mask_clearance;
139 QIcadAbstractNodeWrapper pad_to_mask_clearance;
140 QIcadAbstractNodeWrapper aux_axis_origin;
140 QIcadAbstractNodeWrapper aux_axis_origin;
141 QIcadAbstractNodeWrapper visible_elements;
141 QIcadAbstractNodeWrapper visible_elements;
142 QIcadPcbPlotParams plotParams;
142 QIcadPcbPlotParams plotParams;
143 void setNode(QIlib::AbstractNode* node);
143 void setNode(QIlib::AbstractNode* node);
144 double defaultViaDrillSize(){return p_defaultViaDrillSize;}
144 double defaultViaDrillSize(){return p_defaultViaDrillSize;}
145 private:
145 private:
146 double p_defaultViaDrillSize;
146 double p_defaultViaDrillSize;
147 };
147 };
148
148
149 class QIcadPcbNetClass : public QIcadAbstractNodeWrapper
149 class QIcadPcbNetClass : public QIcadAbstractNodeWrapper
150 {
150 {
151 public:
151 public:
152 QIcadPcbNetClass(QIlib::AbstractNode* node);
152 QIcadPcbNetClass(QIlib::AbstractNode* node);
153 QIcadPcbNetClass(){}
153 QIcadPcbNetClass(){}
154 QIcadAbstractNodeWrapper clearance;
154 QIcadAbstractNodeWrapper clearance;
155 QIcadAbstractNodeWrapper trace_width;
155 QIcadAbstractNodeWrapper trace_width;
156 QIcadAbstractNodeWrapper via_dia;
156 QIcadAbstractNodeWrapper via_dia;
157 QIcadAbstractNodeWrapper via_drill;
157 QIcadAbstractNodeWrapper via_drill;
158 QIcadAbstractNodeWrapper uvia_dia;
158 QIcadAbstractNodeWrapper uvia_dia;
159 QIcadAbstractNodeWrapper uvia_drill;
159 QIcadAbstractNodeWrapper uvia_drill;
160 QList<QIcadAbstractNodeWrapper*> nets;
160 QList<QIcadAbstractNodeWrapper*> nets;
161 void setNode(QIlib::AbstractNode* node);
161 void setNode(QIlib::AbstractNode* node);
162 };
162 };
163
163
164 class QIcadPcbFpTextEffectsFont : public QIcadAbstractNodeWrapper
164 class QIcadPcbFpTextEffectsFont : public QIcadAbstractNodeWrapper
165 {
165 {
166 public:
166 public:
167 QIcadPcbFpTextEffectsFont(QIlib::AbstractNode* node);
167 QIcadPcbFpTextEffectsFont(QIlib::AbstractNode* node);
168 QIcadAbstractNodeWrapper size;
168 QIcadAbstractNodeWrapper size;
169 void setNode(QIlib::AbstractNode* node);
169 void setNode(QIlib::AbstractNode* node);
170 };
170 };
171
171
172 class QIcadPcbFpTextEffects : public QIcadAbstractNodeWrapper
172 class QIcadPcbFpTextEffects : public QIcadAbstractNodeWrapper
173 {
173 {
174 public:
174 public:
175 QIcadPcbFpTextEffects(QIlib::AbstractNode* node);
175 QIcadPcbFpTextEffects(QIlib::AbstractNode* node);
176 QIcadPcbFpTextEffects(){}
176 QIcadPcbFpTextEffects(){}
177 QIcadAbstractNodeWrapper font;
177 QIcadAbstractNodeWrapper font;
178 QIcadAbstractNodeWrapper thickness;
178 QIcadAbstractNodeWrapper thickness;
179 void setNode(QIlib::AbstractNode* node);
179 void setNode(QIlib::AbstractNode* node);
180 };
180 };
181
181
182 class QIcadPcbFPText : public QIcadAbstractNodeWrapper
182 class QIcadPcbFPText : public QIcadAbstractNodeWrapper
183 {
183 {
184 public:
184 public:
185 QIcadPcbFPText(QIlib::AbstractNode* node);
185 QIcadPcbFPText(QIlib::AbstractNode* node);
186 QIcadPcbFPText(){}
186 QIcadPcbFPText(){}
187 QIcadAbstractNodeWrapper at;
187 QIcadAbstractNodeWrapper at;
188 QIcadAbstractNodeWrapper layer;
188 QIcadAbstractNodeWrapper layer;
189 QIcadPcbFpTextEffects effects;
189 QIcadPcbFpTextEffects effects;
190 void setNode(QIlib::AbstractNode* node);
190 void setNode(QIlib::AbstractNode* node);
191 };
191 };
192
192
193 class QIcadPcbModuleModel : public QIcadAbstractNodeWrapper
193 class QIcadPcbModuleModel : public QIcadAbstractNodeWrapper
194 {
194 {
195 public:
195 public:
196 QIcadPcbModuleModel(QIlib::AbstractNode* node);
196 QIcadPcbModuleModel(QIlib::AbstractNode* node);
197 QIcadPcbModuleModel(){}
197 QIcadPcbModuleModel(){}
198 QIcadAbstractNodeWrapper at;
198 QIcadAbstractNodeWrapper at;
199 QIcadAbstractNodeWrapper scale;
199 QIcadAbstractNodeWrapper scale;
200 QIcadAbstractNodeWrapper rotate;
200 QIcadAbstractNodeWrapper rotate;
201 void setNode(QIlib::AbstractNode* node);
201 void setNode(QIlib::AbstractNode* node);
202 };
202 };
203
203
204 class QIcadPcbDimension : public QIcadAbstractNodeWrapper
204 class QIcadPcbDimension : public QIcadAbstractNodeWrapper
205 {
205 {
206 public:
206 public:
207 QIcadPcbDimension(QIlib::AbstractNode* node);
207 QIcadPcbDimension(QIlib::AbstractNode* node);
208 QIcadPcbDimension(){}
208 QIcadPcbDimension(){}
209 QIcadAbstractNodeWrapper width;
209 QIcadAbstractNodeWrapper width;
210 QIcadAbstractNodeWrapper layer;
210 QIcadAbstractNodeWrapper layer;
211 QIcadAbstractNodeWrapper gr_text;
211 QIcadAbstractNodeWrapper gr_text;
212 QIcadAbstractNodeWrapper feature1;
212 QIcadAbstractNodeWrapper feature1;
213 QIcadAbstractNodeWrapper feature2;
213 QIcadAbstractNodeWrapper feature2;
214 QIcadAbstractNodeWrapper crossbar;
214 QIcadAbstractNodeWrapper crossbar;
215 QIcadAbstractNodeWrapper arrow1a;
215 QIcadAbstractNodeWrapper arrow1a;
216 QIcadAbstractNodeWrapper arrow1b;
216 QIcadAbstractNodeWrapper arrow1b;
217 QIcadAbstractNodeWrapper arrow2a;
217 QIcadAbstractNodeWrapper arrow2a;
218 QIcadAbstractNodeWrapper arrow2b;
218 QIcadAbstractNodeWrapper arrow2b;
219 void setNode(QIlib::AbstractNode* node);
219 void setNode(QIlib::AbstractNode* node);
220 };
220 };
221
221
222 class QIcadPcbPad : public QIcadAbstractNodeWrapper
222 class QIcadPcbPad : public QIcadAbstractNodeWrapper
223 {
223 {
224 public:
224 public:
225 typedef enum
225 typedef enum
226 {
226 {
227 rectangle,
227 rectangle,
228 circle
228 circle
229 }padShape;
229 }padShape;
230 QIcadPcbPad(QIlib::AbstractNode* node);
230 QIcadPcbPad(QIlib::AbstractNode* node);
231 QIcadPcbPad(){}
231 QIcadPcbPad(){}
232 QIcadAbstractNodeWrapper at;
232 QIcadAbstractNodeWrapper at;
233 QIcadAbstractNodeWrapper sizeNode;
233 QIcadAbstractNodeWrapper sizeNode;
234 QIcadAbstractNodeWrapper layer;
234 QIcadAbstractNodeWrapper layer;
235 QIcadAbstractNodeWrapper netNode;
235 QIcadAbstractNodeWrapper netNode;
236 QIcadAbstractNodeWrapper drillNode;
236 QIcadAbstractNodeWrapper drillNode;
237 const QStringList& layers(){return p_layers;}
237 const QStringList& layers(){return p_layers;}
238 const QSizeF& size(){return p_size;}
238 const QSizeF& size(){return p_size;}
239 const QPointF& pos(){return p_pos;}
239 const QPointF& pos(){return p_pos;}
240 double drill(){return p_drill;}
240 double drill(){return p_drill;}
241 double angle(){return p_angle;}
241 padShape shape(){return p_shape;}
242 padShape shape(){return p_shape;}
243 int padNumber(){return p_padNumber;}
242 void setNode(QIlib::AbstractNode* node);
244 void setNode(QIlib::AbstractNode* node);
243 private:
245 private:
246 int p_padNumber;
244 padShape p_shape;
247 padShape p_shape;
245 double p_drill;
248 double p_drill;
249 double p_angle;
246 QSizeF p_size;
250 QSizeF p_size;
247 QPointF p_pos;
251 QPointF p_pos;
248 QStringList p_layers;
252 QStringList p_layers;
249 };
253 };
250
254
251 class QIcadPcbFPLine : public QIcadAbstractPcbLine
255 class QIcadPcbFPLine : public QIcadAbstractPcbLine
252 {
256 {
253 public:
257 public:
254 QIcadPcbFPLine(QIlib::AbstractNode* node);
258 QIcadPcbFPLine(QIlib::AbstractNode* node);
255 QIcadPcbFPLine(){}
259 QIcadPcbFPLine(){}
256 QIcadAbstractNodeWrapper start;
260 QIcadAbstractNodeWrapper start;
257 QIcadAbstractNodeWrapper end;
261 QIcadAbstractNodeWrapper end;
258 QIcadAbstractNodeWrapper layer;
262 QIcadAbstractNodeWrapper layer;
259 QIcadAbstractNodeWrapper width;
263 QIcadAbstractNodeWrapper width;
260 void setNode(QIlib::AbstractNode* node);
264 void setNode(QIlib::AbstractNode* node);
261 };
265 };
262
266
263 class QIcadPcbFPCircle : public QIcadAbstractNodeWrapper
267 class QIcadPcbFPCircle : public QIcadAbstractNodeWrapper
264 {
268 {
265 public:
269 public:
266 QIcadPcbFPCircle(QIlib::AbstractNode* node);
270 QIcadPcbFPCircle(QIlib::AbstractNode* node);
267 QIcadPcbFPCircle(){}
271 QIcadPcbFPCircle(){}
268 QIcadAbstractNodeWrapper center;
272 QIcadAbstractNodeWrapper center;
269 QIcadAbstractNodeWrapper end;
273 QIcadAbstractNodeWrapper end;
270 QIcadAbstractNodeWrapper layer;
274 QIcadAbstractNodeWrapper layer;
271 QIcadAbstractNodeWrapper width;
275 QIcadAbstractNodeWrapper width;
272 void setNode(QIlib::AbstractNode* node);
276 void setNode(QIlib::AbstractNode* node);
273 };
277 };
274
278
275 class QIcadPcbModule : public QIcadAbstractNodeWrapper
279 class QIcadPcbModule : public QIcadAbstractNodeWrapper
276 {
280 {
277 public:
281 public:
278 QIcadPcbModule(QIlib::AbstractNode* node);
282 QIcadPcbModule(QIlib::AbstractNode* node);
279 QIcadPcbModule(){}
283 QIcadPcbModule(){}
280 const QPointF& pos();
284 const QPointF& pos();
281 double angle();
285 double angle();
282 QIcadAbstractNodeWrapper layer;
286 QIcadAbstractNodeWrapper layer;
283 QIcadAbstractNodeWrapper tedit;
287 QIcadAbstractNodeWrapper tedit;
284 QIcadAbstractNodeWrapper tstamp;
288 QIcadAbstractNodeWrapper tstamp;
285 QIcadAbstractNodeWrapper at;
289 QIcadAbstractNodeWrapper at;
286 QIcadAbstractNodeWrapper descr;
290 QIcadAbstractNodeWrapper descr;
287 QIcadAbstractNodeWrapper tags;
291 QIcadAbstractNodeWrapper tags;
288 QIcadAbstractNodeWrapper path;
292 QIcadAbstractNodeWrapper path;
289 QIcadAbstractNodeWrapper attr;
293 QIcadAbstractNodeWrapper attr;
290 QList<QIcadPcbFPText*> fp_texts;
294 QList<QIcadPcbFPText*> fp_texts;
291 QList<QIcadPcbFPLine*> fp_lines;
295 QList<QIcadPcbFPLine*> fp_lines;
292 QList<QIcadPcbFPCircle*> fp_circles;
296 QList<QIcadPcbFPCircle*> fp_circles;
293 QList<QIcadPcbPad*> pads;
297 QList<QIcadPcbPad*> pads;
294 QIcadPcbModuleModel model;
298 QIcadPcbModuleModel model;
295 void setNode(QIlib::AbstractNode* node);
299 void setNode(QIlib::AbstractNode* node);
296 void clrPads();
300 void clrPads();
297 void apendPad(QIlib::AbstractNode* node);
301 void apendPad(QIlib::AbstractNode* node);
298 void clrTexts();
302 void clrTexts();
299 void apendText(QIlib::AbstractNode* node);
303 void apendText(QIlib::AbstractNode* node);
300 void clrLines();
304 void clrLines();
301 void apendLine(QIlib::AbstractNode* node);
305 void apendLine(QIlib::AbstractNode* node);
302 void clrCircles();
306 void clrCircles();
303 void apendCircle(QIlib::AbstractNode* node);
307 void apendCircle(QIlib::AbstractNode* node);
304 private:
308 private:
305 QPointF p_pos;
309 QPointF p_pos;
306 double p_angle;
310 double p_angle;
307 };
311 };
308
312
309 class QIcadPcbSegment : public QIcadAbstractPcbLine
313 class QIcadPcbSegment : public QIcadAbstractPcbLine
310 {
314 {
311 public:
315 public:
312 QIcadPcbSegment(QIlib::AbstractNode* node);
316 QIcadPcbSegment(QIlib::AbstractNode* node);
313 QIcadPcbSegment(){}
317 QIcadPcbSegment(){}
314 QIcadAbstractNodeWrapper start;
318 QIcadAbstractNodeWrapper start;
315 QIcadAbstractNodeWrapper end;
319 QIcadAbstractNodeWrapper end;
316 QIcadAbstractNodeWrapper width;
320 QIcadAbstractNodeWrapper width;
317 QIcadAbstractNodeWrapper layer;
321 QIcadAbstractNodeWrapper layer;
318 QIcadAbstractNodeWrapper net;
322 QIcadAbstractNodeWrapper net;
319 void setNode(QIlib::AbstractNode* node);
323 void setNode(QIlib::AbstractNode* node);
320 };
324 };
321
325
322 class QIcadPcbVia : public QIcadAbstractNodeWrapper
326 class QIcadPcbVia : public QIcadAbstractNodeWrapper
323 {
327 {
324 public:
328 public:
325 QIcadPcbVia(QIlib::AbstractNode* node, double defaultDrill=0);
329 QIcadPcbVia(QIlib::AbstractNode* node, double defaultDrill=0);
326 QIcadPcbVia(){}
330 QIcadPcbVia(){}
327 QIcadAbstractNodeWrapper at;
331 QIcadAbstractNodeWrapper at;
328 QIcadAbstractNodeWrapper sizeNode;
332 QIcadAbstractNodeWrapper sizeNode;
329 QIcadAbstractNodeWrapper drillNode;
333 QIcadAbstractNodeWrapper drillNode;
330 QIcadAbstractNodeWrapper layersNode;
334 QIcadAbstractNodeWrapper layersNode;
331 QIcadAbstractNodeWrapper net;
335 QIcadAbstractNodeWrapper net;
332 QIcadAbstractNodeWrapper tstamp;
336 QIcadAbstractNodeWrapper tstamp;
333 void setNode(QIlib::AbstractNode* node);
337 void setNode(QIlib::AbstractNode* node);
334 const QStringList& layers(){return p_layers;}
338 const QStringList& layers(){return p_layers;}
335 const QSizeF& size(){return p_size;}
339 const QSizeF& size(){return p_size;}
336 const QPointF& pos(){return p_pos;}
340 const QPointF& pos(){return p_pos;}
337 double drill(){return p_drill;}
341 double drill(){return p_drill;}
338 private:
342 private:
339 double p_drill;
343 double p_drill;
340 QSizeF p_size;
344 QSizeF p_size;
341 QPointF p_pos;
345 QPointF p_pos;
342 QStringList p_layers;
346 QStringList p_layers;
343 };
347 };
344
348
345 class QIcadPcbLine : public QIcadAbstractPcbLine
349 class QIcadPcbLine : public QIcadAbstractPcbLine
346 {
350 {
347 public:
351 public:
348 QIcadPcbLine(QIlib::AbstractNode* node);
352 QIcadPcbLine(QIlib::AbstractNode* node);
349 QIcadPcbLine(){}
353 QIcadPcbLine(){}
350 QIcadAbstractNodeWrapper start;
354 QIcadAbstractNodeWrapper start;
351 QIcadAbstractNodeWrapper end;
355 QIcadAbstractNodeWrapper end;
352 QIcadAbstractNodeWrapper angle;
356 QIcadAbstractNodeWrapper angle;
353 QIcadAbstractNodeWrapper layer;
357 QIcadAbstractNodeWrapper layer;
354 QIcadAbstractNodeWrapper width;
358 QIcadAbstractNodeWrapper width;
355 void setNode(QIlib::AbstractNode* node);
359 void setNode(QIlib::AbstractNode* node);
356 };
360 };
357
361
358 class QIcadPcbZone : public QIcadAbstractNodeWrapper
362 class QIcadPcbZone : public QIcadAbstractNodeWrapper
359 {
363 {
360 public:
364 public:
361 QIcadPcbZone(QIlib::AbstractNode* node);
365 QIcadPcbZone(QIlib::AbstractNode* node);
362 QIcadPcbZone(){}
366 QIcadPcbZone(){}
363 void setNode(QIlib::AbstractNode* node);
367 void setNode(QIlib::AbstractNode* node);
364 };
368 };
365
369
366 class QIcadPcbArc : public QIcadAbstractNodeWrapper
370 class QIcadPcbArc : public QIcadAbstractNodeWrapper
367 {
371 {
368 public:
372 public:
369 QIcadPcbArc(QIlib::AbstractNode* node);
373 QIcadPcbArc(QIlib::AbstractNode* node);
370 QIcadPcbArc(){}
374 QIcadPcbArc(){}
371 QIcadAbstractNodeWrapper start;
375 QIcadAbstractNodeWrapper start;
372 QIcadAbstractNodeWrapper end;
376 QIcadAbstractNodeWrapper end;
373 QIcadAbstractNodeWrapper angle;
377 QIcadAbstractNodeWrapper angle;
374 QIcadAbstractNodeWrapper layer;
378 QIcadAbstractNodeWrapper layer;
375 QIcadAbstractNodeWrapper width;
379 QIcadAbstractNodeWrapper width;
376 void setNode(QIlib::AbstractNode* node);
380 void setNode(QIlib::AbstractNode* node);
377 };
381 };
378
382
379 class QIcadPcbCircle : public QIcadAbstractNodeWrapper
383 class QIcadPcbCircle : public QIcadAbstractNodeWrapper
380 {
384 {
381 public:
385 public:
382 QIcadPcbCircle(QIlib::AbstractNode* node);
386 QIcadPcbCircle(QIlib::AbstractNode* node);
383 QIcadPcbCircle(){}
387 QIcadPcbCircle(){}
384 QIcadAbstractNodeWrapper center;
388 QIcadAbstractNodeWrapper center;
385 QIcadAbstractNodeWrapper end;
389 QIcadAbstractNodeWrapper end;
386 QIcadAbstractNodeWrapper layer;
390 QIcadAbstractNodeWrapper layer;
387 QIcadAbstractNodeWrapper width;
391 QIcadAbstractNodeWrapper width;
388 void setNode(QIlib::AbstractNode* node);
392 void setNode(QIlib::AbstractNode* node);
389 };
393 };
390
394
391 class QIcadPcbText : public QIcadAbstractNodeWrapper
395 class QIcadPcbText : public QIcadAbstractNodeWrapper
392 {
396 {
393 public:
397 public:
394 QIcadPcbText(QIlib::AbstractNode* node);
398 QIcadPcbText(QIlib::AbstractNode* node);
395 QIcadPcbText(){}
399 QIcadPcbText(){}
396 QIcadAbstractNodeWrapper at;
400 QIcadAbstractNodeWrapper at;
397 QIcadAbstractNodeWrapper layer;
401 QIcadAbstractNodeWrapper layer;
398 QIcadAbstractNodeWrapper width;
402 QIcadAbstractNodeWrapper width;
399 QIcadPcbFpTextEffects effects;
403 QIcadPcbFpTextEffects effects;
400 void setNode(QIlib::AbstractNode* node);
404 void setNode(QIlib::AbstractNode* node);
401 };
405 };
402
406
403 class QIcadPcbLayers : public QIcadAbstractNodeWrapper
407 class QIcadPcbLayers : public QIcadAbstractNodeWrapper
404 {
408 {
405 public:
409 public:
406 QIcadPcbLayers(QIlib::AbstractNode* node);
410 QIcadPcbLayers(QIlib::AbstractNode* node);
407 QIcadPcbLayers(){}
411 QIcadPcbLayers(){}
408 QList<QIcadPcbLayer*> layers;
412 QList<QIcadPcbLayer*> layers;
409 void setNode(QIlib::AbstractNode* node);
413 void setNode(QIlib::AbstractNode* node);
410 void clrLayers();
414 void clrLayers();
411 void apendLayer(QIlib::AbstractNode* node);
415 void apendLayer(QIlib::AbstractNode* node);
412 };
416 };
413
417
414 class QIcadPcbGeneralInfo : public QIcadAbstractNodeWrapper
418 class QIcadPcbGeneralInfo : public QIcadAbstractNodeWrapper
415 {
419 {
416 public:
420 public:
417 QIcadPcbGeneralInfo(QIlib::AbstractNode* node);
421 QIcadPcbGeneralInfo(QIlib::AbstractNode* node);
418 QIcadPcbGeneralInfo(){}
422 QIcadPcbGeneralInfo(){}
419 QIcadAbstractNodeWrapper links;
423 QIcadAbstractNodeWrapper links;
420 QIcadAbstractNodeWrapper no_connections;
424 QIcadAbstractNodeWrapper no_connections;
421 QIcadAbstractNodeWrapper area;
425 QIcadAbstractNodeWrapper area;
422 QIcadAbstractNodeWrapper thickness;
426 QIcadAbstractNodeWrapper thickness;
423 QIcadAbstractNodeWrapper drawings;
427 QIcadAbstractNodeWrapper drawings;
424 QIcadAbstractNodeWrapper tracks;
428 QIcadAbstractNodeWrapper tracks;
425 QIcadAbstractNodeWrapper zones;
429 QIcadAbstractNodeWrapper zones;
426 QIcadAbstractNodeWrapper modules;
430 QIcadAbstractNodeWrapper modules;
427 QIcadAbstractNodeWrapper nets;
431 QIcadAbstractNodeWrapper nets;
428 void setNode(QIlib::AbstractNode* node);
432 void setNode(QIlib::AbstractNode* node);
429 };
433 };
430
434
431 class QIcadPcbRoot : public QIcadAbstractNodeWrapper
435 class QIcadPcbRoot : public QIcadAbstractNodeWrapper
432 {
436 {
433 public:
437 public:
434 QIcadPcbRoot(QIlib::AbstractNode* node);
438 QIcadPcbRoot(QIlib::AbstractNode* node);
435 QIcadAbstractNodeWrapper version;
439 QIcadAbstractNodeWrapper version;
436 QIcadAbstractNodeWrapper host;
440 QIcadAbstractNodeWrapper host;
437 QIcadAbstractNodeWrapper page;
441 QIcadAbstractNodeWrapper page;
438 QIcadPcbGeneralInfo general;
442 QIcadPcbGeneralInfo general;
439 QIcadPcbLayers layers;
443 QIcadPcbLayers layers;
440 QIcadPcbSetup setup;
444 QIcadPcbSetup setup;
441 QList<QIcadAbstractNodeWrapper*> nets;
445 QList<QIcadAbstractNodeWrapper*> nets;
442 QList<QIcadPcbModule*> modules;
446 QList<QIcadPcbModule*> modules;
443 QList<QIcadPcbDimension*> dimensions;
447 QList<QIcadPcbDimension*> dimensions;
444 QList<QIcadPcbLine*> lines;
448 QList<QIcadPcbLine*> lines;
445 QList<QIcadPcbSegment*> segments;
449 QList<QIcadPcbSegment*> segments;
446 QList<QIcadPcbVia*> vias;
450 QList<QIcadPcbVia*> vias;
447 QList<QIcadPcbArc*> arcs;
451 QList<QIcadPcbArc*> arcs;
448 QList<QIcadPcbCircle*> circles;
452 QList<QIcadPcbCircle*> circles;
449 QList<QIcadPcbText*> texts;
453 QList<QIcadPcbText*> texts;
450 QList<QIcadPcbZone*> zones;
454 QList<QIcadPcbZone*> zones;
451 void setNode(QIlib::AbstractNode* node);
455 void setNode(QIlib::AbstractNode* node);
452 void clrNets();
456 void clrNets();
453 void apendNet(QIlib::AbstractNode* node);
457 void apendNet(QIlib::AbstractNode* node);
454 void clrModules();
458 void clrModules();
455 void apendModule(QIlib::AbstractNode* node);
459 void apendModule(QIlib::AbstractNode* node);
456 void clrDimensions();
460 void clrDimensions();
457 void apendDimension(QIlib::AbstractNode* node);
461 void apendDimension(QIlib::AbstractNode* node);
458 void apendLine(QIlib::AbstractNode* node);
462 void apendLine(QIlib::AbstractNode* node);
459 void clrLines();
463 void clrLines();
460 void clrSegments();
464 void clrSegments();
461 void apendSegment(QIlib::AbstractNode* node);
465 void apendSegment(QIlib::AbstractNode* node);
462 void clrVias();
466 void clrVias();
463 void apendVia(QIlib::AbstractNode* node);
467 void apendVia(QIlib::AbstractNode* node);
464 void clrArcs();
468 void clrArcs();
465 void apendArc(QIlib::AbstractNode* node);
469 void apendArc(QIlib::AbstractNode* node);
466 void clrCircles();
470 void clrCircles();
467 void apendCircle(QIlib::AbstractNode* node);
471 void apendCircle(QIlib::AbstractNode* node);
468 void clrTexts();
472 void clrTexts();
469 void apendText(QIlib::AbstractNode* node);
473 void apendText(QIlib::AbstractNode* node);
470 void clrZones();
474 void clrZones();
471 void apendZone(QIlib::AbstractNode* node);
475 void apendZone(QIlib::AbstractNode* node);
472 };
476 };
473
477
474 class QIcadPcb : private lispLike_Driver
478 class QIcadPcb : private lispLike_Driver
475 {
479 {
476 public:
480 public:
477 QIcadPcb();
481 QIcadPcb();
478 bool parsePcb(const QString& pcb);
482 bool parsePcb(const QString& pcb);
479 QString toString();
483 QString toString();
480 QString fileName;
484 QString fileName;
481 QString print();
485 QString print();
482
486
483 QIcadPcbRoot* pcbRoot;
487 QIcadPcbRoot* pcbRoot;
484 private:
488 private:
485 void updateConcreteTree();
489 void updateConcreteTree();
486 };
490 };
487
491
488
492
489 }
493 }
490 #endif // QICADPCB_H
494 #endif // QICADPCB_H
@@ -1,87 +1,105
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 <QFileDialog>
27
28
28
29
29 MainWindow::MainWindow(QWidget *parent) :
30 MainWindow::MainWindow(QWidget *parent) :
30 QMainWindow(parent),
31 QMainWindow(parent),
31 ui(new Ui::MainWindow)
32 ui(new Ui::MainWindow)
32 {
33 {
33 ui->setupUi(this);
34 ui->setupUi(this);
34 this->p_scene = new QGraphicsScene();
35 this->p_scene = new QGraphicsScene();
35 this->p_scene->setSceneRect(0, 0, 500, 200);
36
37 this->context = new PCBContext();
36 this->context = new PCBContext();
38 this->ui->graphicsView->setScene(this->p_scene);
37 this->ui->graphicsView->setScene(this->p_scene);
39 QIlib::QIcadPcb pcbDriver;
38 this->pcbDriver =NULL;
40 // pcbDriver.parsePcb("/opt/kicadTools/test/testFiles/pcb2.kicad_pcb");
41 // pcbDriver.parsePcb("/home/jeandet/Documents/PCB/ADC_STAMP/ADC_STAMP.kicad_pcb");
42 pcbDriver.parsePcb("/usr/share/kicad/demos/video/video.kicad_pcb");
43 // pcbDriver.parsePcb("/usr/share/kicad/demos/kit-dev-coldfire-xilinx_5213/kit-dev-coldfire-xilinx_5213.kicad_pcb");
44 for(int i=0;i<pcbDriver.pcbRoot->layers.layers.count();i++)
45 {
46 this->context->addlayer(pcbDriver.pcbRoot->layers.layers.at(i)->name(),pcbDriver.pcbRoot->layers.layers.at(i)->index());
47 }
48 for(int i=0;i<pcbDriver.pcbRoot->modules.count();i++)
49 {
50 this->p_scene->addItem(new PCBModule(pcbDriver.pcbRoot->modules.at(i),this->context));
51 }
52 for(int i=0;i<pcbDriver.pcbRoot->lines.count();i++)
53 {
54 this->p_scene->addItem(new PCBLine((QIlib::QIcadAbstractPcbLine*)pcbDriver.pcbRoot->lines.at(i),this->context));
55 }
56 for(int i=0;i<pcbDriver.pcbRoot->segments.count();i++)
57 {
58 this->p_scene->addItem(new PCBLine((QIlib::QIcadAbstractPcbLine*)pcbDriver.pcbRoot->segments.at(i),this->context));
59 }
60 for(int i=0;i<pcbDriver.pcbRoot->vias.count();i++)
61 {
62 this->p_scene->addItem(new PCBVia(pcbDriver.pcbRoot->vias.at(i),this->context));
63 }
64 connect(this->ui->actionRedraw,SIGNAL(triggered(bool)),this,SLOT(redraw()));
39 connect(this->ui->actionRedraw,SIGNAL(triggered(bool)),this,SLOT(redraw()));
40 connect(this->ui->actionOpen,SIGNAL(triggered(bool)),this,SLOT(openFile()));
65 }
41 }
66
42
67 MainWindow::~MainWindow()
43 MainWindow::~MainWindow()
68 {
44 {
69 delete ui;
45 delete ui;
70 }
46 }
71
47
72 void MainWindow::redraw()
48 void MainWindow::redraw()
73 {
49 {
74 this->p_scene->update();
50 this->p_scene->update();
75 }
51 }
76
52
53 void MainWindow::openFile()
54 {
55 QString file = QFileDialog::getOpenFileName(this,tr("Open kicad PCB file"),
56 "",
57 tr("PCB file (*.kicad_pcb)"));
58 if(QFile::exists(file))
59 loadFile(file);
60 }
61
77 void MainWindow::changeEvent(QEvent *e)
62 void MainWindow::changeEvent(QEvent *e)
78 {
63 {
79 QMainWindow::changeEvent(e);
64 QMainWindow::changeEvent(e);
80 switch (e->type()) {
65 switch (e->type()) {
81 case QEvent::LanguageChange:
66 case QEvent::LanguageChange:
82 ui->retranslateUi(this);
67 ui->retranslateUi(this);
83 break;
68 break;
84 default:
69 default:
85 break;
70 break;
86 }
71 }
87 }
72 }
73
74 void MainWindow::loadFile(const QString &file)
75 {
76 this->p_scene->setSceneRect(0, 0, 500, 200);
77 if(pcbDriver!=NULL)delete pcbDriver;
78 pcbDriver = new QIlib::QIcadPcb();
79 this->context->clear();
80 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);
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++)
86 {
87 this->context->addlayer(pcbDriver->pcbRoot->layers.layers.at(i)->name(),pcbDriver->pcbRoot->layers.layers.at(i)->index());
88 }
89 for(int i=0;i<pcbDriver->pcbRoot->modules.count();i++)
90 {
91 this->p_scene->addItem(new PCBModule(pcbDriver->pcbRoot->modules.at(i),this->context));
92 }
93 for(int i=0;i<pcbDriver->pcbRoot->lines.count();i++)
94 {
95 this->p_scene->addItem(new PCBLine((QIlib::QIcadAbstractPcbLine*)pcbDriver->pcbRoot->lines.at(i),this->context));
96 }
97 for(int i=0;i<pcbDriver->pcbRoot->segments.count();i++)
98 {
99 this->p_scene->addItem(new PCBLine((QIlib::QIcadAbstractPcbLine*)pcbDriver->pcbRoot->segments.at(i),this->context));
100 }
101 for(int i=0;i<pcbDriver->pcbRoot->vias.count();i++)
102 {
103 this->p_scene->addItem(new PCBVia(pcbDriver->pcbRoot->vias.at(i),this->context));
104 }
105 }
@@ -1,57 +1,60
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 MAINWINDOW_H
22 #ifndef MAINWINDOW_H
23 #define MAINWINDOW_H
23 #define MAINWINDOW_H
24
24
25 #include <QMainWindow>
25 #include <QMainWindow>
26 #include <QGraphicsScene>
26 #include <QGraphicsScene>
27 #include <qicadnetlist.h>
27 #include <qicadnetlist.h>
28 #include <qicadpcb.h>
28 #include <qicadpcb.h>
29 #include <QMap>
29 #include <QMap>
30 #include <pcbcontext.h>
30 #include <pcbcontext.h>
31
31
32
32
33
33
34 namespace Ui {
34 namespace Ui {
35 class MainWindow;
35 class MainWindow;
36 }
36 }
37
37
38 class MainWindow : public QMainWindow
38 class MainWindow : public QMainWindow
39 {
39 {
40 Q_OBJECT
40 Q_OBJECT
41
41
42 public:
42 public:
43 explicit MainWindow(QWidget *parent = 0);
43 explicit MainWindow(QWidget *parent = 0);
44 ~MainWindow();
44 ~MainWindow();
45
45
46 public slots:
46 public slots:
47 void redraw();
47 void redraw();
48 void openFile();
48 protected:
49 protected:
49 void changeEvent(QEvent *e);
50 void changeEvent(QEvent *e);
50
51
51 private:
52 private:
53 void loadFile(const QString& file);
52 Ui::MainWindow *ui;
54 Ui::MainWindow *ui;
53 QGraphicsScene* p_scene;
55 QGraphicsScene* p_scene;
54 PCBContext* context;
56 PCBContext* context;
57 QIlib::QIcadPcb* pcbDriver;
55 };
58 };
56
59
57 #endif // MAINWINDOW_H
60 #endif // MAINWINDOW_H
@@ -1,73 +1,79
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 "pcbcontext.h"
22 #include "pcbcontext.h"
23
23
24 Qt::GlobalColor Colours[]= {
24 Qt::GlobalColor Colours[]= {
25 Qt::red,
25 Qt::red,
26 Qt::blue,
26 Qt::blue,
27 Qt::black,
27 Qt::black,
28 Qt::green,
28 Qt::green,
29 Qt::darkGreen,
29 Qt::darkGreen,
30 Qt::cyan,
30 Qt::cyan,
31 Qt::darkRed,
31 Qt::darkRed,
32 Qt::gray,
32 Qt::gray,
33 Qt::yellow,
33 Qt::yellow,
34 Qt::darkBlue,
34 Qt::darkBlue,
35 Qt::darkCyan,
35 Qt::darkCyan,
36 Qt::magenta,
36 Qt::magenta,
37 Qt::darkMagenta,
37 Qt::darkMagenta,
38 Qt::darkYellow,
38 Qt::darkYellow,
39 Qt::darkGray,
39 Qt::darkGray,
40 Qt::lightGray
40 Qt::lightGray
41 };
41 };
42
42
43 PCBContext::PCBContext(QObject *parent) : QObject(parent)
43 PCBContext::PCBContext(QObject *parent) : QObject(parent)
44 {
44 {
45
45
46 }
46 }
47
47
48 void PCBContext::addlayer(const QString &name, int number)
48 void PCBContext::addlayer(const QString &name, int number)
49 {
49 {
50 this->layers_map[name]=number;
50 this->layers_map[name]=number;
51 layers_colors[number] = Colours[number%15];
51 layers_colors[number] = Colours[number%15];
52 }
52 }
53
53
54 int PCBContext::layer(const QString &name)
54 int PCBContext::layer(const QString &name)
55 {
55 {
56 return layers_map[name];
56 return layers_map[name];
57 }
57 }
58
58
59 const QColor &PCBContext::layerColor(const QString &name)
59 const QColor &PCBContext::layerColor(const QString &name)
60 {
60 {
61 return layers_colors[layers_map[name]];
61 return layers_colors[layers_map[name]];
62 }
62 }
63
63
64 const QColor &PCBContext::layerColor(int number)
64 const QColor &PCBContext::layerColor(int number)
65 {
65 {
66 return layers_colors[number];
66 return layers_colors[number];
67 }
67 }
68
68
69 const QString PCBContext::layer(int number)
69 const QString PCBContext::layer(int number)
70 {
70 {
71 return layers_map.key(number);
71 return layers_map.key(number);
72 }
72 }
73
73
74 void PCBContext::clear()
75 {
76 this->layers_colors.clear();
77 this->layers_map.clear();
78 }
79
@@ -1,48 +1,49
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 PCBCONTEXT_H
22 #ifndef PCBCONTEXT_H
23 #define PCBCONTEXT_H
23 #define PCBCONTEXT_H
24
24
25 #include <QObject>
25 #include <QObject>
26 #include <QWidget>
26 #include <QWidget>
27 #include <QMap>
27 #include <QMap>
28
28
29 class PCBContext : public QObject
29 class PCBContext : public QObject
30 {
30 {
31 Q_OBJECT
31 Q_OBJECT
32 public:
32 public:
33 explicit PCBContext(QObject *parent = 0);
33 explicit PCBContext(QObject *parent = 0);
34 void addlayer(const QString& name,int number);
34 void addlayer(const QString& name,int number);
35 int layer(const QString& name);
35 int layer(const QString& name);
36 const QColor& layerColor(const QString& name);
36 const QColor& layerColor(const QString& name);
37 const QColor& layerColor(int number);
37 const QColor& layerColor(int number);
38 const QString layer(int number);
38 const QString layer(int number);
39 void clear();
39 signals:
40 signals:
40
41
41 public slots:
42 public slots:
42
43
43 private:
44 private:
44 QMap<int,QColor> layers_colors;
45 QMap<int,QColor> layers_colors;
45 QMap<QString,int> layers_map;
46 QMap<QString,int> layers_map;
46 };
47 };
47
48
48 #endif // PCBCONTEXT_H
49 #endif // PCBCONTEXT_H
@@ -1,80 +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 "pcbrectpad.h"
23 #include <QPen>
23 #include <QPen>
24
24
25 PCBRectPad::PCBRectPad(QIlib::QIcadPcbPad *padNode, PCBContext *context)
25 PCBRectPad::PCBRectPad(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 PCBRectPad::PCBRectPad(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 PCBRectPad::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 for(int i=0;i<this->padNode->layers().count();i++)
46 for(int i=0;i<this->padNode->layers().count();i++)
46 {
47 {
47 QGraphicsRectItem* rect = new QGraphicsRectItem();
48 QGraphicsRectItem* rect = new QGraphicsRectItem();
49 rect->setTransformOriginPoint(rec.center());
48 QPen pen = rect->pen();
50 QPen pen = rect->pen();
49 pen.setWidthF(0.01);
51 pen.setWidthF(0.01);
50 rect->setPen(pen);
52 rect->setPen(pen);
51 QBrush brush = rect->brush();
53 QBrush brush = rect->brush();
52 brush.setStyle(Qt::SolidPattern);
54 brush.setStyle(Qt::SolidPattern);
53 brush.setColor(context->layerColor(this->padNode->layers().at(i)));
55 brush.setColor(context->layerColor(this->padNode->layers().at(i)));
54 rect->setBrush(brush);
56 rect->setBrush(brush);
55 QRectF rec(this->padNode->pos()+offset,this->padNode->size());
56 rect->setRect(rec);
57 rect->setRect(rec);
57 rect->setZValue(-context->layer(padNode->layers().at(i)));
58 rect->setZValue(-context->layer(padNode->layers().at(i)));
59 rect->setRotation(padNode->angle());
58 this->addToGroup(rect);
60 this->addToGroup(rect);
59 }
61 }
62 QGraphicsTextItem* text=new QGraphicsTextItem(QString::number(padNode->padNumber()));
63 text->setPos(rec.center());
64 text->setScale(0.01);
65 text->setZValue(1);
66 this->addToGroup(text);
67
60 }
68 }
61 if(this->padNode->shape()==QIlib::QIcadPcbPad::circle)
69 if(this->padNode->shape()==QIlib::QIcadPcbPad::circle)
62 {
70 {
63 for(int i=0;i<this->padNode->layers().count();i++)
71 for(int i=0;i<this->padNode->layers().count();i++)
64 {
72 {
65 QGraphicsEllipseItem* ellipse = new QGraphicsEllipseItem();
73 QGraphicsEllipseItem* ellipse = new QGraphicsEllipseItem();
66 QPen pen = ellipse->pen();
74 QPen pen = ellipse->pen();
67 pen.setWidthF(0.01);
75 pen.setWidthF(0.01);
68 ellipse->setPen(pen);
76 ellipse->setPen(pen);
69 QBrush brush = ellipse->brush();
77 QBrush brush = ellipse->brush();
70 brush.setStyle(Qt::SolidPattern);
78 brush.setStyle(Qt::SolidPattern);
71 brush.setColor(context->layerColor(this->padNode->layers().at(i)));
79 brush.setColor(context->layerColor(this->padNode->layers().at(i)));
72 ellipse->setBrush(brush);
80 ellipse->setBrush(brush);
73 QRectF rec(this->padNode->pos()+offset,this->padNode->size());
81 QRectF rec(this->padNode->pos()+offset,this->padNode->size());
74 ellipse->setRect(rec);
82 ellipse->setRect(rec);
75 ellipse->setZValue(-context->layer(padNode->layers().at(i)));
83 ellipse->setZValue(-context->layer(padNode->layers().at(i)));
76 this->addToGroup(ellipse);
84 this->addToGroup(ellipse);
77 }
85 }
78 }
86 }
79 setOpacity(0.6);
87 setOpacity(0.6);
80 }
88 }
@@ -1,63 +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->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;
42 this->path.addEllipse(this->viaNode->pos(),(this->viaNode->size().width()/2)-thickness,(this->viaNode->size().height()/2)-thickness);
40 this->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
43 this->setCacheMode(QGraphicsItem::DeviceCoordinateCache);
41 this->setFlags(ItemIsMovable|ItemIsSelectable|ItemIsFocusable);
44 this->setFlags(ItemIsMovable|ItemIsSelectable|ItemIsFocusable);
42 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);
43
46
44 for(int i=0;i<this->viaNode->layers().count();i++)
47 for(int i=0;i<this->viaNode->layers().count();i++)
45 {
48 {
46 QGraphicsEllipseItem* ellipse = new QGraphicsEllipseItem();
49 QGraphicsPathItem* pathitem = new QGraphicsPathItem();
47 QPen pen = ellipse->pen();
50 QPen pen = pathitem->pen();
48 double thickness = (this->viaNode->size().width()-this->viaNode->drill())/2;
51 pen.setWidthF(0.01);
49 pen.setWidthF(thickness);
50
52
51 ellipse->setPen(pen);
53 pathitem->setPen(pen);
52 // QBrush brush = ellipse->brush();
54 QBrush brush = pathitem->brush();
53 // brush.setStyle(Qt::SolidPattern);
55 brush.setStyle(Qt::SolidPattern);
54 // brush.setColor(context->layerColor(this->viaNode->layers().at(i)));
56 brush.setColor(context->layerColor(this->viaNode->layers().at(i)));
55 // ellipse->setBrush(brush);
57 pathitem->setBrush(brush);
56 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));
57 ellipse->setRect(rec);
59 // pathitem->setRect(rec);
58 ellipse->setZValue(-context->layer(viaNode->layers().at(i)));
60 pathitem->setZValue(-context->layer(viaNode->layers().at(i)));
59 this->addToGroup(ellipse);
61 pathitem->setPath(path);
62 this->addToGroup(pathitem);
60 }
63 }
61
64
62 setOpacity(0.6);
65 setOpacity(0.6);
63 }
66 }
@@ -1,46 +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 PCBVIA_H
22 #ifndef PCBVIA_H
23 #define PCBVIA_H
23 #define PCBVIA_H
24 #include <QObject>
24 #include <QObject>
25 #include <QWidget>
25 #include <QWidget>
26 #include <QGraphicsRectItem>
26 #include <QGraphicsRectItem>
27 #include <QGraphicsItemGroup>
27 #include <QGraphicsItemGroup>
28 #include <pcbcontext.h>
28 #include <pcbcontext.h>
29 #include <qicadpcb.h>
29 #include <qicadpcb.h>
30 #include <QPainterPath>
30
31
31 class PCBVia: public QGraphicsItemGroup
32 class PCBVia: public QGraphicsItemGroup
32 {
33 {
33 public:
34 public:
34 PCBVia(QIlib::QIcadPcbVia* viaNode,PCBContext* context);
35 PCBVia(QIlib::QIcadPcbVia* viaNode,PCBContext* context);
35 PCBVia(QIlib::QIcadPcbVia* viaNode,QPointF offset,PCBContext* context);
36 PCBVia(QIlib::QIcadPcbVia* viaNode,QPointF offset,PCBContext* context);
36 private:
37 private:
37 void init(QPointF offset);
38 void init(QPointF offset);
38 QIlib::QIcadPcbVia* viaNode;
39 QIlib::QIcadPcbVia* viaNode;
39 QString name;
40 QString name;
40 QPointF pos;
41 QPointF pos;
41 QRectF size;
42 QRectF size;
42 QList<int> layers;
43 QList<int> layers;
43 PCBContext* context;
44 PCBContext* context;
45 QPainterPath path;
44 };
46 };
45
47
46 #endif // PCBVIA_H
48 #endif // PCBVIA_H
General Comments 0
You need to be logged in to leave comments. Login now