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