1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <sal/config.h>
22 #include <o3tl/safeint.hxx>
24 #include "dxfentrd.hxx"
26 //--------------------------DXFBasicEntity--------------------------------------
28 DXFBasicEntity::DXFBasicEntity(DXFEntityType eThisType
)
30 , m_sLineType("BYLAYER"_ostr
)
42 void DXFBasicEntity::Read(DXFGroupReader
& rDGR
)
44 while (rDGR
.Read()!=0) EvaluateGroup(rDGR
);
47 void DXFBasicEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
51 case 8: m_sLayer
= rDGR
.GetS(); break;
52 case 6: m_sLineType
= rDGR
.GetS(); break;
53 case 39: fThickness
=rDGR
.GetF(); break;
54 case 62: nColor
=rDGR
.GetI(); break;
55 case 67: nSpace
=rDGR
.GetI(); break;
56 case 210: aExtrusion
.fx
=rDGR
.GetF(); break;
57 case 220: aExtrusion
.fy
=rDGR
.GetF(); break;
58 case 230: aExtrusion
.fz
=rDGR
.GetF(); break;
62 DXFBasicEntity::~DXFBasicEntity()
66 //--------------------------DXFLineEntity---------------------------------------
68 DXFLineEntity::DXFLineEntity() : DXFBasicEntity(DXF_LINE
)
72 void DXFLineEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
74 switch (rDGR
.GetG()) {
75 case 10: aP0
.fx
=rDGR
.GetF(); break;
76 case 20: aP0
.fy
=rDGR
.GetF(); break;
77 case 30: aP0
.fz
=rDGR
.GetF(); break;
78 case 11: aP1
.fx
=rDGR
.GetF(); break;
79 case 21: aP1
.fy
=rDGR
.GetF(); break;
80 case 31: aP1
.fz
=rDGR
.GetF(); break;
81 default: DXFBasicEntity::EvaluateGroup(rDGR
);
85 //--------------------------DXFPointEntity--------------------------------------
87 DXFPointEntity::DXFPointEntity() : DXFBasicEntity(DXF_POINT
)
91 void DXFPointEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
93 switch (rDGR
.GetG()) {
94 case 10: aP0
.fx
=rDGR
.GetF(); break;
95 case 20: aP0
.fy
=rDGR
.GetF(); break;
96 case 30: aP0
.fz
=rDGR
.GetF(); break;
97 default: DXFBasicEntity::EvaluateGroup(rDGR
);
101 //--------------------------DXFCircleEntity-------------------------------------
103 DXFCircleEntity::DXFCircleEntity() : DXFBasicEntity(DXF_CIRCLE
)
108 void DXFCircleEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
110 switch (rDGR
.GetG()) {
111 case 10: aP0
.fx
=rDGR
.GetF(); break;
112 case 20: aP0
.fy
=rDGR
.GetF(); break;
113 case 30: aP0
.fz
=rDGR
.GetF(); break;
114 case 40: fRadius
=rDGR
.GetF(); break;
115 default: DXFBasicEntity::EvaluateGroup(rDGR
);
119 //--------------------------DXFArcEntity----------------------------------------
121 DXFArcEntity::DXFArcEntity() : DXFBasicEntity(DXF_ARC
)
128 void DXFArcEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
130 switch (rDGR
.GetG()) {
131 case 10: aP0
.fx
=rDGR
.GetF(); break;
132 case 20: aP0
.fy
=rDGR
.GetF(); break;
133 case 30: aP0
.fz
=rDGR
.GetF(); break;
134 case 40: fRadius
=rDGR
.GetF(); break;
135 case 50: fStart
=rDGR
.GetF(); break;
136 case 51: fEnd
=rDGR
.GetF(); break;
137 default: DXFBasicEntity::EvaluateGroup(rDGR
);
141 //--------------------------DXFTraceEntity--------------------------------------
143 DXFTraceEntity::DXFTraceEntity() : DXFBasicEntity(DXF_TRACE
)
147 void DXFTraceEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
149 switch (rDGR
.GetG()) {
150 case 10: aP0
.fx
=rDGR
.GetF(); break;
151 case 20: aP0
.fy
=rDGR
.GetF(); break;
152 case 30: aP0
.fz
=rDGR
.GetF(); break;
153 case 11: aP1
.fx
=rDGR
.GetF(); break;
154 case 21: aP1
.fy
=rDGR
.GetF(); break;
155 case 31: aP1
.fz
=rDGR
.GetF(); break;
156 case 12: aP2
.fx
=rDGR
.GetF(); break;
157 case 22: aP2
.fy
=rDGR
.GetF(); break;
158 case 32: aP2
.fz
=rDGR
.GetF(); break;
159 case 13: aP3
.fx
=rDGR
.GetF(); break;
160 case 23: aP3
.fy
=rDGR
.GetF(); break;
161 case 33: aP3
.fz
=rDGR
.GetF(); break;
162 default: DXFBasicEntity::EvaluateGroup(rDGR
);
166 //--------------------------DXFSolidEntity--------------------------------------
168 DXFSolidEntity::DXFSolidEntity() : DXFBasicEntity(DXF_SOLID
)
172 void DXFSolidEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
174 switch (rDGR
.GetG()) {
175 case 10: aP0
.fx
=rDGR
.GetF(); break;
176 case 20: aP0
.fy
=rDGR
.GetF(); break;
177 case 30: aP0
.fz
=rDGR
.GetF(); break;
178 case 11: aP1
.fx
=rDGR
.GetF(); break;
179 case 21: aP1
.fy
=rDGR
.GetF(); break;
180 case 31: aP1
.fz
=rDGR
.GetF(); break;
181 case 12: aP2
.fx
=rDGR
.GetF(); break;
182 case 22: aP2
.fy
=rDGR
.GetF(); break;
183 case 32: aP2
.fz
=rDGR
.GetF(); break;
184 case 13: aP3
.fx
=rDGR
.GetF(); break;
185 case 23: aP3
.fy
=rDGR
.GetF(); break;
186 case 33: aP3
.fz
=rDGR
.GetF(); break;
187 default: DXFBasicEntity::EvaluateGroup(rDGR
);
191 //--------------------------DXFTextEntity---------------------------------------
193 DXFTextEntity::DXFTextEntity()
194 : DXFBasicEntity(DXF_TEXT
)
195 , m_sStyle("STANDARD"_ostr
)
206 void DXFTextEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
208 switch (rDGR
.GetG()) {
209 case 10: aP0
.fx
=rDGR
.GetF(); break;
210 case 20: aP0
.fy
=rDGR
.GetF(); break;
211 case 30: aP0
.fz
=rDGR
.GetF(); break;
212 case 40: fHeight
=rDGR
.GetF(); break;
213 case 1: m_sText
= rDGR
.GetS(); break;
214 case 50: fRotAngle
=rDGR
.GetF(); break;
215 case 41: fXScale
=rDGR
.GetF(); break;
216 case 42: fOblAngle
=rDGR
.GetF(); break;
217 case 7: m_sStyle
= rDGR
.GetS(); break;
218 case 71: nGenFlags
=rDGR
.GetI(); break;
219 case 72: nHorzJust
=rDGR
.GetI(); break;
220 case 73: nVertJust
=rDGR
.GetI(); break;
221 case 11: aAlign
.fx
=rDGR
.GetF(); break;
222 case 21: aAlign
.fy
=rDGR
.GetF(); break;
223 case 31: aAlign
.fz
=rDGR
.GetF(); break;
224 default: DXFBasicEntity::EvaluateGroup(rDGR
);
228 //--------------------------DXFShapeEntity--------------------------------------
230 DXFShapeEntity::DXFShapeEntity() : DXFBasicEntity(DXF_SHAPE
)
238 void DXFShapeEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
240 switch (rDGR
.GetG()) {
241 case 10: aP0
.fx
=rDGR
.GetF(); break;
242 case 20: aP0
.fy
=rDGR
.GetF(); break;
243 case 30: aP0
.fz
=rDGR
.GetF(); break;
244 case 40: fSize
=rDGR
.GetF(); break;
245 case 2: m_sName
= rDGR
.GetS(); break;
246 case 50: fRotAngle
=rDGR
.GetF(); break;
247 case 41: fXScale
=rDGR
.GetF(); break;
248 case 51: fOblAngle
=rDGR
.GetF(); break;
249 default: DXFBasicEntity::EvaluateGroup(rDGR
);
253 //--------------------------DXFInsertEntity-------------------------------------
255 DXFInsertEntity::DXFInsertEntity() : DXFBasicEntity(DXF_INSERT
)
268 void DXFInsertEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
270 switch (rDGR
.GetG()) {
271 case 66: nAttrFlag
=rDGR
.GetI(); break;
272 case 2: m_sName
= rDGR
.GetS(); break;
273 case 10: aP0
.fx
=rDGR
.GetF(); break;
274 case 20: aP0
.fy
=rDGR
.GetF(); break;
275 case 30: aP0
.fz
=rDGR
.GetF(); break;
276 case 41: fXScale
=rDGR
.GetF(); break;
277 case 42: fYScale
=rDGR
.GetF(); break;
278 case 43: fZScale
=rDGR
.GetF(); break;
279 case 50: fRotAngle
=rDGR
.GetF(); break;
280 case 70: nColCount
=rDGR
.GetI(); break;
281 case 71: nRowCount
=rDGR
.GetI(); break;
282 case 44: fColSpace
=rDGR
.GetF(); break;
283 case 45: fRowSpace
=rDGR
.GetF(); break;
284 default: DXFBasicEntity::EvaluateGroup(rDGR
);
288 //--------------------------DXFAttDefEntity-------------------------------------
290 DXFAttDefEntity::DXFAttDefEntity()
291 : DXFBasicEntity(DXF_ATTDEF
)
292 , m_sStyle("STANDARD"_ostr
)
305 void DXFAttDefEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
307 switch (rDGR
.GetG()) {
308 case 10: aP0
.fx
=rDGR
.GetF(); break;
309 case 20: aP0
.fy
=rDGR
.GetF(); break;
310 case 30: aP0
.fz
=rDGR
.GetF(); break;
311 case 40: fHeight
=rDGR
.GetF(); break;
312 case 1: m_sDefVal
= rDGR
.GetS(); break;
313 case 3: m_sPrompt
= rDGR
.GetS(); break;
314 case 2: m_sTagStr
= rDGR
.GetS(); break;
315 case 70: nAttrFlags
=rDGR
.GetI(); break;
316 case 73: nFieldLen
=rDGR
.GetI(); break;
317 case 50: fRotAngle
=rDGR
.GetF(); break;
318 case 41: fXScale
=rDGR
.GetF(); break;
319 case 51: fOblAngle
=rDGR
.GetF(); break;
320 case 7: m_sStyle
= rDGR
.GetS(); break;
321 case 71: nGenFlags
=rDGR
.GetI(); break;
322 case 72: nHorzJust
=rDGR
.GetI(); break;
323 case 74: nVertJust
=rDGR
.GetI(); break;
324 case 11: aAlign
.fx
=rDGR
.GetF(); break;
325 case 21: aAlign
.fy
=rDGR
.GetF(); break;
326 case 31: aAlign
.fz
=rDGR
.GetF(); break;
327 default: DXFBasicEntity::EvaluateGroup(rDGR
);
331 //--------------------------DXFAttribEntity-------------------------------------
333 DXFAttribEntity::DXFAttribEntity()
334 : DXFBasicEntity(DXF_ATTRIB
)
335 , m_sStyle("STANDARD"_ostr
)
348 void DXFAttribEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
350 switch (rDGR
.GetG()) {
351 case 10: aP0
.fx
=rDGR
.GetF(); break;
352 case 20: aP0
.fy
=rDGR
.GetF(); break;
353 case 30: aP0
.fz
=rDGR
.GetF(); break;
354 case 40: fHeight
=rDGR
.GetF(); break;
355 case 1: m_sText
= rDGR
.GetS(); break;
356 case 2: m_sTagStr
= rDGR
.GetS(); break;
357 case 70: nAttrFlags
=rDGR
.GetI(); break;
358 case 73: nFieldLen
=rDGR
.GetI(); break;
359 case 50: fRotAngle
=rDGR
.GetF(); break;
360 case 41: fXScale
=rDGR
.GetF(); break;
361 case 51: fOblAngle
=rDGR
.GetF(); break;
362 case 7: m_sStyle
= rDGR
.GetS(); break;
363 case 71: nGenFlags
=rDGR
.GetI(); break;
364 case 72: nHorzJust
=rDGR
.GetI(); break;
365 case 74: nVertJust
=rDGR
.GetI(); break;
366 case 11: aAlign
.fx
=rDGR
.GetF(); break;
367 case 21: aAlign
.fy
=rDGR
.GetF(); break;
368 case 31: aAlign
.fz
=rDGR
.GetF(); break;
369 default: DXFBasicEntity::EvaluateGroup(rDGR
);
373 //--------------------------DXFPolyLine-----------------------------------------
375 DXFPolyLineEntity::DXFPolyLineEntity() : DXFBasicEntity(DXF_POLYLINE
)
387 void DXFPolyLineEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
389 switch (rDGR
.GetG()) {
390 case 70: nFlags
=rDGR
.GetI(); break;
391 case 40: fSWidth
=rDGR
.GetF(); break;
392 case 41: fEWidth
=rDGR
.GetF(); break;
393 case 71: nMeshMCount
=rDGR
.GetI(); break;
394 case 72: nMeshNCount
=rDGR
.GetI(); break;
395 case 73: nMDensity
=rDGR
.GetI(); break;
396 case 74: nNDensity
=rDGR
.GetI(); break;
397 case 75: nCSSType
=rDGR
.GetI(); break;
398 default: DXFBasicEntity::EvaluateGroup(rDGR
);
402 //--------------------------DXFLWPolyLine---------------------------------------
404 DXFLWPolyLineEntity::DXFLWPolyLineEntity() :
405 DXFBasicEntity( DXF_LWPOLYLINE
),
409 fConstantWidth( 0.0 ),
415 void DXFLWPolyLineEntity::EvaluateGroup( DXFGroupReader
& rDGR
)
417 switch ( rDGR
.GetG() )
421 nCount
= rDGR
.GetI();
422 // limit alloc to max reasonable size based on remaining data in stream
423 if (nCount
> 0 && o3tl::make_unsigned(nCount
) <= rDGR
.remainingSize())
429 case 70: nFlags
= rDGR
.GetI(); break;
430 case 43: fConstantWidth
= rDGR
.GetF(); break;
431 case 40: fStartWidth
= rDGR
.GetF(); break;
432 case 41: fEndWidth
= rDGR
.GetF(); break;
438 aP
[nIndex
].fx
= rDGR
.GetF();
447 aP
[nIndex
].fy
= rDGR
.GetF();
452 default: DXFBasicEntity::EvaluateGroup(rDGR
);
456 //--------------------------DXFHatchEntity-------------------------------------
458 DXFEdgeTypeLine::DXFEdgeTypeLine() :
464 bool DXFEdgeTypeLine::EvaluateGroup( DXFGroupReader
& rDGR
)
466 bool bExecutingGroupCode
= true;
467 switch ( rDGR
.GetG() )
469 case 10 : aStartPoint
.fx
= rDGR
.GetF(); break;
470 case 20 : aStartPoint
.fy
= rDGR
.GetF(); break;
471 case 11 : aEndPoint
.fx
= rDGR
.GetF(); break;
472 case 21 : aEndPoint
.fy
= rDGR
.GetF(); break;
473 default : bExecutingGroupCode
= false; break;
475 return bExecutingGroupCode
;
478 DXFEdgeTypeCircularArc::DXFEdgeTypeCircularArc() :
483 nIsCounterClockwiseFlag( 0 )
487 bool DXFEdgeTypeCircularArc::EvaluateGroup( DXFGroupReader
& rDGR
)
489 bool bExecutingGroupCode
= true;
490 switch ( rDGR
.GetG() )
492 case 10 : aCenter
.fx
= rDGR
.GetF(); break;
493 case 20 : aCenter
.fy
= rDGR
.GetF(); break;
494 case 40 : fRadius
= rDGR
.GetF(); break;
495 case 50 : fStartAngle
= rDGR
.GetF(); break;
496 case 51 : fEndAngle
= rDGR
.GetF(); break;
497 case 73 : nIsCounterClockwiseFlag
= rDGR
.GetI(); break;
498 default : bExecutingGroupCode
= false; break;
500 return bExecutingGroupCode
;
503 DXFEdgeTypeEllipticalArc::DXFEdgeTypeEllipticalArc() :
508 nIsCounterClockwiseFlag( 0 )
512 bool DXFEdgeTypeEllipticalArc::EvaluateGroup( DXFGroupReader
& rDGR
)
514 bool bExecutingGroupCode
= true;
515 switch( rDGR
.GetG() )
517 case 10 : aCenter
.fx
= rDGR
.GetF(); break;
518 case 20 : aCenter
.fy
= rDGR
.GetF(); break;
519 case 11 : aEndPoint
.fx
= rDGR
.GetF(); break;
520 case 21 : aEndPoint
.fy
= rDGR
.GetF(); break;
521 case 40 : fLength
= rDGR
.GetF(); break;
522 case 50 : fStartAngle
= rDGR
.GetF(); break;
523 case 51 : fEndAngle
= rDGR
.GetF(); break;
524 case 73 : nIsCounterClockwiseFlag
= rDGR
.GetI(); break;
525 default : bExecutingGroupCode
= false; break;
527 return bExecutingGroupCode
;
530 DXFEdgeTypeSpline::DXFEdgeTypeSpline() :
540 bool DXFEdgeTypeSpline::EvaluateGroup( DXFGroupReader
& rDGR
)
542 bool bExecutingGroupCode
= true;
543 switch ( rDGR
.GetG() )
545 case 94 : nDegree
= rDGR
.GetI(); break;
546 case 73 : nRational
= rDGR
.GetI(); break;
547 case 74 : nPeriodic
= rDGR
.GetI(); break;
548 case 95 : nKnotCount
= rDGR
.GetI(); break;
549 case 96 : nControlCount
= rDGR
.GetI(); break;
550 default : bExecutingGroupCode
= false; break;
552 return bExecutingGroupCode
;
555 DXFBoundaryPathData::DXFBoundaryPathData() :
561 nSourceBoundaryObjects( 0 ),
568 bool DXFBoundaryPathData::EvaluateGroup( DXFGroupReader
& rDGR
)
570 bool bExecutingGroupCode
= true;
573 switch( rDGR
.GetG() )
577 nFlags
= rDGR
.GetI();
578 if ( ( nFlags
& 2 ) == 0 )
584 nPointCount
= rDGR
.GetI();
585 // limit alloc to max reasonable size based on remaining data in stream
586 if (nPointCount
> 0 && o3tl::make_unsigned(nPointCount
) <= rDGR
.remainingSize())
587 aP
.reserve(nPointCount
);
592 case 72 : nHasBulgeFlag
= rDGR
.GetI(); break;
593 case 73 : nIsClosedFlag
= rDGR
.GetI(); break;
594 case 97 : nSourceBoundaryObjects
= rDGR
.GetI(); break;
595 case 42 : fBulge
= rDGR
.GetF(); break;
598 if (nPointIndex
< nPointCount
)
600 aP
.resize(nPointIndex
+1);
601 aP
[nPointIndex
].fx
= rDGR
.GetF();
607 if (nPointIndex
< nPointCount
)
609 aP
.resize(nPointIndex
+1);
610 aP
[nPointIndex
].fy
= rDGR
.GetF();
616 default : bExecutingGroupCode
= false; break;
621 if ( rDGR
.GetG() == 93 )
622 nEdgeCount
= rDGR
.GetI();
623 else if ( rDGR
.GetG() == 72 )
625 sal_Int32 nEdgeType
= rDGR
.GetI();
628 case 1 : aEdges
.emplace_back( new DXFEdgeTypeLine() ); break;
629 case 2 : aEdges
.emplace_back( new DXFEdgeTypeCircularArc() ); break;
630 case 3 : aEdges
.emplace_back( new DXFEdgeTypeEllipticalArc() ); break;
631 case 4 : aEdges
.emplace_back( new DXFEdgeTypeSpline() ); break;
634 else if ( !aEdges
.empty() )
635 aEdges
.back()->EvaluateGroup( rDGR
);
637 bExecutingGroupCode
= false;
639 return bExecutingGroupCode
;
642 DXFHatchEntity::DXFHatchEntity() :
643 DXFBasicEntity( DXF_HATCH
),
644 bIsInBoundaryPathContext( false ),
645 nCurrentBoundaryPathIndex( -1 ),
647 nAssociativityFlag( 0 ),
648 nMaxBoundaryPathCount( 0 ),
650 nHatchPatternType( 0 ),
651 fHatchPatternAngle( 0.0 ),
652 fHatchPatternScale( 1.0 ),
653 nHatchDoubleFlag( 0 ),
654 nHatchPatternDefinitionLines( 0 ),
656 nNumberOfSeedPoints( 0 )
660 void DXFHatchEntity::EvaluateGroup( DXFGroupReader
& rDGR
)
662 switch ( rDGR
.GetG() )
664 // case 10 : aElevationPoint.fx = rDGR.GetF(); break;
665 // case 20 : aElevationPoint.fy = rDGR.GetF(); break;
666 // case 30 : aElevationPoint.fz = rDGR.GetF(); break;
667 case 70 : nFlags
= rDGR
.GetI(); break;
668 case 71 : nAssociativityFlag
= rDGR
.GetI(); break;
671 bIsInBoundaryPathContext
= true;
672 nMaxBoundaryPathCount
= rDGR
.GetI();
673 // limit alloc to max reasonable size based on remaining data in stream
674 if (nMaxBoundaryPathCount
> 0 && o3tl::make_unsigned(nMaxBoundaryPathCount
) <= rDGR
.remainingSize())
675 aBoundaryPathData
.reserve(nMaxBoundaryPathCount
);
677 nMaxBoundaryPathCount
= 0;
682 nHatchStyle
= rDGR
.GetI();
683 bIsInBoundaryPathContext
= false;
686 case 76 : nHatchPatternType
= rDGR
.GetI(); break;
687 case 52 : fHatchPatternAngle
= rDGR
.GetF(); break;
688 case 41 : fHatchPatternScale
= rDGR
.GetF(); break;
689 case 77 : nHatchDoubleFlag
= rDGR
.GetI(); break;
690 case 78 : nHatchPatternDefinitionLines
= rDGR
.GetI(); break;
691 case 47 : fPixelSize
= rDGR
.GetF(); break;
692 case 98 : nNumberOfSeedPoints
= rDGR
.GetI(); break;
695 nCurrentBoundaryPathIndex
++;
699 bool bExecutingGroupCode
= false;
700 if ( bIsInBoundaryPathContext
)
702 if (nCurrentBoundaryPathIndex
>= 0 && nCurrentBoundaryPathIndex
< nMaxBoundaryPathCount
)
704 aBoundaryPathData
.resize(nCurrentBoundaryPathIndex
+ 1);
705 bExecutingGroupCode
= aBoundaryPathData
.back().EvaluateGroup(rDGR
);
708 if ( !bExecutingGroupCode
)
709 DXFBasicEntity::EvaluateGroup(rDGR
);
715 //--------------------------DXFVertexEntity-------------------------------------
717 DXFVertexEntity::DXFVertexEntity() : DXFBasicEntity(DXF_VERTEX
)
727 void DXFVertexEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
729 switch (rDGR
.GetG()) {
730 case 10: aP0
.fx
=rDGR
.GetF(); break;
731 case 20: aP0
.fy
=rDGR
.GetF(); break;
732 case 30: aP0
.fz
=rDGR
.GetF(); break;
733 case 40: fSWidth
=rDGR
.GetF(); break;
734 case 41: fEWidth
=rDGR
.GetF(); break;
735 case 42: fBulge
=rDGR
.GetF(); break;
736 case 70: nFlags
=rDGR
.GetI(); break;
737 case 50: fCFTDir
=rDGR
.GetF(); break;
738 default: DXFBasicEntity::EvaluateGroup(rDGR
);
742 //--------------------------DXFSeqEndEntity-------------------------------------
744 DXFSeqEndEntity::DXFSeqEndEntity() : DXFBasicEntity(DXF_SEQEND
)
748 //--------------------------DXF3DFace-------------------------------------------
750 DXF3DFaceEntity::DXF3DFaceEntity() : DXFBasicEntity(DXF_3DFACE
)
755 void DXF3DFaceEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
757 switch (rDGR
.GetG()) {
758 case 10: aP0
.fx
=rDGR
.GetF(); break;
759 case 20: aP0
.fy
=rDGR
.GetF(); break;
760 case 30: aP0
.fz
=rDGR
.GetF(); break;
761 case 11: aP1
.fx
=rDGR
.GetF(); break;
762 case 21: aP1
.fy
=rDGR
.GetF(); break;
763 case 31: aP1
.fz
=rDGR
.GetF(); break;
764 case 12: aP2
.fx
=rDGR
.GetF(); break;
765 case 22: aP2
.fy
=rDGR
.GetF(); break;
766 case 32: aP2
.fz
=rDGR
.GetF(); break;
767 case 13: aP3
.fx
=rDGR
.GetF(); break;
768 case 23: aP3
.fy
=rDGR
.GetF(); break;
769 case 33: aP3
.fz
=rDGR
.GetF(); break;
770 case 70: nIEFlags
=rDGR
.GetI(); break;
771 default: DXFBasicEntity::EvaluateGroup(rDGR
);
776 //--------------------------DXFDimensionEntity----------------------------------
778 DXFDimensionEntity::DXFDimensionEntity() : DXFBasicEntity(DXF_DIMENSION
)
782 void DXFDimensionEntity::EvaluateGroup(DXFGroupReader
& rDGR
)
784 switch (rDGR
.GetG()) {
785 case 2: m_sPseudoBlock
= rDGR
.GetS(); break;
786 default: DXFBasicEntity::EvaluateGroup(rDGR
);
790 //---------------------------- DXFEntities --------------------------------------
792 void DXFEntities::Read(DXFGroupReader
& rDGR
)
794 DXFBasicEntity
* pE
, * * ppSucc
;
797 while (*ppSucc
!=nullptr) ppSucc
=&((*ppSucc
)->pSucc
);
799 while (rDGR
.GetG()!=0) rDGR
.Read();
801 while (rDGR
.GetS()!="ENDBLK" &&
802 rDGR
.GetS()!="ENDSEC" &&
806 if (rDGR
.GetS() == "LINE" ) pE
=new DXFLineEntity
;
807 else if (rDGR
.GetS() == "POINT" ) pE
=new DXFPointEntity
;
808 else if (rDGR
.GetS() == "CIRCLE" ) pE
=new DXFCircleEntity
;
809 else if (rDGR
.GetS() == "ARC" ) pE
=new DXFArcEntity
;
810 else if (rDGR
.GetS() == "TRACE" ) pE
=new DXFTraceEntity
;
811 else if (rDGR
.GetS() == "SOLID" ) pE
=new DXFSolidEntity
;
812 else if (rDGR
.GetS() == "TEXT" ) pE
=new DXFTextEntity
;
813 else if (rDGR
.GetS() == "SHAPE" ) pE
=new DXFShapeEntity
;
814 else if (rDGR
.GetS() == "INSERT" ) pE
=new DXFInsertEntity
;
815 else if (rDGR
.GetS() == "ATTDEF" ) pE
=new DXFAttDefEntity
;
816 else if (rDGR
.GetS() == "ATTRIB" ) pE
=new DXFAttribEntity
;
817 else if (rDGR
.GetS() == "POLYLINE" ) pE
=new DXFPolyLineEntity
;
818 else if (rDGR
.GetS() == "LWPOLYLINE") pE
=new DXFLWPolyLineEntity
;
819 else if (rDGR
.GetS() == "VERTEX" ) pE
=new DXFVertexEntity
;
820 else if (rDGR
.GetS() == "SEQEND" ) pE
=new DXFSeqEndEntity
;
821 else if (rDGR
.GetS() == "3DFACE" ) pE
=new DXF3DFaceEntity
;
822 else if (rDGR
.GetS() == "DIMENSION" ) pE
=new DXFDimensionEntity
;
823 else if (rDGR
.GetS() == "HATCH" ) pE
=new DXFHatchEntity
;
828 } while (rDGR
.GetG()!=0);
837 void DXFEntities::Clear()
839 DXFBasicEntity
* ptmp
;
841 while (pFirst
!=nullptr) {
848 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */