QCAD Application Framework
CAD Application Development and Automation.
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
dl_entities.h
Go to the documentation of this file.
1 /****************************************************************************
2 ** Copyright (C) 2001-2011 RibbonSoft. All rights reserved.
3 **
4 ** This file is part of the dxflib project.
5 **
6 ** This file may be distributed and/or modified under the terms of the
7 ** GNU General Public License version 2 as published by the Free Software
8 ** Foundation and appearing in the file LICENSE.GPL included in the
9 ** packaging of this file.
10 **
11 ** Licensees holding valid dxflib Professional Edition licenses may use
12 ** this file in accordance with the dxflib Commercial License
13 ** Agreement provided with the Software.
14 **
15 ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
16 ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
17 **
18 ** See http://www.ribbonsoft.com for further details.
19 **
20 ** Contact info@ribbonsoft.com if any conditions of this licensing are
21 ** not clear to you.
22 **
23 **********************************************************************/
24 
25 #ifndef DL_ENTITIES_H
26 #define DL_ENTITIES_H
27 
28 
29 #include <string>
30 using std::string;
31 
37 struct DL_LayerData {
42  DL_LayerData(const string& lName,
43  int lFlags) {
44  name = lName;
45  flags = lFlags;
46  }
47 
49  string name;
51  int flags;
52 };
53 
54 
55 
61 struct DL_BlockData {
66  DL_BlockData(const string& bName,
67  int bFlags,
68  double bbpx, double bbpy, double bbpz) {
69  name = bName;
70  flags = bFlags;
71  bpx = bbpx;
72  bpy = bbpy;
73  bpz = bbpz;
74  }
75 
77  string name;
79  int flags;
81  double bpx;
83  double bpy;
85  double bpz;
86 };
87 
88 
89 
100  DL_LineTypeData(const string& lName,
101  int lFlags) {
102  name = lName;
103  flags = lFlags;
104  }
105 
107  string name;
109  int flags;
110 };
111 
112 
113 
119 struct DL_PointData {
124  DL_PointData(double px=0.0, double py=0.0, double pz=0.0) {
125  x = px;
126  y = py;
127  z = pz;
128  }
129 
131  double x;
133  double y;
135  double z;
136 };
137 
138 
139 
145 struct DL_LineData {
150  DL_LineData(double lx1, double ly1, double lz1,
151  double lx2, double ly2, double lz2) {
152  x1 = lx1;
153  y1 = ly1;
154  z1 = lz1;
155 
156  x2 = lx2;
157  y2 = ly2;
158  z2 = lz2;
159  }
160 
162  double x1;
164  double y1;
166  double z1;
167 
169  double x2;
171  double y2;
173  double z2;
174 };
175 
176 
177 
183 struct DL_ArcData {
188  DL_ArcData(double acx, double acy, double acz,
189  double aRadius,
190  double aAngle1, double aAngle2) {
191 
192  cx = acx;
193  cy = acy;
194  cz = acz;
195  radius = aRadius;
196  angle1 = aAngle1;
197  angle2 = aAngle2;
198  }
199 
201  double cx;
203  double cy;
205  double cz;
206 
208  double radius;
210  double angle1;
212  double angle2;
213 };
214 
215 
216 
227  DL_CircleData(double acx, double acy, double acz,
228  double aRadius) {
229 
230  cx = acx;
231  cy = acy;
232  cz = acz;
233  radius = aRadius;
234  }
235 
237  double cx;
239  double cy;
241  double cz;
242 
244  double radius;
245 };
246 
247 
248 
259  DL_PolylineData(int pNumber, int pMVerteces, int pNVerteces, int pFlags) {
260  number = pNumber;
261  m = pMVerteces;
262  n = pNVerteces;
263  flags = pFlags;
264  }
265 
267  unsigned int number;
268 
270  unsigned int m;
271 
273  unsigned int n;
274 
276  int flags;
277 };
278 
279 
280 
291  DL_VertexData(double px=0.0, double py=0.0, double pz=0.0,
292  double pBulge=0.0) {
293  x = px;
294  y = py;
295  z = pz;
296  bulge = pBulge;
297  }
298 
300  double x;
302  double y;
304  double z;
307  double bulge;
308 };
309 
310 
316 struct DL_TraceData {
318  thickness = 0.0;
319  for (int i=0; i<4; i++) {
320  x[i] = 0.0;
321  y[i] = 0.0;
322  z[i] = 0.0;
323  }
324  }
325 
330  DL_TraceData(double sx1, double sy1, double sz1,
331  double sx2, double sy2, double sz2,
332  double sx3, double sy3, double sz3,
333  double sx4, double sy4, double sz4,
334  double sthickness=0.0) {
335 
336  thickness = sthickness;
337 
338  x[0] = sx1;
339  y[0] = sy1;
340  z[0] = sz1;
341 
342  x[1] = sx2;
343  y[1] = sy2;
344  z[1] = sz2;
345 
346  x[2] = sx3;
347  y[2] = sy3;
348  z[2] = sz3;
349 
350  x[3] = sx4;
351  y[3] = sy4;
352  z[3] = sz4;
353  }
354 
356  double thickness;
357 
359  double x[4];
360  double y[4];
361  double z[4];
362 };
363 
364 
365 
366 
367 
374 
375 
380 
381 
392  DL_SplineData(int pDegree, int pNKnots, int pNControl, int pFlags) {
393  degree = pDegree;
394  nKnots = pNKnots;
395  nControl = pNControl;
396  flags = pFlags;
397  }
398 
400  unsigned int degree;
401 
403  unsigned int nKnots;
404 
406  unsigned int nControl;
407 
409  int flags;
410 };
411 
412 
413 
419 struct DL_KnotData {
425  DL_KnotData(double pk) {
426  k = pk;
427  }
428 
430  double k;
431 };
432 
433 
434 
445  DL_ControlPointData(double px, double py, double pz, double weight) {
446  x = px;
447  y = py;
448  z = pz;
449  w = weight;
450  }
451 
453  double x;
455  double y;
457  double z;
459  double w;
460 };
461 
462 
473  DL_EllipseData(double ecx, double ecy, double ecz,
474  double emx, double emy, double emz,
475  double eRatio,
476  double eAngle1, double eAngle2) {
477 
478  cx = ecx;
479  cy = ecy;
480  cz = ecz;
481  mx = emx;
482  my = emy;
483  mz = emz;
484  ratio = eRatio;
485  angle1 = eAngle1;
486  angle2 = eAngle2;
487  }
488 
490  double cx;
492  double cy;
494  double cz;
495 
497  double mx;
499  double my;
501  double mz;
502 
504  double ratio;
506  double angle1;
508  double angle2;
509 };
510 
511 
512 
523  DL_InsertData(const string& iName,
524  double iipx, double iipy, double iipz,
525  double isx, double isy, double isz,
526  double iAngle,
527  int iCols, int iRows,
528  double iColSp, double iRowSp) {
529  name = iName;
530  ipx = iipx;
531  ipy = iipy;
532  ipz = iipz;
533  sx = isx;
534  sy = isy;
535  sz = isz;
536  angle = iAngle;
537  cols = iCols;
538  rows = iRows;
539  colSp = iColSp;
540  rowSp = iRowSp;
541  }
542 
544  string name;
546  double ipx;
548  double ipy;
550  double ipz;
552  double sx;
554  double sy;
556  double sz;
558  double angle;
560  int cols;
562  int rows;
564  double colSp;
566  double rowSp;
567 };
568 
569 
570 
576 struct DL_MTextData {
581  DL_MTextData(double tipx, double tipy, double tipz,
582  double tHeight, double tWidth,
583  int tAttachmentPoint,
584  int tDrawingDirection,
585  int tLineSpacingStyle,
586  double tLineSpacingFactor,
587  const string& tText,
588  const string& tStyle,
589  double tAngle) {
590  ipx = tipx;
591  ipy = tipy;
592  ipz = tipz;
593 
594  height = tHeight;
595  width = tWidth;
596  attachmentPoint = tAttachmentPoint;
597  drawingDirection = tDrawingDirection;
598  lineSpacingStyle = tLineSpacingStyle;
599  lineSpacingFactor = tLineSpacingFactor;
600  text = tText;
601  style = tStyle;
602  angle = tAngle;
603  }
604 
606  double ipx;
608  double ipy;
610  double ipz;
612  double height;
614  double width;
640  string text;
642  string style;
644  double angle;
645 };
646 
647 
648 
654 struct DL_TextData {
659  DL_TextData(double tipx, double tipy, double tipz,
660  double tapx, double tapy, double tapz,
661  double tHeight, double tXScaleFactor,
662  int tTextGenerationFlags,
663  int tHJustification,
664  int tVJustification,
665  const string& tText,
666  const string& tStyle,
667  double tAngle) {
668  ipx = tipx;
669  ipy = tipy;
670  ipz = tipz;
671 
672  apx = tapx;
673  apy = tapy;
674  apz = tapz;
675 
676  height = tHeight;
677  xScaleFactor = tXScaleFactor;
678  textGenerationFlags = tTextGenerationFlags;
679  hJustification = tHJustification;
680  vJustification = tVJustification;
681  text = tText;
682  style = tStyle;
683  angle = tAngle;
684  }
685 
687  double ipx;
689  double ipy;
691  double ipz;
692 
694  double apx;
696  double apy;
698  double apz;
699 
701  double height;
703  double xScaleFactor;
721  string text;
723  string style;
725  double angle;
726 };
727 
728 
729 
740  DL_DimensionData(double ddpx, double ddpy, double ddpz,
741  double dmpx, double dmpy, double dmpz,
742  int dType,
743  int dAttachmentPoint,
744  int dLineSpacingStyle,
745  double dLineSpacingFactor,
746  const string& dText,
747  const string& dStyle,
748  double dAngle) {
749 
750  dpx = ddpx;
751  dpy = ddpy;
752  dpz = ddpz;
753 
754  mpx = dmpx;
755  mpy = dmpy;
756  mpz = dmpz;
757 
758  type = dType;
759 
760  attachmentPoint = dAttachmentPoint;
761  lineSpacingStyle = dLineSpacingStyle;
762  lineSpacingFactor = dLineSpacingFactor;
763  text = dText;
764  style = dStyle;
765  angle = dAngle;
766  }
767 
769  double dpx;
771  double dpy;
773  double dpz;
775  double mpx;
777  double mpy;
779  double mpz;
799  int type;
825  string text;
827  string style;
832  double angle;
833 };
834 
835 
836 
847  DL_DimAlignedData(double depx1, double depy1, double depz1,
848  double depx2, double depy2, double depz2) {
849 
850  epx1 = depx1;
851  epy1 = depy1;
852  epz1 = depz1;
853 
854  epx2 = depx2;
855  epy2 = depy2;
856  epz2 = depz2;
857  }
858 
860  double epx1;
862  double epy1;
864  double epz1;
865 
867  double epx2;
869  double epy2;
871  double epz2;
872 };
873 
874 
875 
886  DL_DimLinearData(double ddpx1, double ddpy1, double ddpz1,
887  double ddpx2, double ddpy2, double ddpz2,
888  double dAngle, double dOblique) {
889 
890  dpx1 = ddpx1;
891  dpy1 = ddpy1;
892  dpz1 = ddpz1;
893 
894  dpx2 = ddpx2;
895  dpy2 = ddpy2;
896  dpz2 = ddpz2;
897 
898  angle = dAngle;
899  oblique = dOblique;
900  }
901 
903  double dpx1;
905  double dpy1;
907  double dpz1;
908 
910  double dpx2;
912  double dpy2;
914  double dpz2;
915 
917  double angle;
919  double oblique;
920 };
921 
922 
923 
934  DL_DimRadialData(double ddpx, double ddpy, double ddpz, double dleader) {
935  dpx = ddpx;
936  dpy = ddpy;
937  dpz = ddpz;
938 
939  leader = dleader;
940  }
941 
943  double dpx;
945  double dpy;
947  double dpz;
948 
950  double leader;
951 };
952 
953 
954 
965  DL_DimDiametricData(double ddpx, double ddpy, double ddpz, double dleader) {
966  dpx = ddpx;
967  dpy = ddpy;
968  dpz = ddpz;
969 
970  leader = dleader;
971  }
972 
974  double dpx;
976  double dpy;
978  double dpz;
979 
981  double leader;
982 };
983 
984 
985 
996  DL_DimAngularData(double ddpx1, double ddpy1, double ddpz1,
997  double ddpx2, double ddpy2, double ddpz2,
998  double ddpx3, double ddpy3, double ddpz3,
999  double ddpx4, double ddpy4, double ddpz4) {
1000 
1001  dpx1 = ddpx1;
1002  dpy1 = ddpy1;
1003  dpz1 = ddpz1;
1004 
1005  dpx2 = ddpx2;
1006  dpy2 = ddpy2;
1007  dpz2 = ddpz2;
1008 
1009  dpx3 = ddpx3;
1010  dpy3 = ddpy3;
1011  dpz3 = ddpz3;
1012 
1013  dpx4 = ddpx4;
1014  dpy4 = ddpy4;
1015  dpz4 = ddpz4;
1016  }
1017 
1019  double dpx1;
1021  double dpy1;
1023  double dpz1;
1024 
1026  double dpx2;
1028  double dpy2;
1030  double dpz2;
1031 
1033  double dpx3;
1035  double dpy3;
1037  double dpz3;
1038 
1040  double dpx4;
1042  double dpy4;
1044  double dpz4;
1045 };
1046 
1047 
1058  DL_DimAngular3PData(double ddpx1, double ddpy1, double ddpz1,
1059  double ddpx2, double ddpy2, double ddpz2,
1060  double ddpx3, double ddpy3, double ddpz3) {
1061 
1062  dpx1 = ddpx1;
1063  dpy1 = ddpy1;
1064  dpz1 = ddpz1;
1065 
1066  dpx2 = ddpx2;
1067  dpy2 = ddpy2;
1068  dpz2 = ddpz2;
1069 
1070  dpx3 = ddpx3;
1071  dpy3 = ddpy3;
1072  dpz3 = ddpz3;
1073  }
1074 
1076  double dpx1;
1078  double dpy1;
1080  double dpz1;
1081 
1083  double dpx2;
1085  double dpy2;
1087  double dpz2;
1088 
1090  double dpx3;
1092  double dpy3;
1094  double dpz3;
1095 };
1096 
1097 
1098 
1109  DL_DimOrdinateData(double ddpx1, double ddpy1, double ddpz1,
1110  double ddpx2, double ddpy2, double ddpz2,
1111  bool dxtype) {
1112 
1113  dpx1 = ddpx1;
1114  dpy1 = ddpy1;
1115  dpz1 = ddpz1;
1116 
1117  dpx2 = ddpx2;
1118  dpy2 = ddpy2;
1119  dpz2 = ddpz2;
1120 
1121  xtype = dxtype;
1122  }
1123 
1125  double dpx1;
1127  double dpy1;
1129  double dpz1;
1130 
1132  double dpx2;
1134  double dpy2;
1136  double dpz2;
1137 
1139  bool xtype;
1140 };
1141 
1142 
1143 
1154  DL_LeaderData(int lArrowHeadFlag,
1155  int lLeaderPathType,
1156  int lLeaderCreationFlag,
1157  int lHooklineDirectionFlag,
1158  int lHooklineFlag,
1159  double lTextAnnotationHeight,
1160  double lTextAnnotationWidth,
1161  int lNumber) {
1162 
1163  arrowHeadFlag = lArrowHeadFlag;
1164  leaderPathType = lLeaderPathType;
1165  leaderCreationFlag = lLeaderCreationFlag;
1166  hooklineDirectionFlag = lHooklineDirectionFlag;
1167  hooklineFlag = lHooklineFlag;
1168  textAnnotationHeight = lTextAnnotationHeight;
1169  textAnnotationWidth = lTextAnnotationWidth;
1170  number = lNumber;
1171  }
1172 
1188  int number;
1189 };
1190 
1191 
1192 
1203  DL_LeaderVertexData(double px=0.0, double py=0.0, double pz=0.0) {
1204  x = px;
1205  y = py;
1206  z = pz;
1207  }
1208 
1210  double x;
1212  double y;
1214  double z;
1215 };
1216 
1217 
1218 
1227 
1232  DL_HatchData(int hNumLoops,
1233  bool hSolid,
1234  double hScale,
1235  double hAngle,
1236  const string& hPattern) {
1237  numLoops = hNumLoops;
1238  solid = hSolid;
1239  scale = hScale;
1240  angle = hAngle;
1241  pattern = hPattern;
1242  }
1243 
1247  bool solid;
1249  double scale;
1251  double angle;
1253  string pattern;
1254 };
1255 
1256 
1257 
1270  DL_HatchLoopData(int hNumEdges) {
1271  numEdges = hNumEdges;
1272  }
1273 
1276 };
1277 
1278 
1279 
1288  defined = false;
1289  }
1290 
1295  DL_HatchEdgeData(double lx1, double ly1,
1296  double lx2, double ly2) {
1297  x1 = lx1;
1298  y1 = ly1;
1299  x2 = lx2;
1300  y2 = ly2;
1301  type = 1;
1302  defined = true;
1303  }
1304 
1309  DL_HatchEdgeData(double acx, double acy,
1310  double aRadius,
1311  double aAngle1, double aAngle2,
1312  bool aCcw) {
1313  cx = acx;
1314  cy = acy;
1315  radius = aRadius;
1316  angle1 = aAngle1;
1317  angle2 = aAngle2;
1318  ccw = aCcw;
1319  type = 2;
1320  defined = true;
1321  }
1322 
1326  int type;
1327 
1331  bool defined;
1332 
1334  double x1;
1336  double y1;
1338  double x2;
1340  double y2;
1342  double cx;
1344  double cy;
1346  double radius;
1348  double angle1;
1350  double angle2;
1352  bool ccw;
1353 };
1354 
1355 
1356 
1367  DL_ImageData(const string& iref,
1368  double iipx, double iipy, double iipz,
1369  double iux, double iuy, double iuz,
1370  double ivx, double ivy, double ivz,
1371  int iwidth, int iheight,
1372  int ibrightness, int icontrast, int ifade) {
1373  ref = iref;
1374  ipx = iipx;
1375  ipy = iipy;
1376  ipz = iipz;
1377  ux = iux;
1378  uy = iuy;
1379  uz = iuz;
1380  vx = ivx;
1381  vy = ivy;
1382  vz = ivz;
1383  width = iwidth;
1384  height = iheight;
1385  brightness = ibrightness;
1386  contrast = icontrast;
1387  fade = ifade;
1388  }
1389 
1392  string ref;
1394  double ipx;
1396  double ipy;
1398  double ipz;
1400  double ux;
1402  double uy;
1404  double uz;
1406  double vx;
1408  double vy;
1410  double vz;
1412  int width;
1414  int height;
1420  int fade;
1421 };
1422 
1423 
1424 
1435  DL_ImageDefData(const string& iref,
1436  const string& ifile) {
1437  ref = iref;
1438  file = ifile;
1439  }
1440 
1443  string ref;
1444 
1446  string file;
1447 };
1448 
1449 #endif
1450 
1451 // EOF
1452