~librecad-dev/librecad/librecad

« back to all changes in this revision

Viewing changes to libraries/libdxfrw/src/drw_entities.h

  • Committer: Scott Howard
  • Date: 2014-02-21 19:07:55 UTC
  • Revision ID: showard@debian.org-20140221190755-csjax9wb146hgdq4
first commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/******************************************************************************
 
2
**  libDXFrw - Library to read/write DXF files (ascii & binary)              **
 
3
**                                                                           **
 
4
**  Copyright (C) 2011 Rallaz, rallazz@gmail.com                             **
 
5
**                                                                           **
 
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
******************************************************************************/
 
12
 
 
13
#ifndef DRW_ENTITIES_H
 
14
#define DRW_ENTITIES_H
 
15
 
 
16
 
 
17
#include <string>
 
18
#include <vector>
 
19
#include "drw_base.h"
 
20
 
 
21
class dxfReader;
 
22
class DRW_Polyline;
 
23
 
 
24
namespace DRW {
 
25
 
 
26
   //! Entity's type.
 
27
    enum ETYPE {
 
28
        POINT,
 
29
        LINE,
 
30
        CIRCLE,
 
31
        ARC,
 
32
        ELLIPSE,
 
33
        TRACE,
 
34
        SOLID,
 
35
        BLOCK,
 
36
        INSERT,
 
37
        LWPOLYLINE,
 
38
        POLYLINE,
 
39
        VERTEX,
 
40
        SPLINE,
 
41
        HATCH,
 
42
        TEXT,
 
43
        MTEXT,
 
44
        E3DFACE,
 
45
        IMAGE,
 
46
        LEADER,
 
47
        DIMENSION,
 
48
        DIMALIGNED,
 
49
        DIMLINEAR,
 
50
        DIMRADIAL,
 
51
        DIMDIAMETRIC,
 
52
        DIMANGULAR,
 
53
        DIMANGULAR3P,
 
54
        DIMORDINATE,
 
55
//        OVERLAYBOX,
 
56
//        CONSTRUCTIONLINE,
 
57
        RAY,
 
58
        XLINE,
 
59
        VIEWPORT,
 
60
        UNKNOWN
 
61
    };
 
62
 
 
63
}
 
64
 
 
65
//! Base class for entities
 
66
/*!
 
67
*  Base class for entities
 
68
*  @author Rallaz
 
69
*/
 
70
class DRW_Entity {
 
71
public:
 
72
    //initializes default values
 
73
    DRW_Entity() {
 
74
        eType = DRW::UNKNOWN;
 
75
        lineType = "BYLAYER";
 
76
        color = 256; // default BYLAYER (256)
 
77
        ltypeScale = 1.0;
 
78
        visible = true;
 
79
        layer = "0";
 
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
 
84
    }
 
85
    virtual~DRW_Entity() {}
 
86
 
 
87
    DRW_Entity(const DRW_Entity& d) {
 
88
        eType = d.eType;
 
89
        handle = d.handle;
 
90
        handleBlock = d.handleBlock;
 
91
        layer = d.layer;
 
92
        lineType = d.lineType;
 
93
        color = d.color;
 
94
        color24 = d.color24;
 
95
        colorName = d.colorName;
 
96
        ltypeScale = d.ltypeScale;
 
97
        visible = d.visible;
 
98
        lWeight = d.lWeight;
 
99
        space = d.space;
 
100
        haveExtrusion = d.haveExtrusion;
 
101
    }
 
102
 
 
103
    virtual void applyExtrusion() = 0;
 
104
protected:
 
105
    void parseCode(int code, dxfReader *reader);
 
106
    void calculateAxis(DRW_Coord extPoint);
 
107
    void extrudePoint(DRW_Coord extPoint, DRW_Coord *point);
 
108
 
 
109
public:
 
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*/
 
123
private:
 
124
    DRW_Coord extAxisX;
 
125
    DRW_Coord extAxisY;
 
126
};
 
127
 
 
128
 
 
129
//! Class to handle point entity
 
130
/*!
 
131
*  Class to handle point entity
 
132
*  @author Rallaz
 
133
*/
 
134
class DRW_Point : public DRW_Entity {
 
135
public:
 
136
    DRW_Point() {
 
137
        eType = DRW::POINT;
 
138
        basePoint.z = extPoint.x = extPoint.y = 0;
 
139
        extPoint.z = 1;
 
140
        thickness = 0;
 
141
    }
 
142
 
 
143
    virtual void applyExtrusion(){}
 
144
 
 
145
    void parseCode(int code, dxfReader *reader);
 
146
 
 
147
public:
 
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 */
 
151
};
 
152
 
 
153
//! Class to handle line entity
 
154
/*!
 
155
*  Class to handle line entity
 
156
*  @author Rallaz
 
157
*/
 
158
class DRW_Line : public DRW_Point {
 
159
public:
 
160
    DRW_Line() {
 
161
        eType = DRW::LINE;
 
162
        secPoint.z = 0;
 
163
    }
 
164
 
 
165
    virtual void applyExtrusion(){}
 
166
    void parseCode(int code, dxfReader *reader);
 
167
 
 
168
public:
 
169
    DRW_Coord secPoint;        /*!< second point, code 11, 21 & 31 */
 
170
};
 
171
 
 
172
//! Class to handle ray entity
 
173
/*!
 
174
*  Class to handle ray entity
 
175
*  @author Rallaz
 
176
*/
 
177
class DRW_Ray : public DRW_Line {
 
178
public:
 
179
    DRW_Ray() {
 
180
        eType = DRW::RAY;
 
181
    }
 
182
};
 
183
 
 
184
//! Class to handle xline entity
 
185
/*!
 
186
*  Class to handle xline entity
 
187
*  @author Rallaz
 
188
*/
 
189
class DRW_Xline : public DRW_Line {
 
190
public:
 
191
    DRW_Xline() {
 
192
        eType = DRW::XLINE;
 
193
    }
 
194
};
 
195
 
 
196
//! Class to handle circle entity
 
197
/*!
 
198
*  Class to handle circle entity
 
199
*  @author Rallaz
 
200
*/
 
201
class DRW_Circle : public DRW_Point {
 
202
public:
 
203
    DRW_Circle() {
 
204
        eType = DRW::CIRCLE;
 
205
    }
 
206
 
 
207
    virtual void applyExtrusion();
 
208
    void parseCode(int code, dxfReader *reader);
 
209
 
 
210
public:
 
211
    double radious;                 /*!< radius, code 40 */
 
212
};
 
213
 
 
214
//! Class to handle arc entity
 
215
/*!
 
216
*  Class to handle arc entity
 
217
*  @author Rallaz
 
218
*/
 
219
class DRW_Arc : public DRW_Circle {
 
220
public:
 
221
    DRW_Arc() {
 
222
        eType = DRW::ARC;
 
223
        isccw = 1;
 
224
    }
 
225
 
 
226
    virtual void applyExtrusion(){DRW_Circle::applyExtrusion();}
 
227
    void parseCode(int code, dxfReader *reader);
 
228
 
 
229
public:
 
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 */
 
233
};
 
234
 
 
235
//! Class to handle ellipse entity
 
236
/*!
 
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
 
240
*  @author Rallaz
 
241
*/
 
242
class DRW_Ellipse : public DRW_Line {
 
243
public:
 
244
    DRW_Ellipse() {
 
245
        eType = DRW::ELLIPSE;
 
246
        isccw = 1;
 
247
    }
 
248
 
 
249
    void parseCode(int code, dxfReader *reader);
 
250
    void toPolyline(DRW_Polyline *pol, int parts = 128);
 
251
    virtual void applyExtrusion();
 
252
    void correctAxis();
 
253
public:
 
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 */
 
258
};
 
259
 
 
260
//! Class to handle trace entity
 
261
/*!
 
262
*  Class to handle trace entity
 
263
*  @author Rallaz
 
264
*/
 
265
class DRW_Trace : public DRW_Line {
 
266
public:
 
267
    DRW_Trace() {
 
268
        eType = DRW::TRACE;
 
269
        thirdPoint.z = 0;
 
270
        fourPoint.z = 0;
 
271
    }
 
272
 
 
273
    virtual void applyExtrusion();
 
274
    void parseCode(int code, dxfReader *reader);
 
275
 
 
276
public:
 
277
    DRW_Coord thirdPoint;        /*!< third point, code 12, 22 & 32 */
 
278
    DRW_Coord fourPoint;        /*!< four point, code 13, 23 & 33 */
 
279
};
 
280
 
 
281
//! Class to handle solid entity
 
282
/*!
 
283
*  Class to handle solid entity
 
284
*  @author Rallaz
 
285
*/
 
286
class DRW_Solid : public DRW_Trace {
 
287
public:
 
288
    DRW_Solid() {
 
289
        eType = DRW::SOLID;
 
290
    }
 
291
 
 
292
    void parseCode(int code, dxfReader *reader);
 
293
};
 
294
 
 
295
//! Class to handle 3dface entity
 
296
/*!
 
297
*  Class to handle 3dface entity
 
298
*  @author Rallaz
 
299
*/
 
300
class DRW_3Dface : public DRW_Trace {
 
301
public:
 
302
    DRW_3Dface() {
 
303
        eType = DRW::E3DFACE;
 
304
        invisibleflag = 0;
 
305
    }
 
306
 
 
307
    virtual void applyExtrusion(){}
 
308
    void parseCode(int code, dxfReader *reader);
 
309
 
 
310
public:
 
311
    int invisibleflag;       /*!< invisible edge flag, code 70 */
 
312
 
 
313
};
 
314
 
 
315
//! Class to handle block entries
 
316
/*!
 
317
*  Class to handle block entries
 
318
*  @author Rallaz
 
319
*/
 
320
class DRW_Block : public DRW_Point {
 
321
public:
 
322
    DRW_Block() {
 
323
        eType = DRW::BLOCK;
 
324
        layer = "0";
 
325
        flags = 0;
 
326
        name = "*U0";
 
327
    }
 
328
 
 
329
    virtual void applyExtrusion(){}
 
330
    void parseCode(int code, dxfReader *reader);
 
331
 
 
332
public:
 
333
    UTF8STRING name;             /*!< block name, code 2 */
 
334
    int flags;                   /*!< block type, code 70 */
 
335
};
 
336
 
 
337
 
 
338
//! Class to handle insert entries
 
339
/*!
 
340
*  Class to handle insert entries
 
341
*  @author Rallaz
 
342
*/
 
343
class DRW_Insert : public DRW_Point {
 
344
public:
 
345
    DRW_Insert() {
 
346
        eType = DRW::INSERT;
 
347
        xscale = 1;
 
348
        yscale = 1;
 
349
        zscale = 1;
 
350
        angle = 0;
 
351
        colcount = 1;
 
352
        rowcount = 1;
 
353
        colspace = 0;
 
354
        rowspace = 0;
 
355
    }
 
356
 
 
357
    virtual void applyExtrusion(){DRW_Point::applyExtrusion();}
 
358
    void parseCode(int code, dxfReader *reader);
 
359
 
 
360
public:
 
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 */
 
370
};
 
371
 
 
372
//! Class to handle lwpolyline entity
 
373
/*!
 
374
*  Class to handle lwpolyline entity
 
375
*  @author Rallaz
 
376
*/
 
377
class DRW_LWPolyline : public DRW_Entity {
 
378
public:
 
379
    DRW_LWPolyline() {
 
380
        eType = DRW::LWPOLYLINE;
 
381
        elevation = thickness = width = 0.0;
 
382
        flags = 0;
 
383
        extPoint.x = extPoint.y = 0;
 
384
        extPoint.z = 1;
 
385
        vertex = NULL;
 
386
    }
 
387
    ~DRW_LWPolyline() {
 
388
        while (!vertlist.empty()) {
 
389
           vertlist.pop_back();
 
390
         }
 
391
    }
 
392
    virtual void applyExtrusion();
 
393
    void addVertex (DRW_Vertex2D v) {
 
394
        DRW_Vertex2D *vert = new DRW_Vertex2D();
 
395
        vert->x = v.x;
 
396
        vert->y = v.y;
 
397
        vert->stawidth = v.stawidth;
 
398
        vert->endwidth = v.endwidth;
 
399
        vert->bulge = v.bulge;
 
400
        vertlist.push_back(vert);
 
401
    }
 
402
    DRW_Vertex2D *addVertex () {
 
403
        DRW_Vertex2D *vert = new DRW_Vertex2D();
 
404
        vert->stawidth = 0;
 
405
        vert->endwidth = 0;
 
406
        vert->bulge = 0;
 
407
        vertlist.push_back(vert);
 
408
        return vert;
 
409
    }
 
410
 
 
411
    void parseCode(int code, dxfReader *reader);
 
412
 
 
413
public:
 
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 */
 
422
};
 
423
 
 
424
//! Class to handle insert entries
 
425
/*!
 
426
*  Class to handle insert entries
 
427
*  @author Rallaz
 
428
*/
 
429
class DRW_Text : public DRW_Line {
 
430
public:
 
431
    //! Vertical alignments.
 
432
        enum VAlign {
 
433
            VBaseLine = 0,  /*!< Top = 0 */
 
434
            VBottom,        /*!< Bottom = 1 */
 
435
            VMiddle,        /*!< Middle = 2 */
 
436
            VTop            /*!< Top = 3 */
 
437
        };
 
438
 
 
439
    //! Horizontal alignments.
 
440
        enum HAlign {
 
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) */
 
447
        };
 
448
 
 
449
    DRW_Text() {
 
450
        eType = DRW::TEXT;
 
451
        angle = 0;
 
452
        widthscale = 1;
 
453
        oblique = 0;
 
454
        style = "STANDARD";
 
455
        textgen = 0;
 
456
        alignH = HLeft;
 
457
        alignV = VBaseLine;
 
458
    }
 
459
 
 
460
    virtual void applyExtrusion(){} //RLZ TODO
 
461
    void parseCode(int code, dxfReader *reader);
 
462
 
 
463
public:
 
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 */
 
473
};
 
474
 
 
475
//! Class to handle insert entries
 
476
/*!
 
477
*  Class to handle insert entries
 
478
*  @author Rallaz
 
479
*/
 
480
class DRW_MText : public DRW_Text {
 
481
public:
 
482
    //! Attachments.
 
483
    enum Attach {
 
484
        TopLeft = 1,
 
485
        TopCenter,
 
486
        TopRight,
 
487
        MiddleLeft,
 
488
        MiddleCenter,
 
489
        MiddleRight,
 
490
        BottomLeft,
 
491
        BottomCenter,
 
492
        BottomRight
 
493
    };
 
494
 
 
495
    DRW_MText() {
 
496
        eType = DRW::MTEXT;
 
497
        interlin = 1;
 
498
        alignV = (VAlign)TopLeft;
 
499
        textgen = 1;
 
500
        haveXAxis = false;    //if true needed to recalculate angle
 
501
    }
 
502
 
 
503
    void parseCode(int code, dxfReader *reader);
 
504
    void updateAngle();    //recalculate angle if 'haveXAxis' is true
 
505
 
 
506
public:
 
507
    double interlin;     /*!< width factor, code 44 */
 
508
private:
 
509
    bool haveXAxis;
 
510
};
 
511
 
 
512
//! Class to handle vertex
 
513
/*!
 
514
*  Class to handle vertex  for polyline entity
 
515
*  @author Rallaz
 
516
*/
 
517
class DRW_Vertex : public DRW_Point {
 
518
public:
 
519
    DRW_Vertex() {
 
520
        eType = DRW::VERTEX;
 
521
        stawidth = endwidth = bulge = 0;
 
522
        vindex1 = vindex2 = vindex3 = vindex4 = 0;
 
523
        flags = identifier = 0;
 
524
    }
 
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;
 
529
        basePoint.x = sx;
 
530
        basePoint.y =sy;
 
531
        basePoint.z =sz;
 
532
        bulge = b;
 
533
    }
 
534
 
 
535
    void parseCode(int code, dxfReader *reader);
 
536
 
 
537
public:
 
538
    double stawidth;          /*!< Start width, code 40 */
 
539
    double endwidth;          /*!< End width, code 41 */
 
540
    double bulge;             /*!< bulge, code 42 */
 
541
 
 
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 */
 
549
};
 
550
 
 
551
//! Class to handle polyline entity
 
552
/*!
 
553
*  Class to handle polyline entity
 
554
*  @author Rallaz
 
555
*/
 
556
class DRW_Polyline : public DRW_Point {
 
557
public:
 
558
    DRW_Polyline() {
 
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;
 
564
    }
 
565
    ~DRW_Polyline() {
 
566
        while (!vertlist.empty()) {
 
567
           vertlist.pop_back();
 
568
         }
 
569
    }
 
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);
 
579
    }
 
580
    void appendVertex (DRW_Vertex *v) {
 
581
        vertlist.push_back(v);
 
582
    }
 
583
 
 
584
    void parseCode(int code, dxfReader *reader);
 
585
 
 
586
public:
 
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 */
 
595
 
 
596
    std::vector<DRW_Vertex *> vertlist;  /*!< vertex list */
 
597
};
 
598
 
 
599
 
 
600
//! Class to handle spline entity
 
601
/*!
 
602
*  Class to handle spline entity
 
603
*  @author Rallaz
 
604
*/
 
605
class DRW_Spline : public DRW_Entity {
 
606
public:
 
607
    DRW_Spline() {
 
608
        eType = DRW::SPLINE;
 
609
        flags = nknots = ncontrol = nfit = 0;
 
610
        ex = ey = 0.0;
 
611
        ez = 1.0;
 
612
        tolknot = tolcontrol = tolfit = 0.0000001;
 
613
 
 
614
    }
 
615
    ~DRW_Spline() {
 
616
        while (!controllist.empty()) {
 
617
           controllist.pop_back();
 
618
        }
 
619
        while (!fitlist.empty()) {
 
620
           fitlist.pop_back();
 
621
        }
 
622
    }
 
623
    virtual void applyExtrusion(){}
 
624
 
 
625
    void parseCode(int code, dxfReader *reader);
 
626
 
 
627
public:
 
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 */
 
645
 
 
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 */
 
649
 
 
650
private:
 
651
    DRW_Coord *controlpoint;   /*!< current control point to add data */
 
652
    DRW_Coord *fitpoint;       /*!< current fit point to add data */
 
653
};
 
654
 
 
655
//! Class to handle hatch loop
 
656
/*!
 
657
*  Class to handle hatch loop
 
658
*  @author Rallaz
 
659
*/
 
660
class DRW_HatchLoop {
 
661
public:
 
662
    DRW_HatchLoop(int t) {
 
663
        type = t;
 
664
        numedges = 0;
 
665
    }
 
666
 
 
667
    ~DRW_HatchLoop() {
 
668
/*        while (!pollist.empty()) {
 
669
           pollist.pop_back();
 
670
         }*/
 
671
        while (!objlist.empty()) {
 
672
           objlist.pop_back();
 
673
         }
 
674
    }
 
675
 
 
676
    void update() {
 
677
        numedges = objlist.size();
 
678
    }
 
679
 
 
680
public:
 
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 */
 
686
};
 
687
 
 
688
//! Class to handle hatch entity
 
689
/*!
 
690
*  Class to handle hatch entity
 
691
*  @author Rallaz
 
692
*/
 
693
//TODO: handle lwpolylines, splines and ellipses
 
694
class DRW_Hatch : public DRW_Point {
 
695
public:
 
696
    DRW_Hatch() {
 
697
        eType = DRW::HATCH;
 
698
        angle = scale = 0.0;
 
699
        basePoint.x = basePoint.y = basePoint.z = 0.0;
 
700
        loopsnum = hstyle = associative = 0;
 
701
        solid = hpattern = 1;
 
702
        deflines = doubleflag = 0;
 
703
        loop = NULL;
 
704
        clearEntities();
 
705
    }
 
706
 
 
707
    ~DRW_Hatch() {
 
708
        while (!looplist.empty()) {
 
709
           looplist.pop_back();
 
710
         }
 
711
    }
 
712
 
 
713
    void appendLoop (DRW_HatchLoop *v) {
 
714
        looplist.push_back(v);
 
715
    }
 
716
 
 
717
    virtual void applyExtrusion(){}
 
718
    void parseCode(int code, dxfReader *reader);
 
719
 
 
720
public:
 
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 */
 
731
 
 
732
    std::vector<DRW_HatchLoop *> looplist;  /*!< polyline list */
 
733
 
 
734
private:
 
735
    void clearEntities(){
 
736
        pt = line = NULL;
 
737
        pline = NULL;
 
738
        arc = NULL;
 
739
        ellipse = NULL;
 
740
        spline = NULL;
 
741
        plvert = NULL;
 
742
    }
 
743
 
 
744
    void addLine() {
 
745
        clearEntities();
 
746
        if (loop) {
 
747
            pt = line = new DRW_Line;
 
748
            loop->objlist.push_back(line);
 
749
        }
 
750
    }
 
751
 
 
752
    void addArc() {
 
753
        clearEntities();
 
754
        if (loop) {
 
755
            pt = arc = new DRW_Arc;
 
756
            loop->objlist.push_back(arc);
 
757
        }
 
758
    }
 
759
 
 
760
    void addEllipse() {
 
761
        clearEntities();
 
762
        if (loop) {
 
763
            pt = ellipse = new DRW_Ellipse;
 
764
            loop->objlist.push_back(ellipse);
 
765
        }
 
766
    }
 
767
 
 
768
    void addSpline() {
 
769
        clearEntities();
 
770
        if (loop) {
 
771
            pt = NULL;
 
772
            spline = new DRW_Spline;
 
773
            loop->objlist.push_back(spline);
 
774
        }
 
775
    }
 
776
 
 
777
    DRW_HatchLoop *loop;       /*!< current loop to add data */
 
778
    DRW_Line *line;
 
779
    DRW_Arc *arc;
 
780
    DRW_Ellipse *ellipse;
 
781
    DRW_Spline *spline;
 
782
    DRW_LWPolyline *pline;
 
783
    DRW_Point *pt;
 
784
    DRW_Vertex2D *plvert;
 
785
    bool ispol;
 
786
};
 
787
 
 
788
//! Class to handle image entity
 
789
/*!
 
790
*  Class to handle image entity
 
791
*  @author Rallaz
 
792
*/
 
793
class DRW_Image : public DRW_Line {
 
794
public:
 
795
    DRW_Image() {
 
796
        eType = DRW::IMAGE;
 
797
        vz = fade = clip = 0;
 
798
        brightness = contrast = 50;
 
799
    }
 
800
 
 
801
    void parseCode(int code, dxfReader *reader);
 
802
 
 
803
public:
 
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 */
 
815
 
 
816
};
 
817
 
 
818
 
 
819
//! Base class for dimension entity
 
820
/*!
 
821
*  Base class for dimension entity
 
822
*  @author Rallaz
 
823
*/
 
824
class DRW_Dimension : public DRW_Entity {
 
825
public:
 
826
    DRW_Dimension() {
 
827
        eType = DRW::DIMENSION;
 
828
        linesty = 1;
 
829
        linefactor = extPoint.z = 1.0;
 
830
        angle = oblique = rot = 0.0;
 
831
        align = 5;
 
832
        style = "STANDARD";
 
833
        defPoint.z = extPoint.x = extPoint.y = 0;
 
834
        textPoint.z = rot = 0;
 
835
        clonePoint.x = clonePoint.y = clonePoint.z = 0;
 
836
    }
 
837
 
 
838
    DRW_Dimension(const DRW_Dimension& d): DRW_Entity(d) {
 
839
        eType = DRW::DIMENSION;
 
840
        type =d.type;
 
841
        name = d.name;
 
842
        defPoint = d.defPoint;
 
843
        textPoint = d.textPoint;
 
844
        text = d.text;
 
845
        style = d.style;
 
846
        align = d.align;
 
847
        linesty = d.linesty;
 
848
        linefactor = d.linefactor;
 
849
        rot = d.rot;
 
850
        extPoint = d.extPoint;
 
851
        clonePoint = d.clonePoint;
 
852
        def1 = d.def1;
 
853
        def2 = d.def2;
 
854
        angle = d.angle;
 
855
        oblique = d.oblique;
 
856
        arcPoint = d.arcPoint;
 
857
        circlePoint = d.circlePoint;
 
858
        length = d.length;
 
859
    }
 
860
    virtual ~DRW_Dimension() {}
 
861
 
 
862
    void parseCode(int code, dxfReader *reader);
 
863
    virtual void applyExtrusion(){}
 
864
 
 
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;}
 
881
 
 
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 */
 
887
 
 
888
protected:
 
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;}
 
905
public:
 
906
    int type;                  /*!< Dimension type, code 70 */
 
907
private:
 
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 */
 
918
 
 
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 */
 
925
 
 
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 */
 
929
};
 
930
 
 
931
 
 
932
//! Class to handle  aligned dimension entity
 
933
/*!
 
934
*  Class to handle aligned dimension entity
 
935
*  @author Rallaz
 
936
*/
 
937
class DRW_DimAligned : public DRW_Dimension {
 
938
public:
 
939
    DRW_DimAligned(){
 
940
        eType = DRW::DIMALIGNED;
 
941
    }
 
942
    DRW_DimAligned(const DRW_Dimension& d): DRW_Dimension(d) {
 
943
        eType = DRW::DIMALIGNED;
 
944
    }
 
945
 
 
946
    DRW_Coord getClonepoint() const {return getPt2();}      /*!< Insertion for clones (Baseline & Continue), 12, 22 & 32 */
 
947
    void setClonePoint(DRW_Coord c){setPt2(c);}
 
948
 
 
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);}
 
955
};
 
956
 
 
957
//! Class to handle  linear or rotated dimension entity
 
958
/*!
 
959
*  Class to handle linear or rotated dimension entity
 
960
*  @author Rallaz
 
961
*/
 
962
class DRW_DimLinear : public DRW_DimAligned {
 
963
public:
 
964
    DRW_DimLinear() {
 
965
        eType = DRW::DIMLINEAR;
 
966
    }
 
967
    DRW_DimLinear(const DRW_Dimension& d): DRW_DimAligned(d) {
 
968
        eType = DRW::DIMLINEAR;
 
969
    }
 
970
 
 
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);}
 
975
};
 
976
 
 
977
//! Class to handle radial dimension entity
 
978
/*!
 
979
*  Class to handle aligned, linear or rotated dimension entity
 
980
*  @author Rallaz
 
981
*/
 
982
class DRW_DimRadial : public DRW_Dimension {
 
983
public:
 
984
    DRW_DimRadial() {
 
985
        eType = DRW::DIMRADIAL;
 
986
    }
 
987
    DRW_DimRadial(const DRW_Dimension& d): DRW_Dimension(d) {
 
988
        eType = DRW::DIMRADIAL;
 
989
    }
 
990
 
 
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);}
 
997
};
 
998
 
 
999
//! Class to handle radial dimension entity
 
1000
/*!
 
1001
*  Class to handle aligned, linear or rotated dimension entity
 
1002
*  @author Rallaz
 
1003
*/
 
1004
class DRW_DimDiametric : public DRW_Dimension {
 
1005
public:
 
1006
    DRW_DimDiametric() {
 
1007
        eType = DRW::DIMDIAMETRIC;
 
1008
    }
 
1009
    DRW_DimDiametric(const DRW_Dimension& d): DRW_Dimension(d) {
 
1010
        eType = DRW::DIMDIAMETRIC;
 
1011
    }
 
1012
 
 
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);}
 
1019
};
 
1020
 
 
1021
//! Class to handle angular dimension entity
 
1022
/*!
 
1023
*  Class to handle angular dimension entity
 
1024
*  @author Rallaz
 
1025
*/
 
1026
class DRW_DimAngular : public DRW_Dimension {
 
1027
public:
 
1028
    DRW_DimAngular() {
 
1029
        eType = DRW::DIMANGULAR;
 
1030
    }
 
1031
    DRW_DimAngular(const DRW_Dimension& d): DRW_Dimension(d) {
 
1032
        eType = DRW::DIMANGULAR;
 
1033
    }
 
1034
 
 
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);}
 
1045
};
 
1046
 
 
1047
 
 
1048
//! Class to handle angular 3p dimension entity
 
1049
/*!
 
1050
*  Class to handle angular 3p dimension entity
 
1051
*  @author Rallaz
 
1052
*/
 
1053
class DRW_DimAngular3p : public DRW_Dimension {
 
1054
public:
 
1055
    DRW_DimAngular3p() {
 
1056
        eType = DRW::DIMANGULAR3P;
 
1057
    }
 
1058
    DRW_DimAngular3p(const DRW_Dimension& d): DRW_Dimension(d) {
 
1059
        eType = DRW::DIMANGULAR3P;
 
1060
    }
 
1061
 
 
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);}
 
1070
};
 
1071
 
 
1072
//! Class to handle ordinate dimension entity
 
1073
/*!
 
1074
*  Class to handle ordinate dimension entity
 
1075
*  @author Rallaz
 
1076
*/
 
1077
class DRW_DimOrdinate : public DRW_Dimension {
 
1078
public:
 
1079
    DRW_DimOrdinate() {
 
1080
        eType = DRW::DIMORDINATE;
 
1081
    }
 
1082
    DRW_DimOrdinate(const DRW_Dimension& d): DRW_Dimension(d) {
 
1083
        eType = DRW::DIMORDINATE;
 
1084
    }
 
1085
 
 
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);}
 
1092
};
 
1093
 
 
1094
 
 
1095
//! Class to handle leader entity
 
1096
/*!
 
1097
*  Class to handle leader entity
 
1098
*  @author Rallaz
 
1099
*/
 
1100
class DRW_Leader : public DRW_Entity {
 
1101
public:
 
1102
    DRW_Leader() {
 
1103
        eType = DRW::LEADER;
 
1104
        flag = 3;
 
1105
        hookflag = vertnum = leadertype = 0;
 
1106
        extrusionPoint.x = extrusionPoint.y = 0.0;
 
1107
        arrow = 1;
 
1108
        extrusionPoint.z = 1.0;
 
1109
    }
 
1110
    ~DRW_Leader() {
 
1111
        while (!vertexlist.empty()) {
 
1112
           vertexlist.pop_back();
 
1113
        }
 
1114
    }
 
1115
 
 
1116
    virtual void applyExtrusion(){}
 
1117
    void parseCode(int code, dxfReader *reader);
 
1118
 
 
1119
public:
 
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 */
 
1135
 
 
1136
    std::vector<DRW_Coord *> vertexlist;  /*!< vertex points list, code 10, 20 & 30 */
 
1137
 
 
1138
private:
 
1139
    DRW_Coord *vertexpoint;   /*!< current control point to add data */
 
1140
};
 
1141
 
 
1142
//! Class to handle viewport entity
 
1143
/*!
 
1144
*  Class to handle viewport entity
 
1145
*  @author Rallaz
 
1146
*/
 
1147
class DRW_Viewport : public DRW_Point {
 
1148
public:
 
1149
    DRW_Viewport() {
 
1150
        eType = DRW::VIEWPORT;
 
1151
        vpstatus = 0;
 
1152
        pswidth = 205;
 
1153
        psheight = 156;
 
1154
        centerPX = 128.5;
 
1155
        centerPY = 97.5;
 
1156
    }
 
1157
 
 
1158
    virtual void applyExtrusion(){}
 
1159
    void parseCode(int code, dxfReader *reader);
 
1160
 
 
1161
public:
 
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 */
 
1168
};
 
1169
 
 
1170
 
 
1171
#endif
 
1172
 
 
1173
// EOF
 
1174