LCOV - code coverage report
Current view: top level - filter/source/graphicfilter/idxf - dxfentrd.hxx (source / functions) Hit Total Coverage
Test: commit 0e63ca4fde4e446f346e35849c756a30ca294aab Lines: 0 25 0.0 %
Date: 2014-04-11 Functions: 0 38 0.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      26             : #include <deque>
      27             : 
      28             : typedef std::deque< Point > DXFPointArray;
      29             : 
      30             : 
      31             : //----------------------------- entity kind ------------------------------------
      32             : 
      33             : 
      34             : enum DXFEntityType {
      35             :     DXF_LINE,
      36             :     DXF_POINT,
      37             :     DXF_CIRCLE,
      38             :     DXF_ARC,
      39             :     DXF_TRACE,
      40             :     DXF_SOLID,
      41             :     DXF_TEXT,
      42             :     DXF_SHAPE,
      43             :     DXF_INSERT,
      44             :     DXF_ATTDEF,
      45             :     DXF_ATTRIB,
      46             :     DXF_POLYLINE,
      47             :     DXF_VERTEX,
      48             :     DXF_SEQEND,
      49             :     DXF_3DFACE,
      50             :     DXF_DIMENSION,
      51             :     DXF_LWPOLYLINE,
      52             :     DXF_HATCH
      53             : };
      54             : 
      55             : 
      56             : //------------------------ base class of an entity -----------------------------
      57             : 
      58             : 
      59             : class DXFBasicEntity {
      60             : 
      61             : public:
      62             : 
      63             :     DXFBasicEntity * pSucc;
      64             :         // pointer to next entity (in the list of DXFEntities.pFirst)
      65             : 
      66             :     DXFEntityType eType;
      67             :         // entity kind (line or circle or what)
      68             : 
      69             :     // properties that all entities have, each
      70             :     // commented with group codes:
      71             :     OString m_sLayer;                     //  8
      72             :     OString m_sLineType;                  //  6
      73             :     double fElevation;                    // 38
      74             :     double fThickness;                    // 39
      75             :     long nColor;                          // 62
      76             :     long nSpace;                          // 67
      77             :     DXFVector aExtrusion;                 // 210,220,230
      78             : 
      79             : protected:
      80             : 
      81             :     DXFBasicEntity(DXFEntityType eThisType);
      82             :         // always initialize the constructors of entities with default values
      83             : 
      84             : public:
      85             : 
      86             :     virtual ~DXFBasicEntity();
      87             :     virtual void Read(DXFGroupReader & rDGR);
      88             :         // Reads a parameter till the next 0-group
      89             : 
      90             : protected:
      91             : 
      92             :     virtual void EvaluateGroup(DXFGroupReader & rDGR);
      93             :         // This method will be called by Read() for every parameter (respectively
      94             :         // for every group).
      95             :         // As far as the group code of the entity is known, the corresponding
      96             :         // parameter is fetched.
      97             : 
      98             : };
      99             : 
     100             : 
     101             : //------------------- the different kinds of entities --------------------------
     102             : 
     103             : 
     104             : //--------------------------Line------------------------------------------------
     105             : 
     106           0 : class DXFLineEntity : public DXFBasicEntity {
     107             : 
     108             : public:
     109             : 
     110             :     DXFVector aP0; // 10,20,30
     111             :     DXFVector aP1; // 11,21,31
     112             : 
     113             :     DXFLineEntity();
     114             : 
     115             : protected:
     116             : 
     117             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     118             : };
     119             : 
     120             : //--------------------------Point-----------------------------------------------
     121             : 
     122           0 : class DXFPointEntity : public DXFBasicEntity {
     123             : 
     124             : public:
     125             : 
     126             :     DXFVector aP0; // 10,20,30
     127             : 
     128             :     DXFPointEntity();
     129             : 
     130             : protected:
     131             : 
     132             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     133             : };
     134             : 
     135             : //--------------------------Circle----------------------------------------------
     136             : 
     137           0 : class DXFCircleEntity : public DXFBasicEntity {
     138             : 
     139             : public:
     140             : 
     141             :     DXFVector aP0;  // 10,20,30
     142             :     double fRadius; // 40
     143             : 
     144             :     DXFCircleEntity();
     145             : 
     146             : protected:
     147             : 
     148             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     149             : };
     150             : 
     151             : //--------------------------Arc-------------------------------------------------
     152             : 
     153           0 : class DXFArcEntity : public DXFBasicEntity {
     154             : 
     155             : public:
     156             : 
     157             :     DXFVector aP0;  // 10,20,30
     158             :     double fRadius; // 40
     159             :     double fStart;  // 50
     160             :     double fEnd;    // 51
     161             : 
     162             :     DXFArcEntity();
     163             : 
     164             : protected:
     165             : 
     166             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     167             : };
     168             : 
     169             : //--------------------------Trace-----------------------------------------------
     170             : 
     171           0 : class DXFTraceEntity : public DXFBasicEntity {
     172             : 
     173             : public:
     174             : 
     175             :     DXFVector aP0; // 10,20,30
     176             :     DXFVector aP1; // 11,21,31
     177             :     DXFVector aP2; // 12,22,32
     178             :     DXFVector aP3; // 13,23,33
     179             : 
     180             :     DXFTraceEntity();
     181             : 
     182             : protected:
     183             : 
     184             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     185             : };
     186             : 
     187             : //--------------------------Solid-----------------------------------------------
     188             : 
     189           0 : class DXFSolidEntity : public DXFBasicEntity {
     190             : 
     191             : public:
     192             : 
     193             :     DXFVector aP0; // 10,20,30
     194             :     DXFVector aP1; // 11,21,31
     195             :     DXFVector aP2; // 12,22,32
     196             :     DXFVector aP3; // 13,23,33
     197             : 
     198             :     DXFSolidEntity();
     199             : 
     200             : protected:
     201             : 
     202             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     203             : };
     204             : 
     205             : //--------------------------Text------------------------------------------------
     206             : 
     207           0 : class DXFTextEntity : public DXFBasicEntity {
     208             : 
     209             : public:
     210             : 
     211             :     DXFVector aP0;                     // 10,20,30
     212             :     double fHeight;                    // 40
     213             :     OString m_sText;                   //  1
     214             :     double fRotAngle;                  // 50
     215             :     double fXScale;                    // 41
     216             :     double fOblAngle;                  // 42
     217             :     OString m_sStyle;                  //  7
     218             :     long nGenFlags;                    // 71
     219             :     long nHorzJust;                    // 72
     220             :     long nVertJust;                    // 73
     221             :     DXFVector aAlign;                  // 11,21,31
     222             : 
     223             :     DXFTextEntity();
     224             : 
     225             : protected:
     226             : 
     227             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     228             : };
     229             : 
     230             : //--------------------------Shape-----------------------------------------------
     231             : 
     232           0 : class DXFShapeEntity : public DXFBasicEntity {
     233             : 
     234             : public:
     235             : 
     236             :     DXFVector aP0;                    // 10,20,30
     237             :     double fSize;                     // 40
     238             :     OString m_sName;                  //  2
     239             :     double fRotAngle;                 // 50
     240             :     double fXScale;                   // 41
     241             :     double fOblAngle;                 // 51
     242             : 
     243             :     DXFShapeEntity();
     244             : 
     245             : protected:
     246             : 
     247             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     248             : };
     249             : 
     250             : //--------------------------Insert----------------------------------------------
     251             : 
     252           0 : class DXFInsertEntity : public DXFBasicEntity {
     253             : 
     254             : public:
     255             : 
     256             :     long nAttrFlag;                   // 66
     257             :     OString m_sName;                  //  2
     258             :     DXFVector aP0;                    // 10,20,30
     259             :     double fXScale;                   // 41
     260             :     double fYScale;                   // 42
     261             :     double fZScale;                   // 43
     262             :     double fRotAngle;                 // 50
     263             :     long nColCount;                   // 70
     264             :     long nRowCount;                   // 71
     265             :     double fColSpace;                 // 44
     266             :     double fRowSpace;                 // 45
     267             : 
     268             :     DXFInsertEntity();
     269             : 
     270             : protected:
     271             : 
     272             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     273             : };
     274             : 
     275             : //--------------------------AttDef----------------------------------------------
     276             : 
     277           0 : class DXFAttDefEntity : public DXFBasicEntity {
     278             : 
     279             : public:
     280             : 
     281             :     DXFVector aP0;                      // 10,20,30
     282             :     double fHeight;                     // 40
     283             :     OString m_sDefVal;                  //  1
     284             :     OString m_sPrompt;                  //  3
     285             :     OString m_sTagStr;                  //  2
     286             :     long nAttrFlags;                    // 70
     287             :     long nFieldLen;                     // 73
     288             :     double fRotAngle;                   // 50
     289             :     double fXScale;                     // 41
     290             :     double fOblAngle;                   // 51
     291             :     OString m_sStyle;                   //  7
     292             :     long nGenFlags;                     // 71
     293             :     long nHorzJust;                     // 72
     294             :     long nVertJust;                     // 74
     295             :     DXFVector aAlign;                   // 11,21,31
     296             : 
     297             :     DXFAttDefEntity();
     298             : 
     299             : protected:
     300             : 
     301             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     302             : };
     303             : 
     304             : //--------------------------Attrib----------------------------------------------
     305             : 
     306           0 : class DXFAttribEntity : public DXFBasicEntity {
     307             : 
     308             : public:
     309             : 
     310             :     DXFVector aP0;                      // 10,20,30
     311             :     double fHeight;                     // 40
     312             :     OString m_sText;                    //  1
     313             :     OString m_sTagStr;                  //  2
     314             :     long nAttrFlags;                    // 70
     315             :     long nFieldLen;                     // 73
     316             :     double fRotAngle;                   // 50
     317             :     double fXScale;                     // 41
     318             :     double fOblAngle;                   // 51
     319             :     OString m_sStyle;                   //  7
     320             :     long nGenFlags;                     // 71
     321             :     long nHorzJust;                     // 72
     322             :     long nVertJust;                     // 74
     323             :     DXFVector aAlign;                   // 11,21,31
     324             : 
     325             :     DXFAttribEntity();
     326             : 
     327             : protected:
     328             : 
     329             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     330             : };
     331             : 
     332             : //--------------------------PolyLine--------------------------------------------
     333             : 
     334           0 : class DXFPolyLineEntity : public DXFBasicEntity {
     335             : 
     336             : public:
     337             : 
     338             :     double fElevation; // 30
     339             :     long nFlags;       // 70
     340             :     double fSWidth;    // 40
     341             :     double fEWidth;    // 41
     342             :     long nMeshMCount;  // 71
     343             :     long nMeshNCount;  // 72
     344             :     long nMDensity;    // 73
     345             :     long nNDensity;    // 74
     346             :     long nCSSType;     // 75
     347             : 
     348             :     DXFPolyLineEntity();
     349             : 
     350             : protected:
     351             : 
     352             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     353             : };
     354             : 
     355             : class DXFLWPolyLineEntity : public DXFBasicEntity
     356             : {
     357             :         sal_Int32   nIndex;
     358             : 
     359             :     public :
     360             : 
     361             :         sal_Int32   nCount;         // 90
     362             :         sal_Int32   nFlags;         // 70   1 = closed, 128 = plinegen
     363             :         double      fConstantWidth; // 43   (optional - default: 0, not used if fStartWidth and/or fEndWidth is used)
     364             :         double      fStartWidth;    // 40
     365             :         double      fEndWidth;      // 41
     366             : 
     367             :         DXFVector*  pP;
     368             : 
     369             :         DXFLWPolyLineEntity();
     370             :         virtual ~DXFLWPolyLineEntity();
     371             : 
     372             :     protected :
     373             : 
     374             :         virtual void EvaluateGroup( DXFGroupReader & rDGR ) SAL_OVERRIDE;
     375             : 
     376             : };
     377             : 
     378             : //-------------------------- Hatch ---------------------------------------------
     379             : 
     380             : struct DXFEdgeType
     381             : {
     382             :     sal_Int32 nEdgeType;
     383             : 
     384           0 :     virtual ~DXFEdgeType(){};
     385           0 :     virtual sal_Bool EvaluateGroup( DXFGroupReader & /*rDGR*/ ){ return sal_True; };
     386             : 
     387             :     protected :
     388             : 
     389           0 :         DXFEdgeType( sal_Int32 EdgeType ):nEdgeType(EdgeType){};
     390             : };
     391             : struct DXFEdgeTypeLine : public DXFEdgeType
     392             : {
     393             :     DXFVector aStartPoint;              // 10,20
     394             :     DXFVector aEndPoint;                // 11,21
     395             :     DXFEdgeTypeLine();
     396             :     virtual ~DXFEdgeTypeLine();
     397             :     virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR ) SAL_OVERRIDE;
     398             : };
     399             : struct DXFEdgeTypeCircularArc : public DXFEdgeType
     400             : {
     401             :     DXFVector aCenter;                  // 10,20
     402             :     double    fRadius;                  // 40
     403             :     double    fStartAngle;              // 50
     404             :     double    fEndAngle;                // 51
     405             :     sal_Int32 nIsCounterClockwiseFlag;  // 73
     406             :     DXFEdgeTypeCircularArc();
     407             :     virtual ~DXFEdgeTypeCircularArc();
     408             :     virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR ) SAL_OVERRIDE;
     409             : };
     410             : struct DXFEdgeTypeEllipticalArc : public DXFEdgeType
     411             : {
     412             :     DXFVector aCenter;                  // 10,20
     413             :     DXFVector aEndPoint;                // 11,21
     414             :     double    fLength;                  // 40
     415             :     double    fStartAngle;              // 50
     416             :     double    fEndAngle;                // 51
     417             :     sal_Int32 nIsCounterClockwiseFlag;  // 73
     418             : 
     419             :     DXFEdgeTypeEllipticalArc();
     420             :     virtual ~DXFEdgeTypeEllipticalArc();
     421             :     virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR ) SAL_OVERRIDE;
     422             : };
     423             : struct DXFEdgeTypeSpline : public DXFEdgeType
     424             : {
     425             :     sal_Int32 nDegree;                  // 94
     426             :     sal_Int32 nRational;                // 73
     427             :     sal_Int32 nPeriodic;                // 74
     428             :     sal_Int32 nKnotCount;               // 75
     429             :     sal_Int32 nControlCount;            // 76
     430             : 
     431             :     DXFEdgeTypeSpline();
     432             :     virtual ~DXFEdgeTypeSpline();
     433             :     virtual sal_Bool EvaluateGroup( DXFGroupReader & rDGR ) SAL_OVERRIDE;
     434             : };
     435             : 
     436             : typedef std::deque< DXFEdgeType* > DXFEdgeTypeArray;
     437             : 
     438             : struct DXFBoundaryPathData
     439             : {
     440             :     sal_Int32           nFlags;                 // 92
     441             :     sal_Int32           nHasBulgeFlag;          // 72
     442             :     sal_Int32           nIsClosedFlag;          // 73
     443             :     sal_Int32           nPointCount;            // 93
     444             :     double              fBulge;                 // 42
     445             :     sal_Int32           nSourceBoundaryObjects; // 97
     446             :     sal_Int32           nEdgeCount;             // 93
     447             : 
     448             :     sal_Bool            bIsPolyLine;
     449             :     sal_Int32           nPointIndex;
     450             : 
     451             :     DXFVector*          pP;
     452             :     DXFEdgeTypeArray    aEdges;
     453             : 
     454             :     DXFBoundaryPathData();
     455             :     ~DXFBoundaryPathData();
     456             : 
     457             :     sal_Bool EvaluateGroup( DXFGroupReader & rDGR );
     458             : };
     459             : 
     460             : class DXFHatchEntity : public DXFBasicEntity
     461             : {
     462             :         sal_Bool    bIsInBoundaryPathContext;
     463             :         sal_Int32   nCurrentBoundaryPathIndex;
     464             : 
     465             :     public :
     466             : 
     467             :         DXFVector   aElevationPoint;
     468             :         sal_Int32   nFlags;                         // 70 (solid fill = 1, pattern fill = 0)
     469             :         sal_Int32   nAssociativityFlag;             // 71 (assoiciative = 1, non-associative = 0)
     470             :         sal_Int32   nBoundaryPathCount;             // 91
     471             :         sal_Int32   nHatchStyle;                    // 75 (odd parity = 0, outmost area = 1, entire area = 2 )
     472             :         sal_Int32   nHatchPatternType;              // 76 (user defined = 0, predefined = 1, custom = 2)
     473             :         double      fHatchPatternAngle;             // 52 (pattern fill only)
     474             :         double      fHatchPatternScale;             // 41 (pattern fill only:scale or spacing)
     475             :         sal_Int32   nHatchDoubleFlag;               // 77 (pattern fill only:double = 1, not double = 0)
     476             :         sal_Int32   nHatchPatternDefinitionLines;   // 78
     477             :         double      fPixelSize;                     // 47
     478             :         sal_Int32   nNumberOfSeedPoints;            // 98
     479             : 
     480             :         DXFBoundaryPathData* pBoundaryPathData;
     481             : 
     482             :         DXFHatchEntity();
     483             :         virtual ~DXFHatchEntity();
     484             : 
     485             :     protected :
     486             : 
     487             :         virtual void EvaluateGroup( DXFGroupReader & rDGR ) SAL_OVERRIDE;
     488             : };
     489             : 
     490             : 
     491             : //--------------------------Vertex----------------------------------------------
     492             : 
     493           0 : class DXFVertexEntity : public DXFBasicEntity {
     494             : 
     495             : public:
     496             : 
     497             :     DXFVector aP0;     // 10,20,30
     498             :     double fSWidth;    // 40 (if <0.0, then one has DXFPolyLine::fSWidth)
     499             :     double fEWidth;    // 41 (if <0.0, then one has DXFPolyLine::fEWidth)
     500             :     double fBulge;     // 42
     501             :     long nFlags;       // 70
     502             :     double fCFTDir;    // 50
     503             : 
     504             :     DXFVertexEntity();
     505             : 
     506             : protected:
     507             : 
     508             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     509             : };
     510             : 
     511             : //--------------------------SeqEnd----------------------------------------------
     512             : 
     513           0 : class DXFSeqEndEntity : public DXFBasicEntity {
     514             : 
     515             : public:
     516             : 
     517             :     DXFSeqEndEntity();
     518             : };
     519             : 
     520             : //--------------------------3DFace----------------------------------------------
     521             : 
     522           0 : class DXF3DFaceEntity : public DXFBasicEntity {
     523             : 
     524             : public:
     525             : 
     526             :     DXFVector aP0; // 10,20,30
     527             :     DXFVector aP1; // 11,21,31
     528             :     DXFVector aP2; // 12,22,32
     529             :     DXFVector aP3; // 13,23,33
     530             :     long nIEFlags; // 70
     531             : 
     532             :     DXF3DFaceEntity();
     533             : 
     534             : protected:
     535             : 
     536             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     537             : };
     538             : 
     539             : //--------------------------Dimension-------------------------------------------
     540             : 
     541           0 : class DXFDimensionEntity : public DXFBasicEntity {
     542             : 
     543             : public:
     544             : 
     545             :     OString m_sPseudoBlock;                  //  2
     546             : 
     547             :     DXFDimensionEntity();
     548             : 
     549             : protected:
     550             : 
     551             :     virtual void EvaluateGroup(DXFGroupReader & rDGR) SAL_OVERRIDE;
     552             : };
     553             : 
     554             : 
     555             : //----------------- read and represent the set of entities ---------------------
     556             : 
     557             : 
     558             : class DXFEntities {
     559             : 
     560             : public:
     561             : 
     562             :     DXFEntities();
     563             :     ~DXFEntities();
     564             : 
     565             :     DXFBasicEntity * pFirst; // list of entities, READ ONLY!
     566             : 
     567             :     void Read(DXFGroupReader & rDGR);
     568             :         // read entities per rGDR of a DXF file untill a
     569             :         // ENDBLK, ENDSEC oder EOF (of group 0).
     570             :         // (all unknown thing will be skipped)
     571             : 
     572             :     void Clear();
     573             :         // deletes all entities
     574             : };
     575             : 
     576             : 
     577             : //--------------------------------- inlines ------------------------------------
     578             : 
     579             : 
     580           0 : inline DXFEntities::DXFEntities()
     581             : {
     582           0 :     pFirst=NULL;
     583           0 : }
     584             : 
     585             : 
     586           0 : inline DXFEntities::~DXFEntities()
     587             : {
     588           0 :     Clear();
     589           0 : }
     590             : 
     591             : 
     592             : #endif
     593             : 
     594             : 
     595             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10