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