1
/******************************************************************************
2
** libDXFrw - Library to read/write DXF files (ascii & binary) **
4
** Copyright (C) 2011 Rallaz, rallazz@gmail.com **
6
** This library is free software, licensed under the terms of the GNU **
7
** General Public License as published by the Free Software Foundation, **
8
** either version 2 of the License, or (at your option) any later version. **
9
** You should have received a copy of the GNU General Public License **
10
** along with this program. If not, see <http://www.gnu.org/licenses/>. **
11
******************************************************************************/
13
#ifndef DRW_ENTITIES_H
14
#define DRW_ENTITIES_H
65
//! Base class for entities
67
* Base class for entities
72
//initializes default values
76
color = 256; // default BYLAYER (256)
80
lWeight = DRW_LW_Conv::widthByLayer; // default BYLAYER (dxf -1, dwg 29)
81
handleBlock = space = 0; // default ModelSpace (0) & handleBlock = no handle (0)
82
haveExtrusion = false;
83
color24 = -1; //default -1 not set
85
virtual~DRW_Entity() {}
87
DRW_Entity(const DRW_Entity& d) {
90
handleBlock = d.handleBlock;
92
lineType = d.lineType;
95
colorName = d.colorName;
96
ltypeScale = d.ltypeScale;
100
haveExtrusion = d.haveExtrusion;
103
virtual void applyExtrusion() = 0;
105
void parseCode(int code, dxfReader *reader);
106
void calculateAxis(DRW_Coord extPoint);
107
void extrudePoint(DRW_Coord extPoint, DRW_Coord *point);
110
enum DRW::ETYPE eType; /*!< enum: entity type, code 0 */
111
int handle; /*!< entity identifier, code 5 */
112
int handleBlock; /*!< Soft-pointer ID/handle to owner BLOCK_RECORD object, code 330 */
113
UTF8STRING layer; /*!< layer name, code 8 */
114
UTF8STRING lineType; /*!< line type, code 6 */
115
int color; /*!< entity color, code 62 */
116
enum DRW_LW_Conv::lineWidth lWeight; /*!< entity lineweight, code 370 */
117
double ltypeScale; /*!< linetype scale, code 48 */
118
bool visible; /*!< entity visibility, code 60 */
119
int color24; /*!< 24-bit color, code 420 */
120
std::string colorName; /*!< color name, code 430 */
121
int space; /*!< space indicator 0 = model, 1 paper, code 67*/
122
bool haveExtrusion; /*!< set to true if the entity have extrusion*/
129
//! Class to handle point entity
131
* Class to handle point entity
134
class DRW_Point : public DRW_Entity {
138
basePoint.z = extPoint.x = extPoint.y = 0;
143
virtual void applyExtrusion(){}
145
void parseCode(int code, dxfReader *reader);
148
DRW_Coord basePoint; /*!< base point, code 10, 20 & 30 */
149
double thickness; /*!< thickness, code 39 */
150
DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
153
//! Class to handle line entity
155
* Class to handle line entity
158
class DRW_Line : public DRW_Point {
165
virtual void applyExtrusion(){}
166
void parseCode(int code, dxfReader *reader);
169
DRW_Coord secPoint; /*!< second point, code 11, 21 & 31 */
172
//! Class to handle ray entity
174
* Class to handle ray entity
177
class DRW_Ray : public DRW_Line {
184
//! Class to handle xline entity
186
* Class to handle xline entity
189
class DRW_Xline : public DRW_Line {
196
//! Class to handle circle entity
198
* Class to handle circle entity
201
class DRW_Circle : public DRW_Point {
207
virtual void applyExtrusion();
208
void parseCode(int code, dxfReader *reader);
211
double radious; /*!< radius, code 40 */
214
//! Class to handle arc entity
216
* Class to handle arc entity
219
class DRW_Arc : public DRW_Circle {
226
virtual void applyExtrusion(){DRW_Circle::applyExtrusion();}
227
void parseCode(int code, dxfReader *reader);
230
double staangle; /*!< start angle, code 50 in radians*/
231
double endangle; /*!< end angle, code 51 in radians */
232
int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
235
//! Class to handle ellipse entity
237
* Class to handle ellipse and elliptic arc entity
238
* Note: start/end parameter are in radians for ellipse entity but
239
* for hatch boundary are in degrees
242
class DRW_Ellipse : public DRW_Line {
245
eType = DRW::ELLIPSE;
249
void parseCode(int code, dxfReader *reader);
250
void toPolyline(DRW_Polyline *pol, int parts = 128);
251
virtual void applyExtrusion();
254
double ratio; /*!< ratio, code 40 */
255
double staparam; /*!< start parameter, code 41, 0.0 for full ellipse*/
256
double endparam; /*!< end parameter, code 42, 2*PI for full ellipse */
257
int isccw; /*!< is counter clockwise arc?, only used in hatch, code 73 */
260
//! Class to handle trace entity
262
* Class to handle trace entity
265
class DRW_Trace : public DRW_Line {
273
virtual void applyExtrusion();
274
void parseCode(int code, dxfReader *reader);
277
DRW_Coord thirdPoint; /*!< third point, code 12, 22 & 32 */
278
DRW_Coord fourPoint; /*!< four point, code 13, 23 & 33 */
281
//! Class to handle solid entity
283
* Class to handle solid entity
286
class DRW_Solid : public DRW_Trace {
292
void parseCode(int code, dxfReader *reader);
295
//! Class to handle 3dface entity
297
* Class to handle 3dface entity
300
class DRW_3Dface : public DRW_Trace {
303
eType = DRW::E3DFACE;
307
virtual void applyExtrusion(){}
308
void parseCode(int code, dxfReader *reader);
311
int invisibleflag; /*!< invisible edge flag, code 70 */
315
//! Class to handle block entries
317
* Class to handle block entries
320
class DRW_Block : public DRW_Point {
329
virtual void applyExtrusion(){}
330
void parseCode(int code, dxfReader *reader);
333
UTF8STRING name; /*!< block name, code 2 */
334
int flags; /*!< block type, code 70 */
338
//! Class to handle insert entries
340
* Class to handle insert entries
343
class DRW_Insert : public DRW_Point {
357
virtual void applyExtrusion(){DRW_Point::applyExtrusion();}
358
void parseCode(int code, dxfReader *reader);
361
UTF8STRING name; /*!< block name, code 2 */
362
double xscale; /*!< x scale factor, code 41 */
363
double yscale; /*!< y scale factor, code 42 */
364
double zscale; /*!< z scale factor, code 43 */
365
double angle; /*!< rotation angle, code 50 */
366
int colcount; /*!< column count, code 70 */
367
int rowcount; /*!< row count, code 71 */
368
double colspace; /*!< column space, code 44 */
369
double rowspace; /*!< row space, code 45 */
372
//! Class to handle lwpolyline entity
374
* Class to handle lwpolyline entity
377
class DRW_LWPolyline : public DRW_Entity {
380
eType = DRW::LWPOLYLINE;
381
elevation = thickness = width = 0.0;
383
extPoint.x = extPoint.y = 0;
388
while (!vertlist.empty()) {
392
virtual void applyExtrusion();
393
void addVertex (DRW_Vertex2D v) {
394
DRW_Vertex2D *vert = new DRW_Vertex2D();
397
vert->stawidth = v.stawidth;
398
vert->endwidth = v.endwidth;
399
vert->bulge = v.bulge;
400
vertlist.push_back(vert);
402
DRW_Vertex2D *addVertex () {
403
DRW_Vertex2D *vert = new DRW_Vertex2D();
407
vertlist.push_back(vert);
411
void parseCode(int code, dxfReader *reader);
414
int vertexnum; /*!< number of vertex, code 90 */
415
int flags; /*!< polyline flag, code 70, default 0 */
416
double width; /*!< constant width, code 43 */
417
double elevation; /*!< elevation, code 38 */
418
double thickness; /*!< thickness, code 39 */
419
DRW_Coord extPoint; /*!< Dir extrusion normal vector, code 210, 220 & 230 */
420
DRW_Vertex2D *vertex; /*!< current vertex to add data */
421
std::vector<DRW_Vertex2D *> vertlist; /*!< vertex list */
424
//! Class to handle insert entries
426
* Class to handle insert entries
429
class DRW_Text : public DRW_Line {
431
//! Vertical alignments.
433
VBaseLine = 0, /*!< Top = 0 */
434
VBottom, /*!< Bottom = 1 */
435
VMiddle, /*!< Middle = 2 */
439
//! Horizontal alignments.
441
HLeft = 0, /*!< Left = 0 */
442
HCenter, /*!< Centered = 1 */
443
HRight, /*!< Right = 2 */
444
HAligned, /*!< Aligned = 3 (if VAlign==0) */
445
HMiddle, /*!< middle = 4 (if VAlign==0) */
446
HFit /*!< fit into point = 5 (if VAlign==0) */
460
virtual void applyExtrusion(){} //RLZ TODO
461
void parseCode(int code, dxfReader *reader);
464
double height; /*!< height text, code 40 */
465
UTF8STRING text; /*!< text string, code 1 */
466
double angle; /*!< rotation angle in degrees (360), code 50 */
467
double widthscale; /*!< width factor, code 41 */
468
double oblique; /*!< oblique angle, code 51 */
469
UTF8STRING style; /*!< style name, code 7 */
470
int textgen; /*!< text generation, code 71 */
471
enum HAlign alignH; /*!< horizontal align, code 72 */
472
enum VAlign alignV; /*!< vertical align, code 73 */
475
//! Class to handle insert entries
477
* Class to handle insert entries
480
class DRW_MText : public DRW_Text {
498
alignV = (VAlign)TopLeft;
500
haveXAxis = false; //if true needed to recalculate angle
503
void parseCode(int code, dxfReader *reader);
504
void updateAngle(); //recalculate angle if 'haveXAxis' is true
507
double interlin; /*!< width factor, code 44 */
512
//! Class to handle vertex
514
* Class to handle vertex for polyline entity
517
class DRW_Vertex : public DRW_Point {
521
stawidth = endwidth = bulge = 0;
522
vindex1 = vindex2 = vindex3 = vindex4 = 0;
523
flags = identifier = 0;
525
DRW_Vertex(double sx, double sy, double sz, double b) {
526
stawidth = endwidth = 0;
527
vindex1 = vindex2 = vindex3 = vindex4 = 0;
528
flags = identifier = 0;
535
void parseCode(int code, dxfReader *reader);
538
double stawidth; /*!< Start width, code 40 */
539
double endwidth; /*!< End width, code 41 */
540
double bulge; /*!< bulge, code 42 */
542
int flags; /*!< vertex flag, code 70, default 0 */
543
double tgdir; /*!< curve fit tangent direction, code 50 */
544
int vindex1; /*!< polyface mesh vertex index, code 71, default 0 */
545
int vindex2; /*!< polyface mesh vertex index, code 72, default 0 */
546
int vindex3; /*!< polyface mesh vertex index, code 73, default 0 */
547
int vindex4; /*!< polyface mesh vertex index, code 74, default 0 */
548
int identifier; /*!< vertex identifier, code 91, default 0 */
551
//! Class to handle polyline entity
553
* Class to handle polyline entity
556
class DRW_Polyline : public DRW_Point {
559
eType = DRW::POLYLINE;
560
defstawidth = defendwidth = 0.0;
561
basePoint.x = basePoint.y = 0.0;
562
flags = vertexcount = facecount = 0;
563
smoothM = smoothN = curvetype = 0;
566
while (!vertlist.empty()) {
570
void addVertex (DRW_Vertex v) {
571
DRW_Vertex *vert = new DRW_Vertex();
572
vert->basePoint.x = v.basePoint.x;
573
vert->basePoint.y = v.basePoint.y;
574
vert->basePoint.z = v.basePoint.z;
575
vert->stawidth = v.stawidth;
576
vert->endwidth = v.endwidth;
577
vert->bulge = v.bulge;
578
vertlist.push_back(vert);
580
void appendVertex (DRW_Vertex *v) {
581
vertlist.push_back(v);
584
void parseCode(int code, dxfReader *reader);
587
int flags; /*!< polyline flag, code 70, default 0 */
588
double defstawidth; /*!< Start width, code 40, default 0 */
589
double defendwidth; /*!< End width, code 41, default 0 */
590
int vertexcount; /*!< polygon mesh M vertex or polyface vertex num, code 71, default 0 */
591
int facecount; /*!< polygon mesh N vertex or polyface face num, code 72, default 0 */
592
int smoothM; /*!< smooth surface M density, code 73, default 0 */
593
int smoothN; /*!< smooth surface M density, code 74, default 0 */
594
int curvetype; /*!< curves & smooth surface type, code 75, default 0 */
596
std::vector<DRW_Vertex *> vertlist; /*!< vertex list */
600
//! Class to handle spline entity
602
* Class to handle spline entity
605
class DRW_Spline : public DRW_Entity {
609
flags = nknots = ncontrol = nfit = 0;
612
tolknot = tolcontrol = tolfit = 0.0000001;
616
while (!controllist.empty()) {
617
controllist.pop_back();
619
while (!fitlist.empty()) {
623
virtual void applyExtrusion(){}
625
void parseCode(int code, dxfReader *reader);
628
double ex; /*!< normal vector x coordinate, code 210 */
629
double ey; /*!< normal vector y coordinate, code 220 */
630
double ez; /*!< normal vector z coordinate, code 230 */
631
double tgsx; /*!< start tangent x coordinate, code 12 */
632
double tgsy; /*!< start tangent y coordinate, code 22 */
633
double tgsz; /*!< start tangent z coordinate, code 32 */
634
double tgex; /*!< end tangent x coordinate, code 13 */
635
double tgey; /*!< end tangent y coordinate, code 23 */
636
double tgez; /*!< end tangent z coordinate, code 33 */
637
int flags; /*!< spline flag, code 70 */
638
int degree; /*!< degree of the spline, code 71 */
639
int nknots; /*!< number of knots, code 72, default 0 */
640
int ncontrol; /*!< number of control points, code 73, default 0 */
641
int nfit; /*!< number of fit points, code 74, default 0 */
642
double tolknot; /*!< knot tolerance, code 42, default 0.0000001 */
643
double tolcontrol; /*!< control point tolerance, code 43, default 0.0000001 */
644
double tolfit; /*!< fit point tolerance, code 44, default 0.0000001 */
646
std::vector<double> knotslist; /*!< knots list, code 40 */
647
std::vector<DRW_Coord *> controllist; /*!< control points list, code 10, 20 & 30 */
648
std::vector<DRW_Coord *> fitlist; /*!< fit points list, code 11, 21 & 31 */
651
DRW_Coord *controlpoint; /*!< current control point to add data */
652
DRW_Coord *fitpoint; /*!< current fit point to add data */
655
//! Class to handle hatch loop
657
* Class to handle hatch loop
660
class DRW_HatchLoop {
662
DRW_HatchLoop(int t) {
668
/* while (!pollist.empty()) {
671
while (!objlist.empty()) {
677
numedges = objlist.size();
681
int type; /*!< boundary path type, code 92, polyline=2, default=0 */
682
int numedges; /*!< number of edges (if not a polyline), code 93 */
683
//TODO: store lwpolylines as entities
684
// std::vector<DRW_LWPolyline *> pollist; /*!< polyline list */
685
std::vector<DRW_Entity *> objlist; /*!< entities list */
688
//! Class to handle hatch entity
690
* Class to handle hatch entity
693
//TODO: handle lwpolylines, splines and ellipses
694
class DRW_Hatch : public DRW_Point {
699
basePoint.x = basePoint.y = basePoint.z = 0.0;
700
loopsnum = hstyle = associative = 0;
701
solid = hpattern = 1;
702
deflines = doubleflag = 0;
708
while (!looplist.empty()) {
713
void appendLoop (DRW_HatchLoop *v) {
714
looplist.push_back(v);
717
virtual void applyExtrusion(){}
718
void parseCode(int code, dxfReader *reader);
721
UTF8STRING name; /*!< hatch pattern name, code 2 */
722
int solid; /*!< solid fill flag, code 70, solid=1, pattern=0 */
723
int associative; /*!< associativity, code 71, associatve=1, non-assoc.=0 */
724
int hstyle; /*!< hatch style, code 75 */
725
int hpattern; /*!< hatch pattern type, code 76 */
726
int doubleflag; /*!< hatch pattern double flag, code 77, double=1, single=0 */
727
int loopsnum; /*!< namber of boundary paths (loops), code 91 */
728
double angle; /*!< hatch pattern angle, code 52 */
729
double scale; /*!< hatch pattern scale, code 41 */
730
int deflines; /*!< number of pattern definition lines, code 78 */
732
std::vector<DRW_HatchLoop *> looplist; /*!< polyline list */
735
void clearEntities(){
747
pt = line = new DRW_Line;
748
loop->objlist.push_back(line);
755
pt = arc = new DRW_Arc;
756
loop->objlist.push_back(arc);
763
pt = ellipse = new DRW_Ellipse;
764
loop->objlist.push_back(ellipse);
772
spline = new DRW_Spline;
773
loop->objlist.push_back(spline);
777
DRW_HatchLoop *loop; /*!< current loop to add data */
780
DRW_Ellipse *ellipse;
782
DRW_LWPolyline *pline;
784
DRW_Vertex2D *plvert;
788
//! Class to handle image entity
790
* Class to handle image entity
793
class DRW_Image : public DRW_Line {
797
vz = fade = clip = 0;
798
brightness = contrast = 50;
801
void parseCode(int code, dxfReader *reader);
804
std::string ref; /*!< Hard reference to imagedef object, code 340 */
805
double vx; /*!< V-vector of single pixel, x coordinate, code 12 */
806
double vy; /*!< V-vector of single pixel, y coordinate, code 22 */
807
double vz; /*!< V-vector of single pixel, z coordinate, code 32 */
808
double sizeu; /*!< image size in pixels, U value, code 13 */
809
double sizev; /*!< image size in pixels, V value, code 23 */
810
double dz; /*!< z coordinate, code 33 */
811
int clip; /*!< Clipping state, code 280, 0=off 1=on */
812
int brightness; /*!< Brightness value, code 281, (0-100) default 50 */
813
int contrast; /*!< Brightness value, code 282, (0-100) default 50 */
814
int fade; /*!< Brightness value, code 283, (0-100) default 0 */
819
//! Base class for dimension entity
821
* Base class for dimension entity
824
class DRW_Dimension : public DRW_Entity {
827
eType = DRW::DIMENSION;
829
linefactor = extPoint.z = 1.0;
830
angle = oblique = rot = 0.0;
833
defPoint.z = extPoint.x = extPoint.y = 0;
834
textPoint.z = rot = 0;
835
clonePoint.x = clonePoint.y = clonePoint.z = 0;
838
DRW_Dimension(const DRW_Dimension& d): DRW_Entity(d) {
839
eType = DRW::DIMENSION;
842
defPoint = d.defPoint;
843
textPoint = d.textPoint;
848
linefactor = d.linefactor;
850
extPoint = d.extPoint;
851
clonePoint = d.clonePoint;
856
arcPoint = d.arcPoint;
857
circlePoint = d.circlePoint;
860
virtual ~DRW_Dimension() {}
862
void parseCode(int code, dxfReader *reader);
863
virtual void applyExtrusion(){}
865
DRW_Coord getDefPoint() const {return defPoint;} /*!< Definition point, code 10, 20 & 30 */
866
void setDefPoint(const DRW_Coord p) {defPoint =p;}
867
DRW_Coord getTextPoint() const {return textPoint;} /*!< Middle point of text, code 11, 21 & 31 */
868
void setTextPoint(const DRW_Coord p) {textPoint =p;}
869
std::string getStyle() const {return style;} /*!< Dimension style, code 3 */
870
void setStyle(const std::string s) {style = s;}
871
int getAlign() const { return align;} /*!< attachment point, code 71 */
872
void setAlign(const int a) { align = a;}
873
int getTextLineStyle() const { return linesty;} /*!< Dimension text line spacing style, code 72, default 1 */
874
void setTextLineStyle(const int l) { linesty = l;}
875
std::string getText() const {return text;} /*!< Dimension text explicitly entered by the user, code 1 */
876
void setText(const std::string t) {text = t;}
877
double getTextLineFactor() const { return linefactor;} /*!< Dimension text line spacing factor, code 41, default 1? */
878
void setTextLineFactor(const double l) { linefactor = l;}
879
double getDir() const { return rot;} /*!< rotation angle of the dimension text, code 53 (optional) default 0 */
880
void setDir(const double d) { rot = d;}
882
DRW_Coord getExtrusion(){return extPoint;} /*!< extrusion, code 210, 220 & 230 */
883
void setExtrusion(const DRW_Coord p) {extPoint =p;}
884
std::string getName(){return name;} /*!< Name of the block that contains the entities, code 2 */
885
void setName(const std::string s) {name = s;}
886
// int getType(){ return type;} /*!< Dimension type, code 70 */
889
DRW_Coord getPt2() const {return clonePoint;}
890
void setPt2(const DRW_Coord p) {clonePoint= p;}
891
DRW_Coord getPt3() const {return def1;}
892
void setPt3(const DRW_Coord p) {def1= p;}
893
DRW_Coord getPt4() const {return def2;}
894
void setPt4(const DRW_Coord p) {def2= p;}
895
DRW_Coord getPt5() const {return circlePoint;}
896
void setPt5(const DRW_Coord p) {circlePoint= p;}
897
DRW_Coord getPt6() const {return arcPoint;}
898
void setPt6(const DRW_Coord p) {arcPoint= p;}
899
double getAn50() const {return angle;} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
900
void setAn50(const double d) {angle = d;}
901
double getOb52() const {return oblique;} /*!< oblique angle, code 52 */
902
void setOb52(const double d) {oblique = d;}
903
double getRa40() const {return length;} /*!< Leader length, code 40 */
904
void setRa40(const double d) {length = d;}
906
int type; /*!< Dimension type, code 70 */
908
std::string name; /*!< Name of the block that contains the entities, code 2 */
909
DRW_Coord defPoint; /*!< definition point, code 10, 20 & 30 (WCS) */
910
DRW_Coord textPoint; /*!< Middle point of text, code 11, 21 & 31 (OCS) */
911
UTF8STRING text; /*!< Dimension text explicitly entered by the user, code 1 */
912
UTF8STRING style; /*!< Dimension style, code 3 */
913
int align; /*!< attachment point, code 71 */
914
int linesty; /*!< Dimension text line spacing style, code 72, default 1 */
915
double linefactor; /*!< Dimension text line spacing factor, code 41, default 1? (value range 0.25 to 4.00*/
916
double rot; /*!< rotation angle of the dimension text, code 53 */
917
DRW_Coord extPoint; /*!< extrusion normal vector, code 210, 220 & 230 */
919
// double hdir; /*!< horizontal direction for the dimension, code 51, default ? */
920
DRW_Coord clonePoint; /*!< Insertion point for clones (Baseline & Continue), code 12, 22 & 32 (OCS) */
921
DRW_Coord def1; /*!< Definition point 1for linear & angular, code 13, 23 & 33 (WCS) */
922
DRW_Coord def2; /*!< Definition point 2, code 14, 24 & 34 (WCS) */
923
double angle; /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
924
double oblique; /*!< oblique angle, code 52 */
926
DRW_Coord circlePoint; /*!< Definition point for diameter, radius & angular dims code 15, 25 & 35 (WCS) */
927
DRW_Coord arcPoint; /*!< Point defining dimension arc, x coordinate, code 16, 26 & 36 (OCS) */
928
double length; /*!< Leader length, code 40 */
932
//! Class to handle aligned dimension entity
934
* Class to handle aligned dimension entity
937
class DRW_DimAligned : public DRW_Dimension {
940
eType = DRW::DIMALIGNED;
942
DRW_DimAligned(const DRW_Dimension& d): DRW_Dimension(d) {
943
eType = DRW::DIMALIGNED;
946
DRW_Coord getClonepoint() const {return getPt2();} /*!< Insertion for clones (Baseline & Continue), 12, 22 & 32 */
947
void setClonePoint(DRW_Coord c){setPt2(c);}
949
DRW_Coord getDimPoint() const {return getDefPoint();} /*!< dim line location point, code 10, 20 & 30 */
950
void setDimPoint(const DRW_Coord p){setDefPoint(p);}
951
DRW_Coord getDef1Point() const {return getPt3();} /*!< Definition point 1, code 13, 23 & 33 */
952
void setDef1Point(const DRW_Coord p) {setPt3(p);}
953
DRW_Coord getDef2Point() const {return getPt4();} /*!< Definition point 2, code 14, 24 & 34 */
954
void setDef2Point(const DRW_Coord p) {setPt4(p);}
957
//! Class to handle linear or rotated dimension entity
959
* Class to handle linear or rotated dimension entity
962
class DRW_DimLinear : public DRW_DimAligned {
965
eType = DRW::DIMLINEAR;
967
DRW_DimLinear(const DRW_Dimension& d): DRW_DimAligned(d) {
968
eType = DRW::DIMLINEAR;
971
double getAngle() const {return getAn50();} /*!< Angle of rotated, horizontal, or vertical dimensions, code 50 */
972
void setAngle(const double d) {setAn50(d);}
973
double getOblique() const {return getOb52();} /*!< oblique angle, code 52 */
974
void setOblique(const double d) {setOb52(d);}
977
//! Class to handle radial dimension entity
979
* Class to handle aligned, linear or rotated dimension entity
982
class DRW_DimRadial : public DRW_Dimension {
985
eType = DRW::DIMRADIAL;
987
DRW_DimRadial(const DRW_Dimension& d): DRW_Dimension(d) {
988
eType = DRW::DIMRADIAL;
991
DRW_Coord getCenterPoint() const {return getDefPoint();} /*!< center point, code 10, 20 & 30 */
992
void setCenterPoint(const DRW_Coord p){setDefPoint(p);}
993
DRW_Coord getDiameterPoint() const {return getPt5();} /*!< Definition point for radius, code 15, 25 & 35 */
994
void setDiameterPoint(const DRW_Coord p){setPt5(p);}
995
double getLeaderLength() const {return getRa40();} /*!< Leader length, code 40 */
996
void setLeaderLength(const double d) {setRa40(d);}
999
//! Class to handle radial dimension entity
1001
* Class to handle aligned, linear or rotated dimension entity
1004
class DRW_DimDiametric : public DRW_Dimension {
1006
DRW_DimDiametric() {
1007
eType = DRW::DIMDIAMETRIC;
1009
DRW_DimDiametric(const DRW_Dimension& d): DRW_Dimension(d) {
1010
eType = DRW::DIMDIAMETRIC;
1013
DRW_Coord getDiameter1Point() const {return getPt5();} /*!< First definition point for diameter, code 15, 25 & 35 */
1014
void setDiameter1Point(const DRW_Coord p){setPt5(p);}
1015
DRW_Coord getDiameter2Point() const {return getDefPoint();} /*!< Oposite point for diameter, code 10, 20 & 30 */
1016
void setDiameter2Point(const DRW_Coord p){setDefPoint(p);}
1017
double getLeaderLength() const {return getRa40();} /*!< Leader length, code 40 */
1018
void setLeaderLength(const double d) {setRa40(d);}
1021
//! Class to handle angular dimension entity
1023
* Class to handle angular dimension entity
1026
class DRW_DimAngular : public DRW_Dimension {
1029
eType = DRW::DIMANGULAR;
1031
DRW_DimAngular(const DRW_Dimension& d): DRW_Dimension(d) {
1032
eType = DRW::DIMANGULAR;
1035
DRW_Coord getFirstLine1() const {return getPt3();} /*!< Definition point line 1-1, code 13, 23 & 33 */
1036
void setFirstLine1(const DRW_Coord p) {setPt3(p);}
1037
DRW_Coord getFirstLine2() const {return getPt4();} /*!< Definition point line 1-2, code 14, 24 & 34 */
1038
void setFirstLine2(const DRW_Coord p) {setPt4(p);}
1039
DRW_Coord getSecondLine1() const {return getPt5();} /*!< Definition point line 2-1, code 15, 25 & 35 */
1040
void setSecondLine1(const DRW_Coord p) {setPt5(p);}
1041
DRW_Coord getSecondLine2() const {return getDefPoint();} /*!< Definition point line 2-2, code 10, 20 & 30 */
1042
void setSecondLine2(const DRW_Coord p){setDefPoint(p);}
1043
DRW_Coord getDimPoint() const {return getPt6();} /*!< Dimension definition point, code 16, 26 & 36 */
1044
void setDimPoint(const DRW_Coord p) {setPt6(p);}
1048
//! Class to handle angular 3p dimension entity
1050
* Class to handle angular 3p dimension entity
1053
class DRW_DimAngular3p : public DRW_Dimension {
1055
DRW_DimAngular3p() {
1056
eType = DRW::DIMANGULAR3P;
1058
DRW_DimAngular3p(const DRW_Dimension& d): DRW_Dimension(d) {
1059
eType = DRW::DIMANGULAR3P;
1062
DRW_Coord getFirstLine() const {return getPt3();} /*!< Definition point line 1, code 13, 23 & 33 */
1063
void setFirstLine(const DRW_Coord p) {setPt3(p);}
1064
DRW_Coord getSecondLine() const {return getPt4();} /*!< Definition point line 2, code 14, 24 & 34 */
1065
void setSecondLine(const DRW_Coord p) {setPt4(p);}
1066
DRW_Coord getVertexPoint() const {return getPt5();} /*!< Vertex point, code 15, 25 & 35 */
1067
void SetVertexPoint(const DRW_Coord p) {setPt5(p);}
1068
DRW_Coord getDimPoint() const {return getDefPoint();} /*!< Dimension definition point, code 10, 20 & 30 */
1069
void setDimPoint(const DRW_Coord p) {setDefPoint(p);}
1072
//! Class to handle ordinate dimension entity
1074
* Class to handle ordinate dimension entity
1077
class DRW_DimOrdinate : public DRW_Dimension {
1080
eType = DRW::DIMORDINATE;
1082
DRW_DimOrdinate(const DRW_Dimension& d): DRW_Dimension(d) {
1083
eType = DRW::DIMORDINATE;
1086
DRW_Coord getOriginPoint() const {return getDefPoint();} /*!< Origin definition point, code 10, 20 & 30 */
1087
void setOriginPoint(const DRW_Coord p) {setDefPoint(p);}
1088
DRW_Coord getFirstLine() const {return getPt3();} /*!< Feature location point, code 13, 23 & 33 */
1089
void setFirstLine(const DRW_Coord p) {setPt3(p);}
1090
DRW_Coord getSecondLine() const {return getPt4();} /*!< Leader end point, code 14, 24 & 34 */
1091
void setSecondLine(const DRW_Coord p) {setPt4(p);}
1095
//! Class to handle leader entity
1097
* Class to handle leader entity
1100
class DRW_Leader : public DRW_Entity {
1103
eType = DRW::LEADER;
1105
hookflag = vertnum = leadertype = 0;
1106
extrusionPoint.x = extrusionPoint.y = 0.0;
1108
extrusionPoint.z = 1.0;
1111
while (!vertexlist.empty()) {
1112
vertexlist.pop_back();
1116
virtual void applyExtrusion(){}
1117
void parseCode(int code, dxfReader *reader);
1120
UTF8STRING style; /*!< Dimension style name, code 3 */
1121
int arrow; /*!< Arrowhead flag, code 71, 0=Disabled; 1=Enabled */
1122
int leadertype; /*!< Leader path type, code 72, 0=Straight line segments; 1=Spline */
1123
int flag; /*!< Leader creation flag, code 73, default 3 */
1124
int hookline; /*!< Hook line direction flag, code 74, default 1 */
1125
int hookflag; /*!< Hook line flag, code 75 */
1126
double textheight; /*!< Text annotation height, code 40 */
1127
double textwidth; /*!< Text annotation width, code 41 */
1128
int vertnum; /*!< Number of vertices, code 76 */
1129
int coloruse; /*!< Color to use if leader's DIMCLRD = BYBLOCK, code 77 */
1130
std::string handle; /*!< Hard reference to associated annotation, code 340 */
1131
DRW_Coord extrusionPoint; /*!< Normal vector, code 210, 220 & 230 */
1132
DRW_Coord horizdir; /*!< "Horizontal" direction for leader, code 211, 221 & 231 */
1133
DRW_Coord offsetblock; /*!< Offset of last leader vertex from block, code 212, 222 & 232 */
1134
DRW_Coord offsettext; /*!< Offset of last leader vertex from annotation, code 213, 223 & 233 */
1136
std::vector<DRW_Coord *> vertexlist; /*!< vertex points list, code 10, 20 & 30 */
1139
DRW_Coord *vertexpoint; /*!< current control point to add data */
1142
//! Class to handle viewport entity
1144
* Class to handle viewport entity
1147
class DRW_Viewport : public DRW_Point {
1150
eType = DRW::VIEWPORT;
1158
virtual void applyExtrusion(){}
1159
void parseCode(int code, dxfReader *reader);
1162
double pswidth; /*!< Width in paper space units, code 40 */
1163
double psheight; /*!< Height in paper space units, code 41 */
1164
int vpstatus; /*!< Viewport status, code 68 */
1165
int vpID; /*!< Viewport ID, code 69 */
1166
double centerPX; /*!< view center piont X, code 12 */
1167
double centerPY; /*!< view center piont Y, code 22 */