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