1 /****************************************************************************
2 **
3 ** This file is part of the LibreCAD project, a 2D CAD program
4 **
5 ** Copyright (C) 2010 R. van Twisk (librecad@rvt.dds.nl)
6 ** Copyright (C) 2001-2003 RibbonSoft. All rights reserved.
7 **
8 **
9 ** This file may be distributed and/or modified under the terms of the
10 ** GNU General Public License version 2 as published by the Free Software
11 ** Foundation and appearing in the file gpl-2.0.txt included in the
12 ** packaging of this file.
13 **
14 ** This program is distributed in the hope that it will be useful,
15 ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16 ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 ** GNU General Public License for more details.
18 **
19 ** You should have received a copy of the GNU General Public License
20 ** along with this program; if not, write to the Free Software
21 ** Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 **
23 ** This copyright notice MUST APPEAR in all copies of the script!
24 **
25 **********************************************************************/
26 
27 #ifndef DL_ENTITIES_H
28 #define DL_ENTITIES_H
29 
30 
31 #include <string>
32 using std::string;
33 
34 /**
35  * Layer Data.
36  *
37  * @author Andrew Mustun
38  */
39 struct DL_LayerData {
40     /**
41      * Constructor.
42      * Parameters: see member variables.
43      */
DL_LayerDataDL_LayerData44     DL_LayerData(const string& lName,
45                  int lFlags) {
46         name = lName;
47         flags = lFlags;
48         plotF = true;
49     }
DL_LayerDataDL_LayerData50     DL_LayerData(const string& lName,
51                  int lFlags,bool lPlotF) {
52         name = lName;
53         flags = lFlags;
54         plotF = lPlotF;//set construction Layer, if plotF is false.
55     }
56 
57     /** Layer name. */
58     string name;
59     /** Layer flags. (1 = frozen, 2 = frozen by default, 4 = locked) */
60     int flags;
61     bool plotF;
62 };
63 
64 
65 
66 /**
67  * Block Data.
68  *
69  * @author Andrew Mustun
70  */
71 struct DL_BlockData {
72     /**
73      * Constructor.
74      * Parameters: see member variables.
75      */
DL_BlockDataDL_BlockData76     DL_BlockData(const string& bName,
77                  int bFlags,
78                  double bbpx, double bbpy, double bbpz) {
79         name = bName;
80         flags = bFlags;
81         bpx = bbpx;
82         bpy = bbpy;
83         bpz = bbpz;
84     }
85 
86     /** Block name. */
87     string name;
88     /** Block flags. (not used currently) */
89     int flags;
90     /** X Coordinate of base point. */
91     double bpx;
92     /** Y Coordinate of base point. */
93     double bpy;
94     /** Z Coordinate of base point. */
95     double bpz;
96 };
97 
98 
99 
100 /**
101  * Line Type Data.
102  *
103  * @author Andrew Mustun
104  */
105 struct DL_LineTypeData {
106     /**
107      * Constructor.
108      * Parameters: see member variables.
109      */
DL_LineTypeDataDL_LineTypeData110     DL_LineTypeData(const string& lName,
111                     int lFlags) {
112         name = lName;
113         flags = lFlags;
114     }
115 
116     /** Line type name. */
117     string name;
118     /** Line type flags. */
119     int flags;
120 };
121 
122 
123 
124 /**
125  * Point Data.
126  *
127  * @author Andrew Mustun
128  */
129 struct DL_PointData {
130     /**
131      * Constructor.
132      * Parameters: see member variables.
133      */
134     DL_PointData(double px=0.0, double py=0.0, double pz=0.0) {
135         x = px;
136         y = py;
137         z = pz;
138     }
139 
140     /*! X Coordinate of the point. */
141     double x;
142     /*! Y Coordinate of the point. */
143     double y;
144     /*! Z Coordinate of the point. */
145     double z;
146 };
147 
148 
149 
150 /**
151  * Line Data.
152  *
153  * @author Andrew Mustun
154  */
155 struct DL_LineData {
156     /**
157      * Constructor.
158      * Parameters: see member variables.
159      */
DL_LineDataDL_LineData160     DL_LineData(double lx1, double ly1, double lz1,
161                 double lx2, double ly2, double lz2) {
162         x1 = lx1;
163         y1 = ly1;
164         z1 = lz1;
165 
166         x2 = lx2;
167         y2 = ly2;
168         z2 = lz2;
169     }
170 
171     /*! X Start coordinate of the point. */
172     double x1;
173     /*! Y Start coordinate of the point. */
174     double y1;
175     /*! Z Start coordinate of the point. */
176     double z1;
177 
178     /*! X End coordinate of the point. */
179     double x2;
180     /*! Y End coordinate of the point. */
181     double y2;
182     /*! Z End coordinate of the point. */
183     double z2;
184 };
185 
186 
187 
188 /**
189  * Arc Data.
190  *
191  * @author Andrew Mustun
192  */
193 struct DL_ArcData {
194     /**
195      * Constructor.
196      * Parameters: see member variables.
197      */
DL_ArcDataDL_ArcData198     DL_ArcData(double acx, double acy, double acz,
199                double aRadius,
200                double aAngle1, double aAngle2) {
201 
202         cx = acx;
203         cy = acy;
204         cz = acz;
205         radius = aRadius;
206         angle1 = aAngle1;
207         angle2 = aAngle2;
208     }
209 
210     /*! X Coordinate of center point. */
211     double cx;
212     /*! Y Coordinate of center point. */
213     double cy;
214     /*! Z Coordinate of center point. */
215     double cz;
216 
217     /*! Radius of arc. */
218     double radius;
219     /*! Startangle of arc in degrees. */
220     double angle1;
221     /*! Endangle of arc in degrees. */
222     double angle2;
223 };
224 
225 
226 
227 /**
228  * Circle Data.
229  *
230  * @author Andrew Mustun
231  */
232 struct DL_CircleData {
233     /**
234      * Constructor.
235      * Parameters: see member variables.
236      */
DL_CircleDataDL_CircleData237     DL_CircleData(double acx, double acy, double acz,
238                   double aRadius) {
239 
240         cx = acx;
241         cy = acy;
242         cz = acz;
243         radius = aRadius;
244     }
245 
246     /*! X Coordinate of center point. */
247     double cx;
248     /*! Y Coordinate of center point. */
249     double cy;
250     /*! Z Coordinate of center point. */
251     double cz;
252 
253     /*! Radius of arc. */
254     double radius;
255 };
256 
257 
258 
259 /**
260  * Polyline Data.
261  *
262  * @author Andrew Mustun
263  */
264 struct DL_PolylineData {
265     /**
266      * Constructor.
267      * Parameters: see member variables.
268      */
DL_PolylineDataDL_PolylineData269     DL_PolylineData(int pNumber, int pMVerteces, int pNVerteces, int pFlags) {
270         number = pNumber;
271         m = pMVerteces;
272         n = pNVerteces;
273         flags = pFlags;
274     }
275 
276     /*! Number of vertices in this polyline. */
277     unsigned int number;
278 
279     /*! Number of vertices in m direction if polyline is a polygon mesh. */
280     unsigned int m;
281 
282     /*! Number of vertices in n direction if polyline is a polygon mesh. */
283     unsigned int n;
284 
285     /*! Flags */
286     int flags;
287 };
288 
289 
290 
291 /**
292  * Vertex Data.
293  *
294  * @author Andrew Mustun
295  */
296 struct DL_VertexData {
297     /**
298      * Constructor.
299      * Parameters: see member variables.
300      */
301     DL_VertexData(double px=0.0, double py=0.0, double pz=0.0,
302                   double pBulge=0.0) {
303         x = px;
304         y = py;
305         z = pz;
306         bulge = pBulge;
307     }
308 
309     /*! X Coordinate of the vertex. */
310     double x;
311     /*! Y Coordinate of the vertex. */
312     double y;
313     /*! Z Coordinate of the vertex. */
314     double z;
315     /*! Bulge of vertex.
316      * (The tangent of 1/4 of the arc angle or 0 for lines) */
317     double bulge;
318 };
319 
320 
321 /**
322  * Trace Data / solid data / 3d face data.
323  *
324  * @author Andrew Mustun
325  */
326 struct DL_TraceData {
DL_TraceDataDL_TraceData327     DL_TraceData() {
328         thickness = 0.0;
329         for (int i=0; i<4; i++) {
330             x[i] = 0.0;
331             y[i] = 0.0;
332             z[i] = 0.0;
333         }
334     }
335 
336     /**
337      * Constructor.
338      * Parameters: see member variables.
339      */
340     DL_TraceData(double sx1, double sy1, double sz1,
341                 double sx2, double sy2, double sz2,
342                 double sx3, double sy3, double sz3,
343                 double sx4, double sy4, double sz4,
344                 double sthickness=0.0) {
345 
346         thickness = sthickness;
347 
348         x[0] = sx1;
349         y[0] = sy1;
350         z[0] = sz1;
351 
352         x[1] = sx2;
353         y[1] = sy2;
354         z[1] = sz2;
355 
356         x[2] = sx3;
357         y[2] = sy3;
358         z[2] = sz3;
359 
360         x[3] = sx4;
361         y[3] = sy4;
362         z[3] = sz4;
363     }
364 
365     /*! Thickness */
366     double thickness;
367 
368     /*! Points */
369     double x[4];
370     double y[4];
371     double z[4];
372 };
373 
374 
375 
376 
377 
378 /**
379  * Solid Data.
380  *
381  * @author AHM
382  */
383 typedef DL_TraceData DL_SolidData;
384 
385 
386 /**
387  * 3dface Data.
388  */
389 typedef DL_TraceData DL_3dFaceData;
390 
391 
392 /**
393  * Spline Data.
394  *
395  * @author Andrew Mustun
396  */
397 struct DL_SplineData {
398     /**
399      * Constructor.
400      * Parameters: see member variables.
401      */
DL_SplineDataDL_SplineData402     DL_SplineData(int pDegree, int pNKnots, int pNControl, int pFlags) {
403         degree = pDegree;
404         nKnots = pNKnots;
405         nControl = pNControl;
406         flags = pFlags;
407     }
408 
409     /*! Degree of the spline curve. */
410     unsigned int degree;
411 
412     /*! Number of knots. */
413     unsigned int nKnots;
414 
415     /*! Number of control points. */
416     unsigned int nControl;
417 
418     /*! Flags */
419     int flags;
420 };
421 
422 
423 
424 /**
425  * Spline knot data.
426  *
427  * @author Andrew Mustun
428  */
429 struct DL_KnotData {
DL_KnotDataDL_KnotData430     DL_KnotData() {}
431     /**
432      * Constructor.
433      * Parameters: see member variables.
434      */
DL_KnotDataDL_KnotData435     DL_KnotData(double pk) {
436         k = pk;
437     }
438 
439     /*! Knot value. */
440     double k;
441 };
442 
443 
444 
445 /**
446  * Spline control point data.
447  *
448  * @author Andrew Mustun
449  */
450 struct DL_ControlPointData {
451     /**
452      * Constructor.
453      * Parameters: see member variables.
454      */
DL_ControlPointDataDL_ControlPointData455     DL_ControlPointData(double px, double py, double pz) {
456         x = px;
457         y = py;
458         z = pz;
459     }
460 
461     /*! X coordinate of the control point. */
462     double x;
463     /*! Y coordinate of the control point. */
464     double y;
465     /*! Z coordinate of the control point. */
466     double z;
467 };
468 
469 
470 /**
471  * Ellipse Data.
472  *
473  * @author Andrew Mustun
474  */
475 struct DL_EllipseData {
476     /**
477      * Constructor.
478      * Parameters: see member variables.
479      */
DL_EllipseDataDL_EllipseData480     DL_EllipseData(double ecx, double ecy, double ecz,
481                    double emx, double emy, double emz,
482                    double eRatio,
483                    double eAngle1, double eAngle2) {
484 
485         cx = ecx;
486         cy = ecy;
487         cz = ecz;
488         mx = emx;
489         my = emy;
490         mz = emz;
491         ratio = eRatio;
492         angle1 = eAngle1;
493         angle2 = eAngle2;
494     }
495 
496     /*! X Coordinate of center point. */
497     double cx;
498     /*! Y Coordinate of center point. */
499     double cy;
500     /*! Z Coordinate of center point. */
501     double cz;
502 
503     /*! X coordinate of the endpoint of the major axis. */
504     double mx;
505     /*! Y coordinate of the endpoint of the major axis. */
506     double my;
507     /*! Z coordinate of the endpoint of the major axis. */
508     double mz;
509 
510     /*! Ratio of minor axis to major axis.. */
511     double ratio;
512     /*! Startangle of ellipse in rad. */
513     double angle1;
514     /*! Endangle of ellipse in rad. */
515     double angle2;
516 };
517 
518 
519 
520 /**
521  * Insert Data.
522  *
523  * @author Andrew Mustun
524  */
525 struct DL_InsertData {
526     /**
527      * Constructor.
528      * Parameters: see member variables.
529      */
DL_InsertDataDL_InsertData530     DL_InsertData(const string& iName,
531                   double iipx, double iipy, double iipz,
532                   double isx, double isy, double isz,
533                   double iAngle,
534                   int iCols, int iRows,
535                   double iColSp, double iRowSp) {
536         name = iName;
537         ipx = iipx;
538         ipy = iipy;
539         ipz = iipz;
540         sx = isx;
541         sy = isy;
542         sz = isz;
543         angle = iAngle;
544         cols = iCols;
545         rows = iRows;
546         colSp = iColSp;
547         rowSp = iRowSp;
548     }
549 
550     /*! Name of the referred block. */
551     string name;
552     /*! X Coordinate of insertion point. */
553     double ipx;
554     /*! Y Coordinate of insertion point. */
555     double ipy;
556     /*! Z Coordinate of insertion point. */
557     double ipz;
558     /*! X Scale factor. */
559     double sx;
560     /*! Y Scale factor. */
561     double sy;
562     /*! Z Scale factor. */
563     double sz;
564     /*! Rotation angle in rad. */
565     double angle;
566     /*! Number of colums if we insert an array of the block or 1. */
567     int cols;
568     /*! Number of rows if we insert an array of the block or 1. */
569     int rows;
570     /*! Values for the spacing between cols. */
571     double colSp;
572     /*! Values for the spacing between rows. */
573     double rowSp;
574 };
575 
576 
577 
578 /**
579  * MText Data.
580  *
581  * @author Andrew Mustun
582  */
583 struct DL_MTextData {
584     /**
585      * Constructor.
586      * Parameters: see member variables.
587      */
DL_MTextDataDL_MTextData588     DL_MTextData(double tipx, double tipy, double tipz,
589                  double tHeight, double tWidth,
590                  int tAttachmentPoint,
591                  int tDrawingDirection,
592                  int tLineSpacingStyle,
593                  double tLineSpacingFactor,
594                  const string& tText,
595                  const string& tStyle,
596                  double tAngle) {
597         ipx = tipx;
598         ipy = tipy;
599         ipz = tipz;
600 
601         height = tHeight;
602         width = tWidth;
603         attachmentPoint = tAttachmentPoint;
604         drawingDirection = tDrawingDirection;
605         lineSpacingStyle = tLineSpacingStyle;
606         lineSpacingFactor = tLineSpacingFactor;
607         text = tText;
608         style = tStyle;
609         angle = tAngle;
610     }
611 
612     /*! X Coordinate of insertion point. */
613     double ipx;
614     /*! Y Coordinate of insertion point. */
615     double ipy;
616     /*! Z Coordinate of insertion point. */
617     double ipz;
618     /*! Text height */
619     double height;
620     /*! Width of the text box. */
621     double width;
622     /**
623      * Attachment point.
624      *
625      * 1 = Top left, 2 = Top center, 3 = Top right,
626      * 4 = Middle left, 5 = Middle center, 6 = Middle right,
627      * 7 = Bottom left, 8 = Bottom center, 9 = Bottom right
628      */
629     int attachmentPoint;
630     /**
631      * Drawing direction.
632      *
633      * 1 = left to right, 3 = top to bottom, 5 = by style
634      */
635     int drawingDirection;
636     /**
637      * Line spacing style.
638      *
639      * 1 = at least, 2 = exact
640      */
641     int lineSpacingStyle;
642     /**
643      * Line spacing factor. 0.25 .. 4.0
644      */
645     double lineSpacingFactor;
646     /*! Text string. */
647     string text;
648     /*! Style string. */
649     string style;
650     /*! Rotation angle. */
651     double angle;
652 };
653 
654 
655 
656 /**
657  * Text Data.
658  *
659  * @author Andrew Mustun
660  */
661 struct DL_TextData {
662     /**
663      * Constructor.
664      * Parameters: see member variables.
665      */
DL_TextDataDL_TextData666     DL_TextData(double tipx, double tipy, double tipz,
667                 double tapx, double tapy, double tapz,
668                 double tHeight, double tXScaleFactor,
669                 int tTextGenerationFlags,
670                 int tHJustification,
671                 int tVJustification,
672                 const string& tText,
673                 const string& tStyle,
674                 double tAngle) {
675         ipx = tipx;
676         ipy = tipy;
677         ipz = tipz;
678 
679         apx = tapx;
680         apy = tapy;
681         apz = tapz;
682 
683         height = tHeight;
684         xScaleFactor = tXScaleFactor;
685         textGenerationFlags = tTextGenerationFlags;
686         hJustification = tHJustification;
687         vJustification = tVJustification;
688         text = tText;
689         style = tStyle;
690         angle = tAngle;
691     }
692 
693     /*! X Coordinate of insertion point. */
694     double ipx;
695     /*! Y Coordinate of insertion point. */
696     double ipy;
697     /*! Z Coordinate of insertion point. */
698     double ipz;
699 
700     /*! X Coordinate of alignment point. */
701     double apx;
702     /*! Y Coordinate of alignment point. */
703     double apy;
704     /*! Z Coordinate of alignment point. */
705     double apz;
706 
707     /*! Text height */
708     double height;
709     /*! Relative X scale factor. */
710     double xScaleFactor;
711     /*! 0 = default, 2 = Backwards, 4 = Upside down */
712     int textGenerationFlags;
713     /**
714      * Horizontal justification.
715      *
716      * 0 = Left (default), 1 = Center, 2 = Right,
717      * 3 = Aligned, 4 = Middle, 5 = Fit
718      * For 3, 4, 5 the vertical alignment has to be 0.
719      */
720     int hJustification;
721     /**
722      * Vertical justification.
723      *
724      * 0 = Baseline (default), 1 = Bottom, 2 = Middle, 3= Top
725      */
726     int vJustification;
727     /*! Text string. */
728     string text;
729     /*! Style (font). */
730     string style;
731     /*! Rotation angle of dimension text away from default orientation. */
732     double angle;
733 };
734 
735 
736 
737 /**
738  * Generic Dimension Data.
739  *
740  * @author Andrew Mustun
741  */
742 struct DL_DimensionData {
743     /**
744     * Constructor.
745     * Parameters: see member variables.
746     */
DL_DimensionDataDL_DimensionData747     DL_DimensionData(double ddpx, double ddpy, double ddpz,
748                      double dmpx, double dmpy, double dmpz,
749                      int dType,
750                      int dAttachmentPoint,
751                      int dLineSpacingStyle,
752                      double dLineSpacingFactor,
753                      const string& dText,
754                      const string& dStyle,
755                      double dAngle) {
756 
757         dpx = ddpx;
758         dpy = ddpy;
759         dpz = ddpz;
760 
761         mpx = dmpx;
762         mpy = dmpy;
763         mpz = dmpz;
764 
765         type = dType;
766 
767         attachmentPoint = dAttachmentPoint;
768         lineSpacingStyle = dLineSpacingStyle;
769         lineSpacingFactor = dLineSpacingFactor;
770         text = dText;
771         style = dStyle;
772         angle = dAngle;
773     }
774 
775     /*! X Coordinate of definition point. */
776     double dpx;
777     /*! Y Coordinate of definition point. */
778     double dpy;
779     /*! Z Coordinate of definition point. */
780     double dpz;
781     /*! X Coordinate of middle point of the text. */
782     double mpx;
783     /*! Y Coordinate of middle point of the text. */
784     double mpy;
785     /*! Z Coordinate of middle point of the text. */
786     double mpz;
787     /**
788      * Dimension type.
789      *
790      * 0   Rotated, horizontal, or vertical
791      * 1   Aligned
792      * 2   Angular
793      * 3   Diametric
794      * 4   Radius
795      * 5   Angular 3-point
796      * 6   Ordinate
797      * 64  Ordinate type. This is a bit value (bit 7)
798      *     used only with integer value 6. If set,
799      *     ordinate is X-type; if not set, ordinate is
800      *     Y-type
801      * 128 This is a bit value (bit 8) added to the
802      *     other group 70 values if the dimension text
803      *     has been positioned at a user-defined
804      *    location rather than at the default location
805      */
806     int type;
807     /**
808      * Attachment point.
809      *
810      * 1 = Top left, 2 = Top center, 3 = Top right,
811      * 4 = Middle left, 5 = Middle center, 6 = Middle right,
812      * 7 = Bottom left, 8 = Bottom center, 9 = Bottom right,
813      */
814     int attachmentPoint;
815     /**
816      * Line spacing style.
817      *
818      * 1 = at least, 2 = exact
819      */
820     int lineSpacingStyle;
821     /**
822      * Line spacing factor. 0.25 .. 4.0
823      */
824     double lineSpacingFactor;
825     /**
826      * Text string.
827      *
828      * Text string entered explicitly by user or null
829      * or "<>" for the actual measurement or " " (one blank space).
830      * for supressing the text.
831      */
832     string text;
833     /*! Dimension style (font name). */
834     string style;
835     /**
836     * Rotation angle of dimension text away from
837      * default orientation.
838     */
839     double angle;
840 };
841 
842 
843 
844 /**
845  * Aligned Dimension Data.
846  *
847  * @author Andrew Mustun
848  */
849 struct DL_DimAlignedData {
850     /**
851      * Constructor.
852      * Parameters: see member variables.
853      */
DL_DimAlignedDataDL_DimAlignedData854     DL_DimAlignedData(double depx1, double depy1, double depz1,
855                       double depx2, double depy2, double depz2) {
856 
857         epx1 = depx1;
858         epy1 = depy1;
859         epz1 = depz1;
860 
861         epx2 = depx2;
862         epy2 = depy2;
863         epz2 = depz2;
864     }
865 
866     /*! X Coordinate of Extension point 1. */
867     double epx1;
868     /*! Y Coordinate of Extension point 1. */
869     double epy1;
870     /*! Z Coordinate of Extension point 1. */
871     double epz1;
872 
873     /*! X Coordinate of Extension point 2. */
874     double epx2;
875     /*! Y Coordinate of Extension point 2. */
876     double epy2;
877     /*! Z Coordinate of Extension point 2. */
878     double epz2;
879 };
880 
881 
882 
883 /**
884  * Linear Dimension Data.
885  *
886  * @author Andrew Mustun
887  */
888 struct DL_DimLinearData {
889     /**
890      * Constructor.
891      * Parameters: see member variables.
892      */
DL_DimLinearDataDL_DimLinearData893     DL_DimLinearData(double ddpx1, double ddpy1, double ddpz1,
894                      double ddpx2, double ddpy2, double ddpz2,
895                      double dAngle, double dOblique) {
896 
897         dpx1 = ddpx1;
898         dpy1 = ddpy1;
899         dpz1 = ddpz1;
900 
901         dpx2 = ddpx2;
902         dpy2 = ddpy2;
903         dpz2 = ddpz2;
904 
905         angle = dAngle;
906         oblique = dOblique;
907     }
908 
909     /*! X Coordinate of Extension point 1. */
910     double dpx1;
911     /*! Y Coordinate of Extension point 1. */
912     double dpy1;
913     /*! Z Coordinate of Extension point 1. */
914     double dpz1;
915 
916     /*! X Coordinate of Extension point 2. */
917     double dpx2;
918     /*! Y Coordinate of Extension point 2. */
919     double dpy2;
920     /*! Z Coordinate of Extension point 2. */
921     double dpz2;
922 
923     /*! Rotation angle (angle of dimension line) in degrees. */
924     double angle;
925     /*! Oblique angle in degrees. */
926     double oblique;
927 };
928 
929 
930 
931 /**
932  * Radial Dimension Data.
933  *
934  * @author Andrew Mustun
935  */
936 struct DL_DimRadialData {
937     /**
938      * Constructor.
939      * Parameters: see member variables.
940      */
DL_DimRadialDataDL_DimRadialData941     DL_DimRadialData(double ddpx, double ddpy, double ddpz, double dleader) {
942         dpx = ddpx;
943         dpy = ddpy;
944         dpz = ddpz;
945 
946         leader = dleader;
947     }
948 
949     /*! X Coordinate of definition point. */
950     double dpx;
951     /*! Y Coordinate of definition point. */
952     double dpy;
953     /*! Z Coordinate of definition point. */
954     double dpz;
955 
956     /*! Leader length */
957     double leader;
958 };
959 
960 
961 
962 /**
963  * Diametric Dimension Data.
964  *
965  * @author Andrew Mustun
966  */
967 struct DL_DimDiametricData {
968     /**
969      * Constructor.
970      * Parameters: see member variables.
971      */
DL_DimDiametricDataDL_DimDiametricData972     DL_DimDiametricData(double ddpx, double ddpy, double ddpz, double dleader) {
973         dpx = ddpx;
974         dpy = ddpy;
975         dpz = ddpz;
976 
977         leader = dleader;
978     }
979 
980     /*! X Coordinate of definition point. */
981     double dpx;
982     /*! Y Coordinate of definition point. */
983     double dpy;
984     /*! Z Coordinate of definition point. */
985     double dpz;
986 
987     /*! Leader length */
988     double leader;
989 };
990 
991 
992 
993 /**
994  * Angular Dimension Data.
995  *
996  * @author Andrew Mustun
997  */
998 struct DL_DimAngularData {
999     /**
1000      * Constructor.
1001      * Parameters: see member variables.
1002      */
DL_DimAngularDataDL_DimAngularData1003     DL_DimAngularData(double ddpx1, double ddpy1, double ddpz1,
1004                       double ddpx2, double ddpy2, double ddpz2,
1005                       double ddpx3, double ddpy3, double ddpz3,
1006                       double ddpx4, double ddpy4, double ddpz4) {
1007 
1008         dpx1 = ddpx1;
1009         dpy1 = ddpy1;
1010         dpz1 = ddpz1;
1011 
1012         dpx2 = ddpx2;
1013         dpy2 = ddpy2;
1014         dpz2 = ddpz2;
1015 
1016         dpx3 = ddpx3;
1017         dpy3 = ddpy3;
1018         dpz3 = ddpz3;
1019 
1020         dpx4 = ddpx4;
1021         dpy4 = ddpy4;
1022         dpz4 = ddpz4;
1023     }
1024 
1025     /*! X Coordinate of definition point 1. */
1026     double dpx1;
1027     /*! Y Coordinate of definition point 1. */
1028     double dpy1;
1029     /*! Z Coordinate of definition point 1. */
1030     double dpz1;
1031 
1032     /*! X Coordinate of definition point 2. */
1033     double dpx2;
1034     /*! Y Coordinate of definition point 2. */
1035     double dpy2;
1036     /*! Z Coordinate of definition point 2. */
1037     double dpz2;
1038 
1039     /*! X Coordinate of definition point 3. */
1040     double dpx3;
1041     /*! Y Coordinate of definition point 3. */
1042     double dpy3;
1043     /*! Z Coordinate of definition point 3. */
1044     double dpz3;
1045 
1046     /*! X Coordinate of definition point 4. */
1047     double dpx4;
1048     /*! Y Coordinate of definition point 4. */
1049     double dpy4;
1050     /*! Z Coordinate of definition point 4. */
1051     double dpz4;
1052 };
1053 
1054 
1055 /**
1056  * Angular Dimension Data (3 points version).
1057  *
1058  * @author Andrew Mustun
1059  */
1060 struct DL_DimAngular3PData {
1061     /**
1062      * Constructor.
1063      * Parameters: see member variables.
1064      */
DL_DimAngular3PDataDL_DimAngular3PData1065     DL_DimAngular3PData(double ddpx1, double ddpy1, double ddpz1,
1066                         double ddpx2, double ddpy2, double ddpz2,
1067                         double ddpx3, double ddpy3, double ddpz3) {
1068 
1069         dpx1 = ddpx1;
1070         dpy1 = ddpy1;
1071         dpz1 = ddpz1;
1072 
1073         dpx2 = ddpx2;
1074         dpy2 = ddpy2;
1075         dpz2 = ddpz2;
1076 
1077         dpx3 = ddpx3;
1078         dpy3 = ddpy3;
1079         dpz3 = ddpz3;
1080     }
1081 
1082     /*! X Coordinate of definition point 1. */
1083     double dpx1;
1084     /*! Y Coordinate of definition point 1. */
1085     double dpy1;
1086     /*! Z Coordinate of definition point 1. */
1087     double dpz1;
1088 
1089     /*! X Coordinate of definition point 2. */
1090     double dpx2;
1091     /*! Y Coordinate of definition point 2. */
1092     double dpy2;
1093     /*! Z Coordinate of definition point 2. */
1094     double dpz2;
1095 
1096     /*! X Coordinate of definition point 3. */
1097     double dpx3;
1098     /*! Y Coordinate of definition point 3. */
1099     double dpy3;
1100     /*! Z Coordinate of definition point 3. */
1101     double dpz3;
1102 };
1103 
1104 
1105 
1106 /**
1107  * Ordinate Dimension Data.
1108  *
1109  * @author Andrew Mustun
1110  */
1111 struct DL_DimOrdinateData {
1112     /**
1113      * Constructor.
1114      * Parameters: see member variables.
1115      */
DL_DimOrdinateDataDL_DimOrdinateData1116     DL_DimOrdinateData(double ddpx1, double ddpy1, double ddpz1,
1117                       double ddpx2, double ddpy2, double ddpz2,
1118                       bool dxtype) {
1119 
1120         dpx1 = ddpx1;
1121         dpy1 = ddpy1;
1122         dpz1 = ddpz1;
1123 
1124         dpx2 = ddpx2;
1125         dpy2 = ddpy2;
1126         dpz2 = ddpz2;
1127 
1128         xtype = dxtype;
1129     }
1130 
1131     /*! X Coordinate of definition point 1. */
1132     double dpx1;
1133     /*! Y Coordinate of definition point 1. */
1134     double dpy1;
1135     /*! Z Coordinate of definition point 1. */
1136     double dpz1;
1137 
1138     /*! X Coordinate of definition point 2. */
1139     double dpx2;
1140     /*! Y Coordinate of definition point 2. */
1141     double dpy2;
1142     /*! Z Coordinate of definition point 2. */
1143     double dpz2;
1144 
1145     /*! True if the dimension indicates the X-value, false for Y-value */
1146     bool xtype;
1147 };
1148 
1149 
1150 
1151 /**
1152  * Leader (arrow).
1153  *
1154  * @author Andrew Mustun
1155  */
1156 struct DL_LeaderData {
1157     /**
1158      * Constructor.
1159      * Parameters: see member variables.
1160      */
DL_LeaderDataDL_LeaderData1161     DL_LeaderData(int lArrowHeadFlag,
1162                   int lLeaderPathType,
1163                   int lLeaderCreationFlag,
1164                   int lHooklineDirectionFlag,
1165                   int lHooklineFlag,
1166                   double lTextAnnotationHeight,
1167                   double lTextAnnotationWidth,
1168                   int lNumber) {
1169 
1170         arrowHeadFlag = lArrowHeadFlag;
1171         leaderPathType = lLeaderPathType;
1172         leaderCreationFlag = lLeaderCreationFlag;
1173         hooklineDirectionFlag = lHooklineDirectionFlag;
1174         hooklineFlag = lHooklineFlag;
1175         textAnnotationHeight = lTextAnnotationHeight;
1176         textAnnotationWidth = lTextAnnotationWidth;
1177         number = lNumber;
1178     }
1179 
1180     /*! Arrow head flag (71). */
1181     int arrowHeadFlag;
1182     /*! Leader path type (72). */
1183     int leaderPathType;
1184     /*! Leader creation flag (73). */
1185     int leaderCreationFlag;
1186     /*! Hookline direction flag (74). */
1187     int hooklineDirectionFlag;
1188     /*! Hookline flag (75) */
1189     int hooklineFlag;
1190     /*! Text annotation height (40). */
1191     double textAnnotationHeight;
1192     /*! Text annotation width (41) */
1193     double textAnnotationWidth;
1194     /*! Number of vertices in leader (76). */
1195     int number;
1196 };
1197 
1198 
1199 
1200 /**
1201  * Leader Vertex Data.
1202  *
1203  * @author Andrew Mustun
1204  */
1205 struct DL_LeaderVertexData {
1206     /**
1207      * Constructor.
1208      * Parameters: see member variables.
1209      */
1210     DL_LeaderVertexData(double px=0.0, double py=0.0, double pz=0.0) {
1211         x = px;
1212         y = py;
1213         z = pz;
1214     }
1215 
1216     /*! X Coordinate of the vertex. */
1217     double x;
1218     /*! Y Coordinate of the vertex. */
1219     double y;
1220     /*! Z Coordinate of the vertex. */
1221     double z;
1222 };
1223 
1224 
1225 
1226 /**
1227  * Hatch data.
1228  */
1229 struct DL_HatchData {
1230     /**
1231      * Default constructor.
1232      */
DL_HatchDataDL_HatchData1233     DL_HatchData() {}
1234 
1235     /**
1236      * Constructor.
1237      * Parameters: see member variables.
1238      */
DL_HatchDataDL_HatchData1239     DL_HatchData(int hNumLoops,
1240                  bool hSolid,
1241                  double hScale,
1242                  double hAngle,
1243                  const string& hPattern) {
1244         numLoops = hNumLoops;
1245         solid = hSolid;
1246         scale = hScale;
1247         angle = hAngle;
1248         pattern = hPattern;
1249     }
1250 
1251     /*! Number of boundary paths (loops). */
1252     int numLoops;
1253     /*! Solid fill flag (true=solid, false=pattern). */
1254     bool solid;
1255     /*! Pattern scale or spacing */
1256     double scale;
1257     /*! Pattern angle */
1258     double angle;
1259     /*! Pattern name. */
1260     string pattern;
1261 };
1262 
1263 
1264 
1265 /**
1266  * Hatch boundary path (loop) data.
1267  */
1268 struct DL_HatchLoopData {
1269     /**
1270      * Default constructor.
1271      */
DL_HatchLoopDataDL_HatchLoopData1272     DL_HatchLoopData() {}
1273     /**
1274      * Constructor.
1275      * Parameters: see member variables.
1276      */
DL_HatchLoopDataDL_HatchLoopData1277     DL_HatchLoopData(int hNumEdges) {
1278         numEdges = hNumEdges;
1279     }
1280 
1281     /*! Number of edges in this loop. */
1282     int numEdges;
1283     int pathType; //Boundary path type
1284 };
1285 
1286 
1287 
1288 /**
1289  * Hatch edge data.
1290  */
1291 struct DL_HatchEdgeData {
1292     /**
1293      * Default constructor.
1294      */
DL_HatchEdgeDataDL_HatchEdgeData1295     DL_HatchEdgeData() {
1296         defined = false;
1297     }
1298 
1299     /**
1300      * Constructor for a line edge.
1301      * Parameters: see member variables.
1302      */
DL_HatchEdgeDataDL_HatchEdgeData1303     DL_HatchEdgeData(double lx1, double ly1,
1304                      double lx2, double ly2) {
1305         x1 = lx1;
1306         y1 = ly1;
1307         x2 = lx2;
1308         y2 = ly2;
1309         type = 1;
1310         defined = true;
1311     }
1312 
1313     /**
1314      * Constructor for an arc edge.
1315      * Parameters: see member variables.
1316      */
DL_HatchEdgeDataDL_HatchEdgeData1317     DL_HatchEdgeData(double acx, double acy,
1318                      double aRadius,
1319                      double aAngle1, double aAngle2,
1320                      bool aCcw) {
1321         cx = acx;
1322         cy = acy;
1323         radius = aRadius;
1324         angle1 = aAngle1;
1325         angle2 = aAngle2;
1326         ccw = aCcw;
1327         type = 2;
1328         defined = true;
1329     }
1330 
1331     /**
1332      * Edge type. 1=line, 2=arc.
1333      */
1334     int type;
1335 
1336     /**
1337      * Set to true if this edge is fully defined.
1338      */
1339     bool defined;
1340 
1341     /*! Start point (X). */
1342     double x1;
1343     /*! Start point (Y). */
1344     double y1;
1345     /*! End point (X). */
1346     double x2;
1347     /*! End point (Y). */
1348     double y2;
1349     /*! Center point of arc (X). */
1350     double cx;
1351     /*! Center point of arc (Y). */
1352     double cy;
1353     /*! Arc radius. */
1354     double radius;
1355     /*! Start angle. */
1356     double angle1;
1357     /*! End angle. */
1358     double angle2;
1359     /*! Counterclockwise flag. */
1360     bool ccw;
1361 };
1362 
1363 
1364 
1365 /**
1366  * Image Data.
1367  *
1368  * @author Andrew Mustun
1369  */
1370 struct DL_ImageData {
1371     /**
1372      * Constructor.
1373      * Parameters: see member variables.
1374      */
DL_ImageDataDL_ImageData1375     DL_ImageData(const string& iref,
1376                   double iipx, double iipy, double iipz,
1377                   double iux, double iuy, double iuz,
1378                   double ivx, double ivy, double ivz,
1379                   int iwidth, int iheight,
1380                   int ibrightness, int icontrast, int ifade) {
1381         ref = iref;
1382         ipx = iipx;
1383         ipy = iipy;
1384         ipz = iipz;
1385         ux = iux;
1386         uy = iuy;
1387         uz = iuz;
1388         vx = ivx;
1389         vy = ivy;
1390         vz = ivz;
1391         width = iwidth;
1392         height = iheight;
1393         brightness = ibrightness;
1394         contrast = icontrast;
1395         fade = ifade;
1396     }
1397 
1398     /*! Reference to the image file
1399         (unique, used to refer to the image def object). */
1400     string ref;
1401     /*! X Coordinate of insertion point. */
1402     double ipx;
1403     /*! Y Coordinate of insertion point. */
1404     double ipy;
1405     /*! Z Coordinate of insertion point. */
1406     double ipz;
1407     /*! X Coordinate of u vector along bottom of image. */
1408     double ux;
1409     /*! Y Coordinate of u vector along bottom of image. */
1410     double uy;
1411     /*! Z Coordinate of u vector along bottom of image. */
1412     double uz;
1413     /*! X Coordinate of v vector along left side of image. */
1414     double vx;
1415     /*! Y Coordinate of v vector along left side of image. */
1416     double vy;
1417     /*! Z Coordinate of v vector along left side of image. */
1418     double vz;
1419     /*! Width of image in pixel. */
1420     int width;
1421     /*! Height of image in pixel. */
1422     int height;
1423     /*! Brightness (0..100, default = 50). */
1424     int brightness;
1425     /*! Contrast (0..100, default = 50). */
1426     int contrast;
1427     /*! Fade (0..100, default = 0). */
1428     int fade;
1429 };
1430 
1431 
1432 
1433 /**
1434  * Image Definition Data.
1435  *
1436  * @author Andrew Mustun
1437  */
1438 struct DL_ImageDefData {
1439     /**
1440      * Constructor.
1441      * Parameters: see member variables.
1442      */
DL_ImageDefDataDL_ImageDefData1443     DL_ImageDefData(const string& iref,
1444                  const string& ifile) {
1445         ref = iref;
1446         file = ifile;
1447     }
1448 
1449     /*! Reference to the image file
1450         (unique, used to refer to the image def object). */
1451     string ref;
1452 
1453     /*! Image file */
1454     string file;
1455 };
1456 
1457 #endif
1458 
1459 // EOF
1460 
1461