Update ooo320-m1
[ooovba.git] / goodies / source / filter.vcl / idxf / dxfentrd.cxx
blobfad511c6dbb7783475c4abf03780e3ebffd217c2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: dxfentrd.cxx,v $
10 * $Revision: 1.7 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_goodies.hxx"
34 #include <string.h>
35 #include <dxfentrd.hxx>
37 //--------------------------DXFBasicEntity--------------------------------------
39 DXFBasicEntity::DXFBasicEntity(DXFEntityType eThisType)
41 eType=eThisType;
42 pSucc=NULL;
43 strncpy(sLayer,"0", 2 );
44 strncpy(sLineType,"BYLAYER", 8 );
45 fElevation=0;
46 fThickness=0;
47 nColor=256;
48 nSpace=0;
49 aExtrusion.fx=0.0;
50 aExtrusion.fy=0.0;
51 aExtrusion.fz=1.0;
54 void DXFBasicEntity::Read(DXFGroupReader & rDGR)
56 while (rDGR.Read()!=0) EvaluateGroup(rDGR);
59 void DXFBasicEntity::EvaluateGroup(DXFGroupReader & rDGR)
61 switch (rDGR.GetG())
63 case 8: strncpy( sLayer, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
64 case 6: strncpy( sLineType, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
65 case 38: fElevation=rDGR.GetF(); break;
66 case 39: fThickness=rDGR.GetF(); break;
67 case 62: nColor=rDGR.GetI(); break;
68 case 67: nSpace=rDGR.GetI(); break;
69 case 210: aExtrusion.fx=rDGR.GetF(); break;
70 case 220: aExtrusion.fy=rDGR.GetF(); break;
71 case 230: aExtrusion.fz=rDGR.GetF(); break;
75 DXFBasicEntity::~DXFBasicEntity()
79 //--------------------------DXFLineEntity---------------------------------------
81 DXFLineEntity::DXFLineEntity() : DXFBasicEntity(DXF_LINE)
85 void DXFLineEntity::EvaluateGroup(DXFGroupReader & rDGR)
87 switch (rDGR.GetG()) {
88 case 10: aP0.fx=rDGR.GetF(); break;
89 case 20: aP0.fy=rDGR.GetF(); break;
90 case 30: aP0.fz=rDGR.GetF(); break;
91 case 11: aP1.fx=rDGR.GetF(); break;
92 case 21: aP1.fy=rDGR.GetF(); break;
93 case 31: aP1.fz=rDGR.GetF(); break;
94 default: DXFBasicEntity::EvaluateGroup(rDGR);
98 //--------------------------DXFPointEntity--------------------------------------
100 DXFPointEntity::DXFPointEntity() : DXFBasicEntity(DXF_POINT)
104 void DXFPointEntity::EvaluateGroup(DXFGroupReader & rDGR)
106 switch (rDGR.GetG()) {
107 case 10: aP0.fx=rDGR.GetF(); break;
108 case 20: aP0.fy=rDGR.GetF(); break;
109 case 30: aP0.fz=rDGR.GetF(); break;
110 default: DXFBasicEntity::EvaluateGroup(rDGR);
114 //--------------------------DXFCircleEntity-------------------------------------
116 DXFCircleEntity::DXFCircleEntity() : DXFBasicEntity(DXF_CIRCLE)
118 fRadius=1.0;
121 void DXFCircleEntity::EvaluateGroup(DXFGroupReader & rDGR)
123 switch (rDGR.GetG()) {
124 case 10: aP0.fx=rDGR.GetF(); break;
125 case 20: aP0.fy=rDGR.GetF(); break;
126 case 30: aP0.fz=rDGR.GetF(); break;
127 case 40: fRadius=rDGR.GetF(); break;
128 default: DXFBasicEntity::EvaluateGroup(rDGR);
132 //--------------------------DXFArcEntity----------------------------------------
134 DXFArcEntity::DXFArcEntity() : DXFBasicEntity(DXF_ARC)
136 fRadius=1.0;
137 fStart=0;
138 fEnd=360.0;
141 void DXFArcEntity::EvaluateGroup(DXFGroupReader & rDGR)
143 switch (rDGR.GetG()) {
144 case 10: aP0.fx=rDGR.GetF(); break;
145 case 20: aP0.fy=rDGR.GetF(); break;
146 case 30: aP0.fz=rDGR.GetF(); break;
147 case 40: fRadius=rDGR.GetF(); break;
148 case 50: fStart=rDGR.GetF(); break;
149 case 51: fEnd=rDGR.GetF(); break;
150 default: DXFBasicEntity::EvaluateGroup(rDGR);
154 //--------------------------DXFTraceEntity--------------------------------------
156 DXFTraceEntity::DXFTraceEntity() : DXFBasicEntity(DXF_TRACE)
160 void DXFTraceEntity::EvaluateGroup(DXFGroupReader & rDGR)
162 switch (rDGR.GetG()) {
163 case 10: aP0.fx=rDGR.GetF(); break;
164 case 20: aP0.fy=rDGR.GetF(); break;
165 case 30: aP0.fz=rDGR.GetF(); break;
166 case 11: aP1.fx=rDGR.GetF(); break;
167 case 21: aP1.fy=rDGR.GetF(); break;
168 case 31: aP1.fz=rDGR.GetF(); break;
169 case 12: aP2.fx=rDGR.GetF(); break;
170 case 22: aP2.fy=rDGR.GetF(); break;
171 case 32: aP2.fz=rDGR.GetF(); break;
172 case 13: aP3.fx=rDGR.GetF(); break;
173 case 23: aP3.fy=rDGR.GetF(); break;
174 case 33: aP3.fz=rDGR.GetF(); break;
175 default: DXFBasicEntity::EvaluateGroup(rDGR);
179 //--------------------------DXFSolidEntity--------------------------------------
181 DXFSolidEntity::DXFSolidEntity() : DXFBasicEntity(DXF_SOLID)
185 void DXFSolidEntity::EvaluateGroup(DXFGroupReader & rDGR)
187 switch (rDGR.GetG()) {
188 case 10: aP0.fx=rDGR.GetF(); break;
189 case 20: aP0.fy=rDGR.GetF(); break;
190 case 30: aP0.fz=rDGR.GetF(); break;
191 case 11: aP1.fx=rDGR.GetF(); break;
192 case 21: aP1.fy=rDGR.GetF(); break;
193 case 31: aP1.fz=rDGR.GetF(); break;
194 case 12: aP2.fx=rDGR.GetF(); break;
195 case 22: aP2.fy=rDGR.GetF(); break;
196 case 32: aP2.fz=rDGR.GetF(); break;
197 case 13: aP3.fx=rDGR.GetF(); break;
198 case 23: aP3.fy=rDGR.GetF(); break;
199 case 33: aP3.fz=rDGR.GetF(); break;
200 default: DXFBasicEntity::EvaluateGroup(rDGR);
204 //--------------------------DXFTextEntity---------------------------------------
206 DXFTextEntity::DXFTextEntity() : DXFBasicEntity(DXF_TEXT)
208 fHeight=1.0;
209 sText[0]=0;
210 fRotAngle=0.0;
211 fXScale=1.0;
212 fOblAngle=0.0;
213 strncpy( sStyle, "STANDARD", 9 );
214 nGenFlags=0;
215 nHorzJust=0;
216 nVertJust=0;
219 void DXFTextEntity::EvaluateGroup(DXFGroupReader & rDGR)
221 switch (rDGR.GetG()) {
222 case 10: aP0.fx=rDGR.GetF(); break;
223 case 20: aP0.fy=rDGR.GetF(); break;
224 case 30: aP0.fz=rDGR.GetF(); break;
225 case 40: fHeight=rDGR.GetF(); break;
226 case 1: strncpy( sText, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
227 case 50: fRotAngle=rDGR.GetF(); break;
228 case 41: fXScale=rDGR.GetF(); break;
229 case 42: fOblAngle=rDGR.GetF(); break;
230 case 7: strncpy( sStyle, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
231 case 71: nGenFlags=rDGR.GetI(); break;
232 case 72: nHorzJust=rDGR.GetI(); break;
233 case 73: nVertJust=rDGR.GetI(); break;
234 case 11: aAlign.fx=rDGR.GetF(); break;
235 case 21: aAlign.fy=rDGR.GetF(); break;
236 case 31: aAlign.fz=rDGR.GetF(); break;
237 default: DXFBasicEntity::EvaluateGroup(rDGR);
241 //--------------------------DXFShapeEntity--------------------------------------
243 DXFShapeEntity::DXFShapeEntity() : DXFBasicEntity(DXF_SHAPE)
245 fSize=1.0;
246 sName[0]=0;
247 fRotAngle=0;
248 fXScale=1.0;
249 fOblAngle=0;
252 void DXFShapeEntity::EvaluateGroup(DXFGroupReader & rDGR)
254 switch (rDGR.GetG()) {
255 case 10: aP0.fx=rDGR.GetF(); break;
256 case 20: aP0.fy=rDGR.GetF(); break;
257 case 30: aP0.fz=rDGR.GetF(); break;
258 case 40: fSize=rDGR.GetF(); break;
259 case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
260 case 50: fRotAngle=rDGR.GetF(); break;
261 case 41: fXScale=rDGR.GetF(); break;
262 case 51: fOblAngle=rDGR.GetF(); break;
263 default: DXFBasicEntity::EvaluateGroup(rDGR);
267 //--------------------------DXFInsertEntity-------------------------------------
269 DXFInsertEntity::DXFInsertEntity() : DXFBasicEntity(DXF_INSERT)
271 nAttrFlag=0;
272 sName[0]=0;
273 fXScale=1.0;
274 fYScale=1.0;
275 fZScale=1.0;
276 fRotAngle=0.0;
277 nColCount=1;
278 nRowCount=1;
279 fColSpace=0.0;
280 fRowSpace=0.0;
283 void DXFInsertEntity::EvaluateGroup(DXFGroupReader & rDGR)
285 switch (rDGR.GetG()) {
286 case 66: nAttrFlag=rDGR.GetI(); break;
287 case 2: strncpy( sName, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
288 case 10: aP0.fx=rDGR.GetF(); break;
289 case 20: aP0.fy=rDGR.GetF(); break;
290 case 30: aP0.fz=rDGR.GetF(); break;
291 case 41: fXScale=rDGR.GetF(); break;
292 case 42: fYScale=rDGR.GetF(); break;
293 case 43: fZScale=rDGR.GetF(); break;
294 case 50: fRotAngle=rDGR.GetF(); break;
295 case 70: nColCount=rDGR.GetI(); break;
296 case 71: nRowCount=rDGR.GetI(); break;
297 case 44: fColSpace=rDGR.GetF(); break;
298 case 45: fRowSpace=rDGR.GetF(); break;
299 default: DXFBasicEntity::EvaluateGroup(rDGR);
303 //--------------------------DXFAttDefEntity-------------------------------------
305 DXFAttDefEntity::DXFAttDefEntity() : DXFBasicEntity(DXF_ATTDEF)
307 fHeight=1.0;
308 sDefVal[0]=0;
309 sPrompt[0]=0;
310 sTagStr[0]=0;
311 nAttrFlags=0;
312 nFieldLen=0;
313 fRotAngle=0.0;
314 fXScale=1.0;
315 fOblAngle=0.0;
316 strncpy( sStyle, "STANDARD", 9 );
317 nGenFlags=0;
318 nHorzJust=0;
319 nVertJust=0;
322 void DXFAttDefEntity::EvaluateGroup(DXFGroupReader & rDGR)
324 switch (rDGR.GetG()) {
325 case 10: aP0.fx=rDGR.GetF(); break;
326 case 20: aP0.fy=rDGR.GetF(); break;
327 case 30: aP0.fz=rDGR.GetF(); break;
328 case 40: fHeight=rDGR.GetF(); break;
329 case 1: strncpy( sDefVal, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
330 case 3: strncpy( sPrompt, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
331 case 2: strncpy( sTagStr, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
332 case 70: nAttrFlags=rDGR.GetI(); break;
333 case 73: nFieldLen=rDGR.GetI(); break;
334 case 50: fRotAngle=rDGR.GetF(); break;
335 case 41: fXScale=rDGR.GetF(); break;
336 case 51: fOblAngle=rDGR.GetF(); break;
337 case 7: strncpy( sStyle, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
338 case 71: nGenFlags=rDGR.GetI(); break;
339 case 72: nHorzJust=rDGR.GetI(); break;
340 case 74: nVertJust=rDGR.GetI(); break;
341 case 11: aAlign.fx=rDGR.GetF(); break;
342 case 21: aAlign.fy=rDGR.GetF(); break;
343 case 31: aAlign.fz=rDGR.GetF(); break;
344 default: DXFBasicEntity::EvaluateGroup(rDGR);
348 //--------------------------DXFAttribEntity-------------------------------------
350 DXFAttribEntity::DXFAttribEntity() : DXFBasicEntity(DXF_ATTRIB)
352 fHeight=1.0;
353 sText[0]=0;
354 sTagStr[0]=0;
355 nAttrFlags=0;
356 nFieldLen=0;
357 fRotAngle=0.0;
358 fXScale=1.0;
359 fOblAngle=0.0;
360 strncpy( sStyle, "STANDARD", 9 );
361 nGenFlags=0;
362 nHorzJust=0;
363 nVertJust=0;
366 void DXFAttribEntity::EvaluateGroup(DXFGroupReader & rDGR)
368 switch (rDGR.GetG()) {
369 case 10: aP0.fx=rDGR.GetF(); break;
370 case 20: aP0.fy=rDGR.GetF(); break;
371 case 30: aP0.fz=rDGR.GetF(); break;
372 case 40: fHeight=rDGR.GetF(); break;
373 case 1: strncpy( sText, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
374 case 2: strncpy( sTagStr, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
375 case 70: nAttrFlags=rDGR.GetI(); break;
376 case 73: nFieldLen=rDGR.GetI(); break;
377 case 50: fRotAngle=rDGR.GetF(); break;
378 case 41: fXScale=rDGR.GetF(); break;
379 case 51: fOblAngle=rDGR.GetF(); break;
380 case 7: strncpy( sStyle, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
381 case 71: nGenFlags=rDGR.GetI(); break;
382 case 72: nHorzJust=rDGR.GetI(); break;
383 case 74: nVertJust=rDGR.GetI(); break;
384 case 11: aAlign.fx=rDGR.GetF(); break;
385 case 21: aAlign.fy=rDGR.GetF(); break;
386 case 31: aAlign.fz=rDGR.GetF(); break;
387 default: DXFBasicEntity::EvaluateGroup(rDGR);
391 //--------------------------DXFPolyLine-----------------------------------------
393 DXFPolyLineEntity::DXFPolyLineEntity() : DXFBasicEntity(DXF_POLYLINE)
395 fElevation=0.0;
396 nFlags=0;
397 fSWidth=0.0;
398 fEWidth=0.0;
399 nMeshMCount=0;
400 nMeshNCount=0;
401 nMDensity=0;
402 nNDensity=0;
403 nCSSType=0;
406 void DXFPolyLineEntity::EvaluateGroup(DXFGroupReader & rDGR)
408 switch (rDGR.GetG()) {
409 case 30: fElevation=rDGR.GetF(); break;
410 case 70: nFlags=rDGR.GetI(); break;
411 case 40: fSWidth=rDGR.GetF(); break;
412 case 41: fEWidth=rDGR.GetF(); break;
413 case 71: nMeshMCount=rDGR.GetI(); break;
414 case 72: nMeshNCount=rDGR.GetI(); break;
415 case 73: nMDensity=rDGR.GetI(); break;
416 case 74: nNDensity=rDGR.GetI(); break;
417 case 75: nCSSType=rDGR.GetI(); break;
418 default: DXFBasicEntity::EvaluateGroup(rDGR);
422 //--------------------------DXFLWPolyLine---------------------------------------
424 DXFLWPolyLineEntity::DXFLWPolyLineEntity() :
425 DXFBasicEntity( DXF_LWPOLYLINE ),
426 nIndex( 0 ),
427 nCount( 0 ),
428 nFlags( 0 ),
429 fConstantWidth( 0.0 ),
430 fStartWidth( 0.0 ),
431 fEndWidth( 0.0 ),
432 pP( NULL )
436 void DXFLWPolyLineEntity::EvaluateGroup( DXFGroupReader & rDGR )
438 switch ( rDGR.GetG() )
440 case 90 :
442 nCount = rDGR.GetI();
443 if ( nCount )
444 pP = new DXFVector[ nCount ];
446 break;
447 case 70: nFlags = rDGR.GetI(); break;
448 case 43: fConstantWidth = rDGR.GetF(); break;
449 case 40: fStartWidth = rDGR.GetF(); break;
450 case 41: fEndWidth = rDGR.GetF(); break;
451 case 10:
453 if ( pP && ( nIndex < nCount ) )
454 pP[ nIndex ].fx = rDGR.GetF();
456 break;
457 case 20:
459 if ( pP && ( nIndex < nCount ) )
460 pP[ nIndex++ ].fy = rDGR.GetF();
462 break;
463 default: DXFBasicEntity::EvaluateGroup(rDGR);
467 DXFLWPolyLineEntity::~DXFLWPolyLineEntity()
469 delete[] pP;
472 //--------------------------DXFHatchEntity-------------------------------------
474 DXFEdgeTypeLine::DXFEdgeTypeLine() :
475 DXFEdgeType( 1 )
479 DXFEdgeTypeLine::~DXFEdgeTypeLine()
483 sal_Bool DXFEdgeTypeLine::EvaluateGroup( DXFGroupReader & rDGR )
485 sal_Bool bExecutingGroupCode = sal_True;
486 switch ( rDGR.GetG() )
488 case 10 : aStartPoint.fx = rDGR.GetF(); break;
489 case 20 : aStartPoint.fy = rDGR.GetF(); break;
490 case 11 : aEndPoint.fx = rDGR.GetF(); break;
491 case 21 : aEndPoint.fy = rDGR.GetF(); break;
492 default : bExecutingGroupCode = sal_False; break;
494 return bExecutingGroupCode;
497 DXFEdgeTypeCircularArc::DXFEdgeTypeCircularArc() :
498 DXFEdgeType( 2 ),
499 fRadius( 0.0 ),
500 fStartAngle( 0.0 ),
501 fEndAngle( 0.0 ),
502 nIsCounterClockwiseFlag( 0 )
505 DXFEdgeTypeCircularArc::~DXFEdgeTypeCircularArc()
508 sal_Bool DXFEdgeTypeCircularArc::EvaluateGroup( DXFGroupReader & rDGR )
510 sal_Bool bExecutingGroupCode = sal_True;
511 switch ( rDGR.GetG() )
513 case 10 : aCenter.fx = rDGR.GetF(); break;
514 case 20 : aCenter.fy = rDGR.GetF(); break;
515 case 40 : fRadius = rDGR.GetF(); break;
516 case 50 : fStartAngle = rDGR.GetF(); break;
517 case 51 : fEndAngle = rDGR.GetF(); break;
518 case 73 : nIsCounterClockwiseFlag = rDGR.GetI(); break;
519 default : bExecutingGroupCode = sal_False; break;
521 return bExecutingGroupCode;
524 DXFEdgeTypeEllipticalArc::DXFEdgeTypeEllipticalArc() :
525 DXFEdgeType( 3 ),
526 fLength( 0.0 ),
527 fStartAngle( 0.0 ),
528 fEndAngle( 0.0 ),
529 nIsCounterClockwiseFlag( 0 )
532 DXFEdgeTypeEllipticalArc::~DXFEdgeTypeEllipticalArc()
536 sal_Bool DXFEdgeTypeEllipticalArc::EvaluateGroup( DXFGroupReader & rDGR )
538 sal_Bool bExecutingGroupCode = sal_True;
539 switch( rDGR.GetG() )
541 case 10 : aCenter.fx = rDGR.GetF(); break;
542 case 20 : aCenter.fy = rDGR.GetF(); break;
543 case 11 : aEndPoint.fx = rDGR.GetF(); break;
544 case 21 : aEndPoint.fy = rDGR.GetF(); break;
545 case 40 : fLength = rDGR.GetF(); break;
546 case 50 : fStartAngle = rDGR.GetF(); break;
547 case 51 : fEndAngle = rDGR.GetF(); break;
548 case 73 : nIsCounterClockwiseFlag = rDGR.GetI(); break;
549 default : bExecutingGroupCode = sal_False; break;
551 return bExecutingGroupCode;
554 DXFEdgeTypeSpline::DXFEdgeTypeSpline() :
555 DXFEdgeType( 4 ),
556 nDegree( 0 ),
557 nRational( 0 ),
558 nPeriodic( 0 ),
559 nKnotCount( 0 ),
560 nControlCount( 0 )
563 DXFEdgeTypeSpline::~DXFEdgeTypeSpline()
567 sal_Bool DXFEdgeTypeSpline::EvaluateGroup( DXFGroupReader & rDGR )
569 sal_Bool bExecutingGroupCode = sal_True;
570 switch ( rDGR.GetG() )
572 case 94 : nDegree = rDGR.GetI(); break;
573 case 73 : nRational = rDGR.GetI(); break;
574 case 74 : nPeriodic = rDGR.GetI(); break;
575 case 95 : nKnotCount = rDGR.GetI(); break;
576 case 96 : nControlCount = rDGR.GetI(); break;
577 default : bExecutingGroupCode = sal_False; break;
579 return bExecutingGroupCode;
582 DXFBoundaryPathData::DXFBoundaryPathData() :
583 nFlags( 0 ),
584 nHasBulgeFlag( 0 ),
585 nIsClosedFlag( 0 ),
586 nPointCount( 0 ),
587 fBulge( 0.0 ),
588 nSourceBoundaryObjects( 0 ),
589 nEdgeCount( 0 ),
590 bIsPolyLine( sal_True ),
591 nPointIndex( 0 ),
592 pP( NULL )
596 DXFBoundaryPathData::~DXFBoundaryPathData()
598 sal_uInt32 i = 0;
599 for ( i = 0; i < aEdges.size(); i++ )
600 delete aEdges[ i ];
601 delete[] pP;
604 sal_Bool DXFBoundaryPathData::EvaluateGroup( DXFGroupReader & rDGR )
606 sal_Bool bExecutingGroupCode = sal_True;
607 if ( bIsPolyLine )
609 switch( rDGR.GetG() )
611 case 92 :
613 nFlags = rDGR.GetI();
614 if ( ( nFlags & 2 ) == 0 )
615 bIsPolyLine = sal_False;
617 break;
618 case 93 :
620 nPointCount = rDGR.GetI();
621 if ( nPointCount )
622 pP = new DXFVector[ nPointCount ];
624 break;
625 case 72 : nHasBulgeFlag = rDGR.GetI(); break;
626 case 73 : nIsClosedFlag = rDGR.GetI(); break;
627 case 97 : nSourceBoundaryObjects = rDGR.GetI(); break;
628 case 42 : fBulge = rDGR.GetF(); break;
629 case 10:
631 if ( pP && ( nPointIndex < nPointCount ) )
632 pP[ nPointIndex ].fx = rDGR.GetF();
634 break;
635 case 20:
637 if ( pP && ( nPointIndex < nPointCount ) )
638 pP[ nPointIndex++ ].fy = rDGR.GetF();
640 break;
642 default : bExecutingGroupCode = sal_False; break;
645 else
647 if ( rDGR.GetG() == 93 )
648 nEdgeCount = rDGR.GetI();
649 else if ( rDGR.GetG() == 72 )
651 sal_Int32 nEdgeType = rDGR.GetI();
652 switch( nEdgeType )
654 case 1 : aEdges.push_back( new DXFEdgeTypeLine() ); break;
655 case 2 : aEdges.push_back( new DXFEdgeTypeCircularArc() ); break;
656 case 3 : aEdges.push_back( new DXFEdgeTypeEllipticalArc() ); break;
657 case 4 : aEdges.push_back( new DXFEdgeTypeSpline() ); break;
660 else if ( aEdges.size() )
661 aEdges[ aEdges.size() - 1 ]->EvaluateGroup( rDGR );
662 else
663 bExecutingGroupCode = sal_False;
665 return bExecutingGroupCode;
668 DXFHatchEntity::DXFHatchEntity() :
669 DXFBasicEntity( DXF_HATCH ),
670 bIsInBoundaryPathContext( sal_False ),
671 nCurrentBoundaryPathIndex( -1 ),
672 nFlags( 0 ),
673 nAssociativityFlag( 0 ),
674 nBoundaryPathCount( 0 ),
675 nHatchStyle( 0 ),
676 nHatchPatternType( 0 ),
677 fHatchPatternAngle( 0.0 ),
678 fHatchPatternScale( 1.0 ),
679 nHatchDoubleFlag( 0 ),
680 nHatchPatternDefinitionLines( 0 ),
681 fPixelSize( 1.0 ),
682 nNumberOfSeedPoints( 0 ),
683 pBoundaryPathData( NULL )
687 void DXFHatchEntity::EvaluateGroup( DXFGroupReader & rDGR )
689 switch ( rDGR.GetG() )
691 // case 10 : aElevationPoint.fx = rDGR.GetF(); break;
692 // case 20 : aElevationPoint.fy = rDGR.GetF(); break;
693 // case 30 : aElevationPoint.fz = rDGR.GetF(); break;
694 case 70 : nFlags = rDGR.GetI(); break;
695 case 71 : nAssociativityFlag = rDGR.GetI(); break;
696 case 91 :
698 bIsInBoundaryPathContext = sal_True;
699 nBoundaryPathCount = rDGR.GetI();
700 if ( nBoundaryPathCount )
701 pBoundaryPathData = new DXFBoundaryPathData[ nBoundaryPathCount ];
703 break;
704 case 75 :
706 nHatchStyle = rDGR.GetI();
707 bIsInBoundaryPathContext = sal_False;
709 break;
710 case 76 : nHatchPatternType = rDGR.GetI(); break;
711 case 52 : fHatchPatternAngle = rDGR.GetF(); break;
712 case 41 : fHatchPatternScale = rDGR.GetF(); break;
713 case 77 : nHatchDoubleFlag = rDGR.GetI(); break;
714 case 78 : nHatchPatternDefinitionLines = rDGR.GetI(); break;
715 case 47 : fPixelSize = rDGR.GetF(); break;
716 case 98 : nNumberOfSeedPoints = rDGR.GetI(); break;
718 //!! passthrough !!
719 case 92 : nCurrentBoundaryPathIndex++;
720 default:
722 sal_Bool bExecutingGroupCode = sal_False;
723 if ( bIsInBoundaryPathContext )
725 if ( ( nCurrentBoundaryPathIndex >= 0 ) &&
726 ( nCurrentBoundaryPathIndex < nBoundaryPathCount ) )
727 bExecutingGroupCode = pBoundaryPathData[ nCurrentBoundaryPathIndex ].EvaluateGroup( rDGR );
729 if ( bExecutingGroupCode == sal_False )
730 DXFBasicEntity::EvaluateGroup(rDGR);
732 break;
736 DXFHatchEntity::~DXFHatchEntity()
738 delete[] pBoundaryPathData;
741 //--------------------------DXFVertexEntity-------------------------------------
743 DXFVertexEntity::DXFVertexEntity() : DXFBasicEntity(DXF_VERTEX)
745 fSWidth=-1.0;
746 fEWidth=-1.0;
747 fBulge=0.0;
748 nFlags=0;
749 fCFTDir=0.0;
753 void DXFVertexEntity::EvaluateGroup(DXFGroupReader & rDGR)
755 switch (rDGR.GetG()) {
756 case 10: aP0.fx=rDGR.GetF(); break;
757 case 20: aP0.fy=rDGR.GetF(); break;
758 case 30: aP0.fz=rDGR.GetF(); break;
759 case 40: fSWidth=rDGR.GetF(); break;
760 case 41: fEWidth=rDGR.GetF(); break;
761 case 42: fBulge=rDGR.GetF(); break;
762 case 70: nFlags=rDGR.GetI(); break;
763 case 50: fCFTDir=rDGR.GetF(); break;
764 default: DXFBasicEntity::EvaluateGroup(rDGR);
768 //--------------------------DXFSeqEndEntity-------------------------------------
770 DXFSeqEndEntity::DXFSeqEndEntity() : DXFBasicEntity(DXF_SEQEND)
774 //--------------------------DXF3DFace-------------------------------------------
776 DXF3DFaceEntity::DXF3DFaceEntity() : DXFBasicEntity(DXF_3DFACE)
778 nIEFlags=0;
781 void DXF3DFaceEntity::EvaluateGroup(DXFGroupReader & rDGR)
783 switch (rDGR.GetG()) {
784 case 10: aP0.fx=rDGR.GetF(); break;
785 case 20: aP0.fy=rDGR.GetF(); break;
786 case 30: aP0.fz=rDGR.GetF(); break;
787 case 11: aP1.fx=rDGR.GetF(); break;
788 case 21: aP1.fy=rDGR.GetF(); break;
789 case 31: aP1.fz=rDGR.GetF(); break;
790 case 12: aP2.fx=rDGR.GetF(); break;
791 case 22: aP2.fy=rDGR.GetF(); break;
792 case 32: aP2.fz=rDGR.GetF(); break;
793 case 13: aP3.fx=rDGR.GetF(); break;
794 case 23: aP3.fy=rDGR.GetF(); break;
795 case 33: aP3.fz=rDGR.GetF(); break;
796 case 70: nIEFlags=rDGR.GetI(); break;
797 default: DXFBasicEntity::EvaluateGroup(rDGR);
802 //--------------------------DXFDimensionEntity----------------------------------
804 DXFDimensionEntity::DXFDimensionEntity() : DXFBasicEntity(DXF_DIMENSION)
806 sPseudoBlock[0]=0;
809 void DXFDimensionEntity::EvaluateGroup(DXFGroupReader & rDGR)
811 switch (rDGR.GetG()) {
812 case 2: strncpy( sPseudoBlock, rDGR.GetS(), DXF_MAX_STRING_LEN + 1 ); break;
813 default: DXFBasicEntity::EvaluateGroup(rDGR);
817 //---------------------------- DXFEntites --------------------------------------
819 void DXFEntities::Read(DXFGroupReader & rDGR)
821 DXFBasicEntity * pE, * * ppSucc;
823 ppSucc=&pFirst;
824 while (*ppSucc!=NULL) ppSucc=&((*ppSucc)->pSucc);
826 while (rDGR.GetG()!=0) rDGR.Read();
828 while (strcmp(rDGR.GetS(),"ENDBLK")!=0 &&
829 strcmp(rDGR.GetS(),"ENDSEC")!=0 &&
830 strcmp(rDGR.GetS(),"EOF")!=0 )
833 if (strcmp(rDGR.GetS(),"LINE" )==0) pE=new DXFLineEntity;
834 else if (strcmp(rDGR.GetS(),"POINT" )==0) pE=new DXFPointEntity;
835 else if (strcmp(rDGR.GetS(),"CIRCLE" )==0) pE=new DXFCircleEntity;
836 else if (strcmp(rDGR.GetS(),"ARC" )==0) pE=new DXFArcEntity;
837 else if (strcmp(rDGR.GetS(),"TRACE" )==0) pE=new DXFTraceEntity;
838 else if (strcmp(rDGR.GetS(),"SOLID" )==0) pE=new DXFSolidEntity;
839 else if (strcmp(rDGR.GetS(),"TEXT" )==0) pE=new DXFTextEntity;
840 else if (strcmp(rDGR.GetS(),"SHAPE" )==0) pE=new DXFShapeEntity;
841 else if (strcmp(rDGR.GetS(),"INSERT" )==0) pE=new DXFInsertEntity;
842 else if (strcmp(rDGR.GetS(),"ATTDEF" )==0) pE=new DXFAttDefEntity;
843 else if (strcmp(rDGR.GetS(),"ATTRIB" )==0) pE=new DXFAttribEntity;
844 else if (strcmp(rDGR.GetS(),"POLYLINE" )==0) pE=new DXFPolyLineEntity;
845 else if (strcmp(rDGR.GetS(),"LWPOLYLINE")==0) pE=new DXFLWPolyLineEntity;
846 else if (strcmp(rDGR.GetS(),"VERTEX" )==0) pE=new DXFVertexEntity;
847 else if (strcmp(rDGR.GetS(),"SEQEND" )==0) pE=new DXFSeqEndEntity;
848 else if (strcmp(rDGR.GetS(),"3DFACE" )==0) pE=new DXF3DFaceEntity;
849 else if (strcmp(rDGR.GetS(),"DIMENSION" )==0) pE=new DXFDimensionEntity;
850 else if (strcmp(rDGR.GetS(),"HATCH" )==0) pE=new DXFHatchEntity;
851 else
853 do {
854 rDGR.Read();
855 } while (rDGR.GetG()!=0);
856 continue;
858 *ppSucc=pE;
859 ppSucc=&(pE->pSucc);
860 pE->Read(rDGR);
864 void DXFEntities::Clear()
866 DXFBasicEntity * ptmp;
868 while (pFirst!=NULL) {
869 ptmp=pFirst;
870 pFirst=ptmp->pSucc;
871 delete ptmp;