LibreOffice Module vcl (master)  1
dxfentrd.hxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
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/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
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 .
18  */
19 
20 #ifndef INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFENTRD_HXX
21 #define INCLUDED_FILTER_SOURCE_GRAPHICFILTER_IDXF_DXFENTRD_HXX
22 
23 #include "dxfgrprd.hxx"
24 #include "dxfvec.hxx"
25 #include <tools/long.hxx>
26 
27 #include <memory>
28 #include <vector>
29 
49 };
50 
51 // base class of an entity
52 
54 
55 public:
56 
58  // pointer to next entity (in the list of DXFEntities.pFirst)
59 
61  // entity kind (line or circle or what)
62 
63  // properties that all entities have, each
64  // commented with group codes:
65  OString m_sLayer; // 8
66  OString m_sLineType; // 6
67  double fThickness; // 39
70  DXFVector aExtrusion; // 210,220,230
71 
72 protected:
73 
74  DXFBasicEntity(DXFEntityType eThisType);
75  // always initialize the constructors of entities with default values
76 
77 public:
78 
79  virtual ~DXFBasicEntity();
80  void Read(DXFGroupReader & rDGR);
81  // Reads a parameter till the next 0-group
82 
83 protected:
84 
85  virtual void EvaluateGroup(DXFGroupReader & rDGR);
86  // This method will be called by Read() for every parameter (respectively
87  // for every group).
88  // As far as the group code of the entity is known, the corresponding
89  // parameter is fetched.
90 
91 };
92 
93 
94 // the different kinds of entities
95 
96 class DXFLineEntity : public DXFBasicEntity {
97 
98 public:
99 
100  DXFVector aP0; // 10,20,30
101  DXFVector aP1; // 11,21,31
102 
103  DXFLineEntity();
104 
105 protected:
106 
107  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
108 };
109 
111 
112 public:
113 
114  DXFVector aP0; // 10,20,30
115 
116  DXFPointEntity();
117 
118 protected:
119 
120  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
121 };
122 
124 
125 public:
126 
127  DXFVector aP0; // 10,20,30
128  double fRadius; // 40
129 
130  DXFCircleEntity();
131 
132 protected:
133 
134  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
135 };
136 
137 class DXFArcEntity : public DXFBasicEntity {
138 
139 public:
140 
141  DXFVector aP0; // 10,20,30
142  double fRadius; // 40
143  double fStart; // 50
144  double fEnd; // 51
145 
146  DXFArcEntity();
147 
148 protected:
149 
150  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
151 };
152 
154 
155 public:
156 
157  DXFVector aP0; // 10,20,30
158  DXFVector aP1; // 11,21,31
159  DXFVector aP2; // 12,22,32
160  DXFVector aP3; // 13,23,33
161 
162  DXFTraceEntity();
163 
164 protected:
165 
166  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
167 };
168 
170 
171 public:
172 
173  DXFVector aP0; // 10,20,30
174  DXFVector aP1; // 11,21,31
175  DXFVector aP2; // 12,22,32
176  DXFVector aP3; // 13,23,33
177 
178  DXFSolidEntity();
179 
180 protected:
181 
182  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
183 };
184 
186 
187 public:
188 
189  DXFVector aP0; // 10,20,30
190  double fHeight; // 40
191  OString m_sText; // 1
192  double fRotAngle; // 50
193  double fXScale; // 41
194  double fOblAngle; // 42
195  OString m_sStyle; // 7
199  DXFVector aAlign; // 11,21,31
200 
201  DXFTextEntity();
202 
203 protected:
204 
205  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
206 };
207 
209 
210  DXFVector aP0; // 10,20,30
211  double fSize; // 40
212  OString m_sName; // 2
213  double fRotAngle; // 50
214  double fXScale; // 41
215  double fOblAngle; // 51
216 
217 public:
218 
219  DXFShapeEntity();
220 
221 protected:
222 
223  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
224 };
225 
227 
228 public:
229 
231  OString m_sName; // 2
232  DXFVector aP0; // 10,20,30
233  double fXScale; // 41
234  double fYScale; // 42
235  double fZScale; // 43
236  double fRotAngle; // 50
239  double fColSpace; // 44
240  double fRowSpace; // 45
241 
242  DXFInsertEntity();
243 
244 protected:
245 
246  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
247 };
248 
250 
251  DXFVector aP0; // 10,20,30
252  double fHeight; // 40
253  OString m_sDefVal; // 1
254  OString m_sPrompt; // 3
255  OString m_sTagStr; // 2
258  double fRotAngle; // 50
259  double fXScale; // 41
260  double fOblAngle; // 51
261  OString m_sStyle; // 7
265  DXFVector aAlign; // 11,21,31
266 
267 public:
268 
269  DXFAttDefEntity();
270 
271 protected:
272 
273  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
274 };
275 
277 
278 public:
279 
280  DXFVector aP0; // 10,20,30
281  double fHeight; // 40
282  OString m_sText; // 1
283  OString m_sTagStr; // 2
286  double fRotAngle; // 50
287  double fXScale; // 41
288  double fOblAngle; // 51
289  OString m_sStyle; // 7
293  DXFVector aAlign; // 11,21,31
294 
295  DXFAttribEntity();
296 
297 protected:
298 
299  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
300 };
301 
303 
304 public:
305 
307  double fSWidth; // 40
308  double fEWidth; // 41
314 
316 
317 protected:
318 
319  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
320 };
321 
323 {
324  sal_Int32 nIndex;
325  sal_Int32 nCount; // 90
326 
327  public:
328 
329  sal_Int32 nFlags; // 70 1 = closed, 128 = plinegen
330  double fConstantWidth; // 43 (optional - default: 0, not used if fStartWidth and/or fEndWidth is used)
331  double fStartWidth; // 40
332  double fEndWidth; // 41
333 
334  std::vector<DXFVector> aP;
335 
337 
338  protected:
339 
340  virtual void EvaluateGroup( DXFGroupReader & rDGR ) override;
341 
342 };
343 
345 {
346  sal_Int32 nEdgeType;
347 
348  virtual ~DXFEdgeType(){};
349  virtual bool EvaluateGroup( DXFGroupReader & /*rDGR*/ ){ return true; };
350 
351  protected:
352 
353  DXFEdgeType( sal_Int32 EdgeType ):nEdgeType(EdgeType){};
354 };
355 
357 {
360  DXFEdgeTypeLine();
361  virtual bool EvaluateGroup( DXFGroupReader & rDGR ) override;
362 };
363 
365 {
366  DXFVector aCenter; // 10,20
367  double fRadius; // 40
368  double fStartAngle; // 50
369  double fEndAngle; // 51
370  sal_Int32 nIsCounterClockwiseFlag; // 73
372  virtual bool EvaluateGroup( DXFGroupReader & rDGR ) override;
373 };
374 
376 {
377  DXFVector aCenter; // 10,20
379  double fLength; // 40
380  double fStartAngle; // 50
381  double fEndAngle; // 51
382  sal_Int32 nIsCounterClockwiseFlag; // 73
383 
385  virtual bool EvaluateGroup( DXFGroupReader & rDGR ) override;
386 };
387 
389 {
390  sal_Int32 nDegree; // 94
391  sal_Int32 nRational; // 73
392  sal_Int32 nPeriodic; // 74
393  sal_Int32 nKnotCount; // 75
394  sal_Int32 nControlCount; // 76
395 
397  virtual bool EvaluateGroup( DXFGroupReader & rDGR ) override;
398 };
399 
401 {
402 private:
403  sal_Int32 nPointCount; // 93
404 public:
405  sal_Int32 nFlags; // 92
406  sal_Int32 nHasBulgeFlag; // 72
407  sal_Int32 nIsClosedFlag; // 73
408  double fBulge; // 42
409  sal_Int32 nSourceBoundaryObjects; // 97
410  sal_Int32 nEdgeCount; // 93
411 
413  sal_Int32 nPointIndex;
414 
415  std::vector<DXFVector> aP;
416  std::vector<std::unique_ptr<DXFEdgeType>> aEdges;
417 
420 
421  bool EvaluateGroup( DXFGroupReader & rDGR );
422 };
423 
425 {
428 
429  public:
430 
431  sal_Int32 nFlags; // 70 (solid fill = 1, pattern fill = 0)
432  sal_Int32 nAssociativityFlag; // 71 (associative = 1, non-associative = 0)
433  sal_Int32 nBoundaryPathCount; // 91
434  sal_Int32 nHatchStyle; // 75 (odd parity = 0, outmost area = 1, entire area = 2 )
435  sal_Int32 nHatchPatternType; // 76 (user defined = 0, predefined = 1, custom = 2)
436  double fHatchPatternAngle; // 52 (pattern fill only)
437  double fHatchPatternScale; // 41 (pattern fill only:scale or spacing)
438  sal_Int32 nHatchDoubleFlag; // 77 (pattern fill only:double = 1, not double = 0)
440  double fPixelSize; // 47
441  sal_Int32 nNumberOfSeedPoints; // 98
442 
443  std::unique_ptr<DXFBoundaryPathData[]> pBoundaryPathData;
444 
445  DXFHatchEntity();
446 
447  protected:
448 
449  virtual void EvaluateGroup( DXFGroupReader & rDGR ) override;
450 };
451 
453 
454 public:
455 
456  DXFVector aP0; // 10,20,30
457  double fSWidth; // 40 (if <0.0, then one has DXFPolyLine::fSWidth)
458  double fEWidth; // 41 (if <0.0, then one has DXFPolyLine::fEWidth)
459  double fBulge; // 42
461  double fCFTDir; // 50
462 
463  DXFVertexEntity();
464 
465 protected:
466 
467  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
468 };
469 
471 
472 public:
473 
474  DXFSeqEndEntity();
475 };
476 
478 
479 public:
480 
481  DXFVector aP0; // 10,20,30
482  DXFVector aP1; // 11,21,31
483  DXFVector aP2; // 12,22,32
484  DXFVector aP3; // 13,23,33
486 
487  DXF3DFaceEntity();
488 
489 protected:
490 
491  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
492 };
493 
495 
496 public:
497 
498  OString m_sPseudoBlock; // 2
499 
501 
502 protected:
503 
504  virtual void EvaluateGroup(DXFGroupReader & rDGR) override;
505 };
506 
507 
508 // read and represent the set of entities
509 class DXFEntities {
510 
511 public:
512 
514  : pFirst(nullptr)
515  , mbBeingDrawn(false)
516  {
517  }
518 
520  {
521  Clear();
522  }
523 
524  DXFBasicEntity * pFirst; // list of entities, READ ONLY!
525  mutable bool mbBeingDrawn; // guard for loop in entity parsing
526 
527  void Read(DXFGroupReader & rDGR);
528  // read entities by rGDR of a DXF file until a
529  // ENDBLK, ENDSEC or EOF (of group 0).
530  // (all unknown thing will be skipped)
531 
532  void Clear();
533  // deletes all entities
534 };
535 
536 #endif
537 
538 
539 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
DXFVector aAlign
Definition: dxfentrd.hxx:293
DXFEntityType eType
Definition: dxfentrd.hxx:60
OString m_sStyle
Definition: dxfentrd.hxx:261
DXFVector aP0
Definition: dxfentrd.hxx:114
double fRowSpace
Definition: dxfentrd.hxx:240
OString m_sStyle
Definition: dxfentrd.hxx:289
DXFVector aP3
Definition: dxfentrd.hxx:176
DXFVector aP0
Definition: dxfentrd.hxx:481
DXFVector aExtrusion
Definition: dxfentrd.hxx:70
sal_Int32 nSourceBoundaryObjects
Definition: dxfentrd.hxx:409
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:128
tools::Long nNDensity
Definition: dxfentrd.hxx:312
bool EvaluateGroup(DXFGroupReader &rDGR)
Definition: dxfentrd.cxx:572
DXFEdgeType(sal_Int32 EdgeType)
Definition: dxfentrd.hxx:353
double fThickness
Definition: dxfentrd.hxx:67
void Read(DXFGroupReader &rDGR)
Definition: dxfentrd.cxx:42
double fEnd
Definition: dxfentrd.hxx:144
DXFVector aP0
Definition: dxfentrd.hxx:141
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:72
double fHatchPatternScale
Definition: dxfentrd.hxx:437
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:91
long Long
double fRotAngle
Definition: dxfentrd.hxx:213
double fHeight
Definition: dxfentrd.hxx:190
tools::Long nAttrFlags
Definition: dxfentrd.hxx:256
tools::Long nIEFlags
Definition: dxfentrd.hxx:485
DXFVector aP1
Definition: dxfentrd.hxx:101
sal_Int32 nPointCount
Definition: dxfentrd.hxx:403
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:147
OString m_sDefVal
Definition: dxfentrd.hxx:253
sal_Int32 nHatchStyle
Definition: dxfentrd.hxx:434
std::vector< DXFVector > aP
Definition: dxfentrd.hxx:415
sal_Int32 nNumberOfSeedPoints
Definition: dxfentrd.hxx:441
tools::Long nMDensity
Definition: dxfentrd.hxx:311
OString m_sText
Definition: dxfentrd.hxx:282
tools::Long nVertJust
Definition: dxfentrd.hxx:198
tools::Long nVertJust
Definition: dxfentrd.hxx:292
double fStart
Definition: dxfentrd.hxx:143
DXFVector aP0
Definition: dxfentrd.hxx:157
tools::Long nFieldLen
Definition: dxfentrd.hxx:257
virtual bool EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:512
DXFVector aP1
Definition: dxfentrd.hxx:482
double fOblAngle
Definition: dxfentrd.hxx:260
double fRotAngle
Definition: dxfentrd.hxx:192
DXFVector aP0
Definition: dxfentrd.hxx:100
sal_Int32 nHatchPatternType
Definition: dxfentrd.hxx:435
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:729
sal_Int32 nEdgeType
Definition: dxfentrd.hxx:346
virtual ~DXFEdgeType()
Definition: dxfentrd.hxx:348
tools::Long nFlags
Definition: dxfentrd.hxx:460
std::vector< DXFVector > aP
Definition: dxfentrd.hxx:334
tools::Long nFlags
Definition: dxfentrd.hxx:306
DXFEntityType
Definition: dxfentrd.hxx:30
OString m_sName
Definition: dxfentrd.hxx:231
sal_Int32 nHatchDoubleFlag
Definition: dxfentrd.hxx:438
DXFVector aP3
Definition: dxfentrd.hxx:484
DXFVector aEndPoint
Definition: dxfentrd.hxx:359
OString m_sLayer
Definition: dxfentrd.hxx:65
double fPixelSize
Definition: dxfentrd.hxx:440
OString m_sStyle
Definition: dxfentrd.hxx:195
sal_Int32 nControlCount
Definition: dxfentrd.hxx:394
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:268
double fXScale
Definition: dxfentrd.hxx:214
bool mbBeingDrawn
Definition: dxfentrd.hxx:525
OString m_sText
Definition: dxfentrd.hxx:191
virtual void EvaluateGroup(DXFGroupReader &rDGR)
Definition: dxfentrd.cxx:47
tools::Long nMeshMCount
Definition: dxfentrd.hxx:309
sal_Int32 nEdgeCount
Definition: dxfentrd.hxx:410
tools::Long nColCount
Definition: dxfentrd.hxx:237
double fColSpace
Definition: dxfentrd.hxx:239
tools::Long nAttrFlag
Definition: dxfentrd.hxx:230
std::vector< std::unique_ptr< DXFEdgeType > > aEdges
Definition: dxfentrd.hxx:416
DXFVector aP0
Definition: dxfentrd.hxx:189
bool bIsInBoundaryPathContext
Definition: dxfentrd.hxx:426
sal_Int32 nPointIndex
Definition: dxfentrd.hxx:413
sal_Int32 nIsClosedFlag
Definition: dxfentrd.hxx:407
sal_Int32 nHatchPatternDefinitionLines
Definition: dxfentrd.hxx:439
OString m_sLineType
Definition: dxfentrd.hxx:66
tools::Long nRowCount
Definition: dxfentrd.hxx:238
DXFVector aP0
Definition: dxfentrd.hxx:232
DXFVector aP2
Definition: dxfentrd.hxx:175
DXFVector aP2
Definition: dxfentrd.hxx:159
double fRotAngle
Definition: dxfentrd.hxx:286
DXFVector aP2
Definition: dxfentrd.hxx:483
double fOblAngle
Definition: dxfentrd.hxx:215
tools::Long nFieldLen
Definition: dxfentrd.hxx:285
sal_Int32 nRational
Definition: dxfentrd.hxx:391
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:664
std::unique_ptr< DXFBoundaryPathData[]> pBoundaryPathData
Definition: dxfentrd.hxx:443
OString m_sPrompt
Definition: dxfentrd.hxx:254
sal_Int32 nDegree
Definition: dxfentrd.hxx:390
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:206
DXFVector aP0
Definition: dxfentrd.hxx:456
DXFVector aP0
Definition: dxfentrd.hxx:210
OString m_sTagStr
Definition: dxfentrd.hxx:283
tools::Long nHorzJust
Definition: dxfentrd.hxx:263
double fXScale
Definition: dxfentrd.hxx:193
sal_Int32 nKnotCount
Definition: dxfentrd.hxx:393
double fHatchPatternAngle
Definition: dxfentrd.hxx:436
DXFVector aAlign
Definition: dxfentrd.hxx:199
OString m_sTagStr
Definition: dxfentrd.hxx:255
DXFVector aAlign
Definition: dxfentrd.hxx:265
tools::Long nGenFlags
Definition: dxfentrd.hxx:196
double fOblAngle
Definition: dxfentrd.hxx:288
sal_Int32 nHasBulgeFlag
Definition: dxfentrd.hxx:406
double fRotAngle
Definition: dxfentrd.hxx:236
DXFBasicEntity(DXFEntityType eThisType)
Definition: dxfentrd.cxx:28
double fRotAngle
Definition: dxfentrd.hxx:258
sal_Int32 nIsCounterClockwiseFlag
Definition: dxfentrd.hxx:382
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:387
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:784
tools::Long nCSSType
Definition: dxfentrd.hxx:313
sal_Int32 nBoundaryPathCount
Definition: dxfentrd.hxx:433
void Read(DXFGroupReader &rDGR)
Definition: dxfentrd.cxx:794
virtual bool EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:487
virtual bool EvaluateGroup(DXFGroupReader &)
Definition: dxfentrd.hxx:349
DXFBasicEntity * pSucc
Definition: dxfentrd.hxx:57
tools::Long nSpace
Definition: dxfentrd.hxx:69
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:757
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:108
DXFVector aP0
Definition: dxfentrd.hxx:173
virtual bool EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:464
DXFVector aP3
Definition: dxfentrd.hxx:160
tools::Long nHorzJust
Definition: dxfentrd.hxx:291
OString m_sName
Definition: dxfentrd.hxx:212
sal_Int32 nPeriodic
Definition: dxfentrd.hxx:392
DXFVector aP0
Definition: dxfentrd.hxx:251
DXFVector aStartPoint
Definition: dxfentrd.hxx:358
tools::Long nHorzJust
Definition: dxfentrd.hxx:197
EdgeType
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:348
DXFVector aP0
Definition: dxfentrd.hxx:127
DXFVector aP1
Definition: dxfentrd.hxx:174
tools::Long nGenFlags
Definition: dxfentrd.hxx:290
tools::Long nVertJust
Definition: dxfentrd.hxx:264
double fOblAngle
Definition: dxfentrd.hxx:194
virtual bool EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:540
void Clear()
Definition: dxfentrd.cxx:839
sal_Int32 nAssociativityFlag
Definition: dxfentrd.hxx:432
DXFBasicEntity * pFirst
Definition: dxfentrd.hxx:524
sal_Int32 nIsCounterClockwiseFlag
Definition: dxfentrd.hxx:370
virtual ~DXFBasicEntity()
Definition: dxfentrd.cxx:62
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:415
double fRadius
Definition: dxfentrd.hxx:142
DXFVector aP0
Definition: dxfentrd.hxx:280
OString m_sPseudoBlock
Definition: dxfentrd.hxx:498
tools::Long nAttrFlags
Definition: dxfentrd.hxx:284
tools::Long nColor
Definition: dxfentrd.hxx:68
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:172
sal_Int32 nCurrentBoundaryPathIndex
Definition: dxfentrd.hxx:427
sal_Int32 nFlags
Definition: dxfentrd.hxx:431
DXFVector aP1
Definition: dxfentrd.hxx:158
tools::Long nGenFlags
Definition: dxfentrd.hxx:262
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:305
tools::Long nMeshNCount
Definition: dxfentrd.hxx:310
virtual void EvaluateGroup(DXFGroupReader &rDGR) override
Definition: dxfentrd.cxx:238