-
Notifications
You must be signed in to change notification settings - Fork 0
/
QEagleLib.h
2459 lines (2385 loc) · 90.1 KB
/
QEagleLib.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
QEagleLib * Qt based library for managing Eagle CAD XML files
Copyright (C) 2012-2021 Mirai Computing ([email protected])
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
//------------------------------------------------------------------------------
#ifndef QEAGLELIB_H
#define QEAGLELIB_H
//------------------------------------------------------------------------------
#include <QList>
#include <QString>
#include <QtXml>
//------------------------------------------------------------------------------
//#include ""
//------------------------------------------------------------------------------
#define EAGLE_DTD_MIN_VERSION 6.4
#define EAGLE_DTD_MAX_VERSION 8.0
#define EAGLE_DTD_VERSION EAGLE_DTD_MAX_VERSION
#define STRING(s) #s
/*
This file implements Eagle CAD file data structures as described in "eagle.dtd"
*/
namespace Eagle
{
typedef int TLayer;
typedef int TClass;
typedef double TCoord; // coordinates, given in millimeters
typedef double TDimension; // dimensions, given in millimeters
QString encodeExtent(const int startLayer, const int stopLayer);
void decodeExtent(const QString& value, int& startLayer, int& stopLayer);
class CVersionNumber
{
public:
CVersionNumber();
CVersionNumber(const CVersionNumber& version);
CVersionNumber(const unsigned int major, const unsigned int minor);
CVersionNumber(const QString& str);
virtual ~CVersionNumber();
public:
void assign(const CVersionNumber& version);
void assign(const unsigned int major, const unsigned int minor);
void assign(const QString& str);
//
unsigned int major(void) const { return m_Major; }
unsigned int minor(void) const { return m_Minor; }
QString toString(void) const;
//
bool operator ==(const CVersionNumber& version);
bool operator !=(const CVersionNumber& version);
bool operator >=(const CVersionNumber& version);
bool operator <=(const CVersionNumber& version);
bool operator >(const CVersionNumber& version);
bool operator <(const CVersionNumber& version);
CVersionNumber& operator =(const CVersionNumber& version);
private:
unsigned int m_Major;
unsigned int m_Minor;
};
class CEagleDocument;
class CEagleDocumentOptions
{
friend class CEagleDocument;
public:
CEagleDocumentOptions(const CEagleDocumentOptions& options);
CEagleDocumentOptions(void);
virtual ~CEagleDocumentOptions(void);
public:
bool writeDefaults() const { return m_WriteDefaults; }
CVersionNumber version() const { return m_Version; }
protected:
void setWriteDefaults(const bool value);
void setVersion(const CVersionNumber& value);
private:
bool m_WriteDefaults;
CVersionNumber m_Version;
};
class CEntity
{
public:
CEntity(void);
virtual ~CEntity(void);
public:
static QString toString(const bool value);
public:
virtual void clear(void);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
};
// miscellaneous objects
class CSettings: public CEntity
{
public:
enum VerticalText {vtUp, vtDown};
public:
CSettings(const CSettings& settings);
CSettings(void);
virtual ~CSettings(void);
public:
static QString toString(const CSettings::VerticalText value);
public:
virtual void operator =(const CSettings& settings);
virtual void clear(void);
virtual void assign(const CSettings& settings);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
bool alwaysVectorFont(void) { return m_AlwaysVectorFont; }
CSettings::VerticalText verticalText(void) { return m_VerticalText; }
// setters
void setAlwaysVectorFont(const bool value) { m_AlwaysVectorFont = value; }
void setVerticalText(const CSettings::VerticalText value) { m_VerticalText = value; }
protected:
bool m_AlwaysVectorFont; // implied
CSettings::VerticalText m_VerticalText; // default = up
};
class CGrid: public CEntity
{
public:
enum Unit {guMic, guMM, guMil, guInch};
enum Style {gsLines, gsDots};
public:
CGrid(const CGrid& grid);
CGrid(void);
virtual ~CGrid(void);
public:
static QString toString(const CGrid::Unit value);
static QString toString(const CGrid::Style value);
static bool stringToUnit(const QString& name, CGrid::Unit& value);
public:
virtual void operator =(const CGrid& grid);
virtual void clear(void);
virtual void assign(const CGrid& grid);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
double distance(void) { return m_Distance; }
CGrid::Unit unitDist(void) { return m_UnitDist; }
CGrid::Unit unit(void) { return m_Unit; }
CGrid::Style style(void) { return m_Style; }
int multiple(void) { return m_Multiple; }
bool display(void) { return m_Display; }
double altDistance(void) { return m_AltDistance; }
CGrid::Unit altUnitDist(void) { return m_AltUnitDist; }
CGrid::Unit altUnit(void) { return m_AltUnit; }
// setters
void setDistance(const double value) { m_Distance = value; }
void setUnitDist(const CGrid::Unit value) { m_UnitDist = value; }
void setUnit(const CGrid::Unit value) { m_Unit = value; }
void setStyle(const CGrid::Style value) { m_Style = value; }
void setMultiple(const int value) { m_Multiple = value; }
void setDisplay(const bool value) { m_Display = value; }
void setAltDistance(const double value) { m_AltDistance = value; }
void setAltUnitDist(const CGrid::Unit value) { m_AltUnitDist = value; }
void setAltUnit(const CGrid::Unit value) { m_AltUnit = value; }
protected:
double m_Distance; // implied
CGrid::Unit m_UnitDist; // implied
CGrid::Unit m_Unit; // implied
CGrid::Style m_Style; // default = lines
int m_Multiple; // default = 1
bool m_Display; // display = false
double m_AltDistance; // implied
CGrid::Unit m_AltUnitDist; // implied
CGrid::Unit m_AltUnit; // implied
};
class CLayer: public CEntity
{
public:
static const TLayer LAYER_TOP = 1;
static const TLayer LAYER_LAYER2 = 2;
static const TLayer LAYER_LAYER3 = 3;
static const TLayer LAYER_LAYER4 = 4;
static const TLayer LAYER_LAYER5 = 5;
static const TLayer LAYER_LAYER6 = 6;
static const TLayer LAYER_LAYER7 = 7;
static const TLayer LAYER_LAYER8 = 8;
static const TLayer LAYER_LAYER9 = 9;
static const TLayer LAYER_LAYER10 = 10;
static const TLayer LAYER_LAYER11 = 11;
static const TLayer LAYER_LAYER12 = 12;
static const TLayer LAYER_LAYER13 = 13;
static const TLayer LAYER_LAYER14 = 14;
static const TLayer LAYER_LAYER15 = 15;
static const TLayer LAYER_BOTTOM = 16;
static const TLayer LAYER_PADS = 17;
static const TLayer LAYER_VIAS = 18;
static const TLayer LAYER_UNROUTED = 19;
static const TLayer LAYER_DIMENSION = 20;
static const TLayer LAYER_TPLACE = 21;
static const TLayer LAYER_BPLACE = 22;
static const TLayer LAYER_TORIGINS = 23;
static const TLayer LAYER_BORIGINS = 24;
static const TLayer LAYER_TNAMES = 25;
static const TLayer LAYER_BNAMES = 26;
static const TLayer LAYER_TVALUES = 27;
static const TLayer LAYER_BVALUES = 28;
static const TLayer LAYER_TSTOP = 29;
static const TLayer LAYER_BSTOP = 30;
static const TLayer LAYER_TCREAM = 31;
static const TLayer LAYER_BCREAM = 32;
static const TLayer LAYER_TFINISH = 33;
static const TLayer LAYER_BFINISH = 34;
static const TLayer LAYER_TGLUE = 35;
static const TLayer LAYER_BGLUE = 36;
static const TLayer LAYER_TTEST = 37;
static const TLayer LAYER_BTEST = 38;
static const TLayer LAYER_TKEEPOUT = 39;
static const TLayer LAYER_BKEEPOUT = 40;
static const TLayer LAYER_TRESTRICT = 41;
static const TLayer LAYER_BRESTRICT = 42;
static const TLayer LAYER_VRESTRICT = 43;
static const TLayer LAYER_DRILLS = 44;
static const TLayer LAYER_HOLES = 45;
static const TLayer LAYER_MILLING = 46;
static const TLayer LAYER_MEASURES = 47;
static const TLayer LAYER_DOCUMENT = 48;
static const TLayer LAYER_REFERENCE = 49;
static const TLayer LAYER_TDOCU = 51;
static const TLayer LAYER_BDOCU = 52;
static const TLayer LAYER_MODULES = 90;
static const TLayer LAYER_NETS = 91;
static const TLayer LAYER_BUSSES = 92;
static const TLayer LAYER_PINS = 93;
static const TLayer LAYER_SYMBOLS = 94;
static const TLayer LAYER_NAMES = 95;
static const TLayer LAYER_VALUES = 96;
static const TLayer LAYER_INFO = 97;
static const TLayer LAYER_GUIDE = 98;
//
static const TLayer LAYER__INVALID = 0;
static const TLayer LAYER__FIRST = 1;
static const TLayer LAYER__LAST = 98;
public:
CLayer(const TLayer layer, const QString& name, const int color,
const int fill, const bool visible, const bool active);
CLayer(const CLayer& layer);
CLayer(void);
virtual ~CLayer(void);
public:
static QString layerName(const TLayer layer);
static TLayer layerNumber(const QString& name);
virtual void operator =(const CLayer& layer);
virtual void clear(void);
virtual void assign(const CLayer& layer);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
TLayer layer(void) { return m_Layer; }
QString name(void) { return m_Name; }
int color(void) { return m_Color; }
int fill(void) { return m_Fill; }
bool visible(void) { return m_Visible; }
bool active(void) { return m_Active; }
// setters
void setLayer(const TLayer value) { m_Layer = value; }
void setName(const QString& value) { m_Name = value; }
void setColor(const int value) { m_Color = value; }
void setFill(const int value) { m_Fill = value; }
void setVisible(const bool value) { m_Visible = value; }
void setActive(const bool value) { m_Active = value; }
protected:
TLayer m_Layer; // required
QString m_Name; // required
int m_Color; // required
int m_Fill; // required
bool m_Visible; // default = true
bool m_Active; // default = true
};
class CClearance: public CEntity
{
public:
CClearance(const CClearance& clearance);
CClearance(void);
virtual ~CClearance(void);
public:
virtual void operator =(const CClearance& clearance);
virtual void clear(void);
virtual void assign(const CClearance& clearance);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
TClass getClass(void) { return m_Class; }
TDimension getValue(void) { return m_Value; }
// setters
void setClass(const TClass value) { m_Class = value; }
void setValue(const TDimension value) { m_Value = value; }
protected:
TClass m_Class; // required
TDimension m_Value; // default = 0
};
class CDescription: public CEntity
{
public:
CDescription(const CDescription& description);
CDescription(void);
virtual ~CDescription(void);
public:
virtual void operator =(const CDescription& description);
virtual void clear(void);
virtual void assign(const CDescription& description);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
QString description(void) { return m_Description; }
QString language(void) { return m_Language; }
// setters
void setDescription(const QString& value) { m_Description = value; }
void setLanguage(const QString& value) { m_Language = value; }
protected:
QString m_Description;
QString m_Language; // default = "en"
};
class CParam: public CEntity
{
public:
CParam(const CParam& param);
CParam(void);
virtual ~CParam(void);
public:
virtual void operator =(const CParam& param);
virtual void clear(void);
virtual void assign(const CParam& param);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
QString name(void) { return m_Name; }
QString value(void) { return m_Value; }
// setters
void setName(const QString value) { m_Name = value; }
void setValue(const QString value) { m_Value = value; }
protected:
QString m_Name; // required
QString m_Value; // required
};
class CApproved: public CEntity
{
public:
CApproved(const CApproved& error);
CApproved(void);
virtual ~CApproved(void);
public:
virtual void operator =(const CApproved& error);
virtual void clear(void);
virtual void assign(const CApproved& error);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
QString hash(void) { return m_Hash; }
// setters
void setHash(const QString& value) { m_Hash = value; }
protected:
QString m_Hash; // required
};
class CPass: public CEntity
{
public:
CPass(const CPass& pass);
CPass(void);
virtual ~CPass(void);
public:
virtual void operator =(const CPass& pass);
virtual void clear(void);
virtual void assign(const CPass& pass);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
QList<CParam*>& params(void) { return m_Params; }
CParam* param(const int index) const { return m_Params[index]; }
QString name(void) { return m_Name; }
QString refer(void) { return m_Refer; }
bool active(void) { return m_Active; }
// setters
void setName(const QString& value) { m_Name = value; }
void setRefer(const QString& value) { m_Refer = value; }
void setActive(const bool value) { m_Active = value; }
protected:
QList<CParam*> m_Params;
QString m_Name; // required
QString m_Refer; // implied
bool m_Active; // default = true
};
class CClass: public CEntity
{
public:
CClass(const CClass& value);
CClass(void);
virtual ~CClass(void);
public:
virtual void operator =(const CClass& value);
virtual void clear(void);
virtual void assign(const CClass& value);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
QList<CClearance*>& clearances(void) { return m_Clearances; }
CClearance* clearance(const int index) const { return m_Clearances[index]; }
TClass number(void) { return m_Number; }
QString name(void) { return m_Name; }
TDimension width(void) { return m_Width; }
TDimension drill(void) { return m_Drill; }
// setters
void setNumber(const TClass value) { m_Number = value; }
void setName(const QString& value) { m_Name = value; }
void setWidth(const TDimension value) { m_Width = value; }
void setDrill(const TDimension value) { m_Drill = value; }
protected:
QList<CClearance*> m_Clearances;
TClass m_Number; // required
QString m_Name; // required
TDimension m_Width; // default = 0
TDimension m_Drill; // default = 0
};
class CDesignRule: public CEntity
{
public:
CDesignRule(const CDesignRule& designRule);
CDesignRule(void);
virtual ~CDesignRule(void);
public:
virtual void operator =(const CDesignRule& designRule);
virtual void clear(void);
virtual void assign(const CDesignRule& designRule);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
QList<CDescription*>& description(void) { return m_Descriptions; }
CDescription* description(const int index) { return m_Descriptions[index]; }
QList<CParam*>& param(void) { return m_Params; }
CParam* param(const int index) { return m_Params[index]; }
QString name(void) { return m_Name; }
// setters
void setName(const QString& value) { m_Name = value; }
protected:
QList<CDescription*> m_Descriptions;
QList<CParam*> m_Params;
QString m_Name; // required
};
// basic objects
class CVariantDef: public CEntity
{
public:
CVariantDef(const CVariantDef& variantDef);
CVariantDef(void);
virtual ~CVariantDef(void);
public:
virtual void operator =(const CVariantDef& variantDef);
virtual void clear(void);
virtual void assign(const CVariantDef& variantDef);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
QString name(void) { return m_Name; }
bool current(void) { return m_Current; }
// setters
void setName(const QString& value) { m_Name = value; }
void setValue(const bool value) { m_Current = value; }
protected:
QString m_Name; // required
bool m_Current; // default = false
};
class CVariant: public CEntity
{
public:
CVariant(const CVariant& variant);
CVariant(void);
virtual ~CVariant(void);
public:
virtual void operator =(const CVariant& variant);
virtual void clear(void);
virtual void assign(const CVariant& variant);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
QString name(void) { return m_Name; }
bool populate(void) { return m_Populate; }
QString value(void) { return m_Value; }
QString technology(void) { return m_Technology; }
// setters
void setName(const QString& value) { m_Name = value; }
void setPopulate(const bool value) { m_Populate = value; }
void setValue(const QString& value) { m_Value = value; }
void setTechnology(const QString& value) { m_Technology = value; }
protected:
QString m_Name; // required
bool m_Populate; // default = true
QString m_Value; // implied
QString m_Technology; // implied
};
class CGate: public CEntity
{
public:
enum AddLevel {alMust, alCan, alNext, alRequest, alAlways};
public:
CGate(const QString& name, const QString& symbol, const TCoord x, const TCoord y,
const CGate::AddLevel addLevel, const int swapLevel);
CGate(const CGate& gate);
CGate(void);
virtual ~CGate(void);
public:
static QString toString(const CGate::AddLevel value);
public:
virtual void operator =(const CGate& gate);
virtual void clear(void);
virtual void assign(const CGate& gate);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
QString name(void) { return m_Name; }
QString symbol(void) { return m_Symbol; }
TCoord x(void) { return m_X; }
TCoord y(void) { return m_Y; }
CGate::AddLevel addLevel(void) { return m_AddLevel; }
int swapLevel(void) { return m_SwapLevel; }
// setters
void setName(const QString& value) { m_Name = value; }
void setSymbol(const QString& value) { m_Symbol = value; }
void setX(const TCoord value) { m_X = value; }
void setY(const TCoord value) { m_Y = value; }
void setAddLevel(const CGate::AddLevel value) { m_AddLevel = value; }
void setSwapLevel(const int value) { m_SwapLevel = value; }
protected:
QString m_Name; // required
QString m_Symbol; // required
TCoord m_X; // required
TCoord m_Y; // required
CGate::AddLevel m_AddLevel; // default = next
int m_SwapLevel; //default = 0
};
class CWire: public CEntity
{
public:
enum Style {wsContinuous, wsLongDash, wsShortDash, wsDashDot};
enum Cap {wcFlat, wcRound};
public:
CWire(const TCoord x1, const TCoord y1, const TCoord x2, const TCoord y2,
const TDimension width, const double curve, const TLayer layer,
const CWire::Style style, const CWire::Cap cap, const QString& extent);
CWire(const CWire& wire);
CWire(void);
virtual ~CWire(void);
public:
static QString toString(const CWire::Style value);
static QString toString(const CWire::Cap value);
public:
virtual void operator =(const CWire& wire);
virtual void clear(void);
virtual void assign(const CWire& wire);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
TCoord x1(void) { return m_X1; }
TCoord y1(void) { return m_Y1; }
TCoord x2(void) { return m_X2; }
TCoord y2(void) { return m_Y2; }
TDimension width(void) { return m_Width; }
TLayer layer(void) { return m_Layer; }
QString extent(void) { return m_Extent; }
CWire::Style style(void) { return m_Style; }
double curve(void) { return m_Curve; }
CWire::Cap cap(void) { return m_Cap; }
// setters
void setX1(const TCoord value) { m_X1 = value; }
void setY1(const TCoord value) { m_Y1 = value; }
void setX2(const TCoord value) { m_X2 = value; }
void setY2(const TCoord value) { m_Y2 = value; }
void setWidth(const TDimension value) { m_Width = value; }
void setLayer(const TLayer value) { m_Layer = value; }
void setExtent(const QString& value) { m_Extent = value; }
void setStyle(const CWire::Style value) { m_Style = value; }
void setCurve(const double value) { m_Curve = value; }
void setCap(const CWire::Cap value) { m_Cap = value; }
//
double chord(void) const;
double length(void) const;
double radius(void) const;
protected:
TCoord m_X1; // required
TCoord m_Y1; // required
TCoord m_X2; // required
TCoord m_Y2; // required
TDimension m_Width; // required
TLayer m_Layer; // required
QString m_Extent; // implied, the layers an airwire extends through, given as "topmost-bottompost"
CWire::Style m_Style; // default = continuous
double m_Curve; // default = 0
CWire::Cap m_Cap; // default = round, only applicable if m_Curve > 0
};
class CDimension: public CEntity
{
public:
enum Type {dtParallel, dtHorizontal, dtVertical, dtRadius, dtDiameter, dtLeader};
public:
CDimension(const CDimension& dimension);
CDimension(void);
virtual ~CDimension(void);
public:
static QString toString(const CDimension::Type value);
public:
virtual void operator =(const CDimension& dimension);
virtual void clear(void);
virtual void assign(const CDimension& dimension);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
static const int DEFAULT_EXT_WIDTH = 0;
static const int DEFAULT_EXT_LENGTH = 0;
static const int DEFAULT_EXT_OFFSET = 0;
static const int DEFAULT_TEXT_RATIO = 8;
static const CGrid::Unit DEFAULT_GRID_UNIT = CGrid::guMM;
static const int DEFAULT_PRECISION = 2;
public:
// getters
TCoord x1(void) { return m_X1; }
TCoord y1(void) { return m_Y1; }
TCoord x2(void) { return m_X2; }
TCoord y2(void) { return m_Y2; }
TCoord x3(void) { return m_X3; }
TCoord y3(void) { return m_Y3; }
TLayer layer(void) { return m_Layer; }
CDimension::Type dimType(void) { return m_DType; }
TDimension width(void) { return m_Width; }
TDimension extWidth(void) { return m_ExtWidth; }
TDimension extLength(void) { return m_ExtLength; }
TDimension extOffset(void) { return m_ExtOffset; }
TDimension textSize(void) { return m_TextSize; }
int textRatio(void) { return m_TextRatio; }
CGrid::Unit gridUnit(void) { return m_GridUnit; }
int precision(void) { return m_Precision; }
bool visible(void) { return m_Visible; }
// setters
void setX1(const TCoord value) { m_X1 = value; }
void setY1(const TCoord value) { m_Y1 = value; }
void setX2(const TCoord value) { m_X2 = value; }
void setY2(const TCoord value) { m_Y2 = value; }
void setX3(const TCoord value) { m_X3 = value; }
void setY3(const TCoord value) { m_Y3 = value; }
void setLayer(const TLayer value) { m_Layer = value; }
void setDimType(const CDimension::Type value) { m_DType = value; }
void setWidth(const TDimension value) { m_Width = value; }
void setExtWidth(const TDimension value) { m_ExtWidth = value; }
void setExtLength(const TDimension value) { m_ExtLength = value; }
void setExtOffset(const TDimension value) { m_ExtOffset = value; }
void setTextSize(const TDimension value) { m_TextSize = value; }
void setTextRatio(const int value) { m_TextRatio = value; }
void setGridUnit(const CGrid::Unit value) { m_GridUnit = value; }
void setPrecision(const int value) { m_Precision = value; }
void setVisible(const bool value) { m_Visible = value; }
protected:
TCoord m_X1; // required
TCoord m_Y1; // required
TCoord m_X2; // required
TCoord m_Y2; // required
TCoord m_X3; // required
TCoord m_Y3; // required
TLayer m_Layer; // required
CDimension::Type m_DType; // default = parallel
TDimension m_Width; // required
TDimension m_ExtWidth; // default = 0
TDimension m_ExtLength; // default = 0
TDimension m_ExtOffset; // default = 0
TDimension m_TextSize; // required
int m_TextRatio; // default = 8
CGrid::Unit m_GridUnit; // default == mm
int m_Precision; // default = 2
bool m_Visible; // default = false
};
class CText: public CEntity
{
public:
enum Font {tfVector, tfProportional, tfFixed};
enum Align {taBottomLeft, taBottomCenter, taBottomRight,
taCenterLeft, taCenter, taCenterRight,
taTopLeft, taTopCenter, taTopRight};
public:
CText(const QString& text, const TCoord x, const TCoord y,
const TDimension size, const TLayer layer,
const CText::Font font = CText::DEFAULT_FONT,
const int ratio = CText::DEFAULT_RATIO,
const double rotation = CText::DEFAULT_ROTATION,
const bool reflection = false,
const bool spin = false,
const CText::Align align = CText::DEFAULT_ALIGN,
const int distance = CText::DEFAULT_DISTANCE);
CText(const CText& text);
CText(void);
virtual ~CText(void);
public:
static QString toString(const CText::Font value);
static QString toString(const CText::Align value);
static CText::Align fromString(const QString& value);
public:
virtual void operator =(const CText& text);
virtual void clear(void);
virtual void assign(const CText& text);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
static const CText::Font DEFAULT_FONT = CText::tfProportional;
static const int DEFAULT_RATIO = 8;
static const double DEFAULT_ROTATION = 0.0;
static const CText::Align DEFAULT_ALIGN = CText::taBottomLeft;
static const int DEFAULT_DISTANCE = 50;
public:
// getters
QString text(void) const { return m_Text; }
TCoord x(void) const { return m_X; }
TCoord y(void) const { return m_Y; }
TDimension size(void) const { return m_Size; }
TLayer layer(void) const { return m_Layer; }
CText::Font font(void) const { return m_Font; }
int ratio(void) const { return m_Ratio; }
double rotation(void) const { return m_Rotation; }
bool reflection(void) const { return m_Reflection; }
bool spin(void) const { return m_Spin; }
CText::Align align(void) const { return m_Align; }
int distance(void) const { return m_Distance; }
// setters
void setText(const QString& value) { m_Text = value; }
void setX(const TCoord value) { m_X = value; }
void setY(const TCoord value) { m_Y = value; }
void setSize(const TDimension value) { m_Size = value; }
void setLayer(const TLayer value) { m_Layer = value; }
void setFont(const CText::Font value) { m_Font = value; }
void setRatio(const int value) { m_Ratio = value; }
void setRotation(const double value) { m_Rotation = std::min(std::max(value,0.0),359.999); }
void setReflection(const bool value) { m_Reflection = value; }
void setSpin(const bool value) { m_Spin = value; }
void setAlign(const CText::Align value) { m_Align = value; }
void setDistance(const int value) { m_Distance = value; }
protected:
QString m_Text;
TCoord m_X; // required
TCoord m_Y; // required
TDimension m_Size; // required
TLayer m_Layer; // required
CText::Font m_Font; // default = proportional
int m_Ratio; // default = 8
double m_Rotation; // default = 0, valid 0 .. 359.9(9)
bool m_Reflection; // default = false;
bool m_Spin; // default = false;
CText::Align m_Align; // default = bottom-left
int m_Distance; // default = 50
};
class CCircle: public CEntity
{
public:
CCircle(const TCoord x, const TCoord y, const TCoord radius,
const TDimension width, const TLayer layer);
CCircle(const CCircle& circle);
CCircle(void);
virtual ~CCircle(void);
public:
virtual void operator =(const CCircle& circle);
virtual void clear(void);
virtual void assign(const CCircle& circle);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
TCoord x(void) { return m_X; }
TCoord y(void) { return m_Y; }
TCoord radius(void) { return m_Radius; }
TDimension width(void) { return m_Width; }
TLayer layer(void) { return m_Layer; }
// setters
void setX(const TCoord value) { m_X = value; }
void setY(const TCoord value) { m_Y = value; }
void setRadius(const TCoord value) { m_Radius = value; }
void setWidth(const TDimension value) { m_Width = value; }
void setLayer(const TLayer value) { m_Layer = value; }
protected:
TCoord m_X; // required
TCoord m_Y; // required
TCoord m_Radius; // required
TDimension m_Width; // required
TLayer m_Layer; // required
};
class CRectangle: public CEntity
{
public:
CRectangle(const TCoord x1, const TCoord y1, const TCoord x2, const TCoord y2,
const TLayer layer, const double rotation);
CRectangle(const CRectangle& rectangle);
CRectangle(void);
virtual ~CRectangle(void);
public:
virtual void operator =(const CRectangle& rectangle);
virtual void clear(void);
virtual void assign(const CRectangle& rectangle);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
static const double DEFAULT_ROTATION = 0.0;
public:
// getters
TCoord x1(void) { return m_X1; }
TCoord y1(void) { return m_Y1; }
TCoord x2(void) { return m_X2; }
TCoord y2(void) { return m_Y2; }
TLayer layer(void) { return m_Layer; }
double rotation(void) { return m_Rotation; }
// setters
void setX1(const TCoord value) { m_X1 = value; }
void setY1(const TCoord value) { m_Y1 = value; }
void setX2(const TCoord value) { m_X2 = value; }
void setY2(const TCoord value) { m_Y2 = value; }
void setLayer(const TLayer value) { m_Layer = value; }
void setRotation(const double value) { m_Rotation = std::min(std::max(value,0.0),359.999); }
protected:
TCoord m_X1; // required
TCoord m_Y1; // required
TCoord m_X2; // required
TCoord m_Y2; // required
TLayer m_Layer; // required
double m_Rotation; // default = 0, valid 0 .. 359.9(9)
};
class CFrame: public CEntity
{
public:
CFrame(const CFrame& frame);
CFrame(void);
virtual ~CFrame(void);
public:
virtual void operator =(const CFrame& frame);
virtual void clear(void);
virtual void assign(const CFrame& frame);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
TCoord x1(void) { return m_X1; }
TCoord y1(void) { return m_Y1; }
TCoord x2(void) { return m_X2; }
TCoord y2(void) { return m_Y2; }
int columns(void) { return m_Columns; }
int rows(void) { return m_Rows; }
TLayer layer(void) { return m_Layer; }
bool borderLeft(void) { return m_BorderLeft; }
bool borderTop(void) { return m_BorderTop; }
bool borderRight(void) { return m_BorderRight; }
bool borderBottom(void) { return m_BorderBottom; }
// setters
void setX1(const TCoord value) { m_X1 = value; }
void setY1(const TCoord value) { m_Y1 = value; }
void setX2(const TCoord value) { m_X2 = value; }
void setY2(const TCoord value) { m_Y2 = value; }
void setColumns(const int value) { m_Columns = value; }
void setRows(const int value) { m_Rows = value; }
void setLayer(const TLayer value) { m_Layer = value; }
void setBorderLeft(const bool value) { m_BorderLeft = value; }
void setBorderTop(const bool value) { m_BorderTop = value; }
void setBorderRight(const bool value) { m_BorderRight = value; }
void setBorderBottom(const bool value) { m_BorderBottom = value; }
protected:
TCoord m_X1; // required
TCoord m_Y1; // required
TCoord m_X2; // required
TCoord m_Y2; // required
int m_Columns; // required
int m_Rows; // required
TLayer m_Layer; // required
bool m_BorderLeft; // default = true
bool m_BorderTop; // default = true
bool m_BorderRight; // default = true
bool m_BorderBottom; // default = true
};
class CHole: public CEntity
{
public:
CHole(const TCoord x, const TCoord y, const TDimension drill);
CHole(const CHole& hole);
CHole(void);
virtual ~CHole(void);
public:
virtual void operator =(const CHole& hole);
virtual void clear(void);
virtual void assign(const CHole& hole);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
// getters
TCoord x(void) { return m_X; }
TCoord y(void) { return m_Y; }
TDimension drill(void) { return m_Drill; }
// setters
void setX(const TCoord value) { m_X = value; }
void setY(const TCoord value) { m_Y = value; }
void setDrill(const TDimension value) { m_Drill = value; }
protected:
TCoord m_X; // required
TCoord m_Y; // required
TDimension m_Drill; // required
};
class CPad: public CEntity
{
public:
enum Shape {psSquare, psRound, psOctagon, psLong, psOffset};
public:
CPad(const CPad& pad);
CPad(void);
virtual ~CPad(void);
public:
static QString toString(const CPad::Shape value);
public:
virtual void operator =(const CPad& pad);
virtual void clear(void);
virtual void assign(const CPad& pad);
virtual void scale(const double factor);
virtual void show(std::ostream& out, const int level = 0);
virtual bool readFromXML(const QDomElement& root, const CEagleDocumentOptions& options);
virtual bool writeToXML(QDomDocument& host, QDomElement& root, const CEagleDocumentOptions& options);
public:
static const TDimension DEFAULT_DIAMETER = 0.0;
static const CPad::Shape DEFAULT_SHAPE = CPad::psRound;