Line data Source code
1 : /*******************************************************************************
2 : * Project: libopencad
3 : * Purpose: OpenSource CAD formats support library
4 : * Author: Alexandr Borzykh, mush3d at gmail.com
5 : * Author: Dmitry Baryshnikov, bishop.dev@gmail.com
6 : * Language: C++
7 : *******************************************************************************
8 : * The MIT License (MIT)
9 : *
10 : * Copyright (c) 2016 Alexandr Borzykh
11 : * Copyright (c) 2016-2018 NextGIS, <info@nextgis.com>
12 : *
13 : * SPDX-License-Identifier: MIT
14 : *******************************************************************************/
15 : #ifndef DWG_R2000_H_H
16 : #define DWG_R2000_H_H
17 :
18 : #include "cadfile.h"
19 : #include "io.h"
20 :
21 : struct SectionLocatorRecord
22 : {
23 : char byRecordNumber = 0;
24 : int dSeeker = 0;
25 : int dSize = 0;
26 : };
27 :
28 : struct DWG2000Ced
29 : {
30 : long dLength;
31 : short dType;
32 : int dObjSizeInBits;
33 : CADHandle hHandle;
34 : CADEedArray eEED;
35 : bool bGraphicPresentFlag;
36 :
37 : char dEntMode;
38 : int dNumReactors;
39 :
40 : bool bNoLinks;
41 : short dCMColorIndex;
42 : double dfLtypeScale;
43 :
44 : char ltype_flags;
45 : char plotstyle_flags;
46 :
47 : short dInvisibility;
48 : char cLineWeight;
49 : };
50 :
51 : struct DWG2000Cehd
52 : {
53 : CADHandle hOwner;
54 : CADHandle hReactors;
55 : CADHandle hxdibobjhandle;
56 : CADHandle hprev_entity, hnext_entity;
57 : CADHandle hlayer;
58 : CADHandle hltype;
59 : CADHandle hplotstyle;
60 : };
61 :
62 : class DWGFileR2000 : public CADFile
63 : {
64 : public:
65 : explicit DWGFileR2000( CADFileIO * poFileIO );
66 16 : virtual ~DWGFileR2000() = default;
67 :
68 : protected:
69 : virtual int ReadSectionLocators() override;
70 : virtual int ReadHeader( enum OpenOptions eOptions ) override;
71 : virtual int ReadClasses( enum OpenOptions eOptions ) override;
72 : virtual int CreateFileMap() override;
73 :
74 : CADObject * GetObject( long dHandle, bool bHandlesOnly = false ) override;
75 : CADGeometry * GetGeometry( size_t iLayerIndex, long dHandle,
76 : long dBlockRefHandle = 0 ) override;
77 :
78 : CADDictionary GetNOD() override;
79 : protected:
80 : CADBlockObject * getBlock(unsigned int dObjectSize,
81 : const CADCommonED& stCommonEntityData,
82 : CADBuffer& buffer);
83 : CADEllipseObject * getEllipse(unsigned int dObjectSize,
84 : const CADCommonED& stCommonEntityData,
85 : CADBuffer &buffer);
86 : CADSolidObject * getSolid( unsigned int dObjectSize,
87 : const CADCommonED& stCommonEntityData,
88 : CADBuffer& buffer);
89 : CADPointObject * getPoint(unsigned int dObjectSize,
90 : const CADCommonED& stCommonEntityData,
91 : CADBuffer &buffer);
92 : CADPolyline3DObject * getPolyLine3D(unsigned int dObjectSize,
93 : const CADCommonED& stCommonEntityData,
94 : CADBuffer &buffer);
95 : CADRayObject * getRay( unsigned int dObjectSize,
96 : const CADCommonED& stCommonEntityData,
97 : CADBuffer &buffer);
98 : CADXLineObject * getXLine( unsigned int dObjectSize,
99 : const CADCommonED& stCommonEntityData,
100 : CADBuffer &buffer );
101 : CADLineObject * getLine( unsigned int dObjectSize,
102 : const CADCommonED& stCommonEntityData,
103 : CADBuffer &buffer );
104 : CADTextObject * getText( unsigned int dObjectSize,
105 : const CADCommonED& stCommonEntityData,
106 : CADBuffer &buffer );
107 : CADVertex3DObject * getVertex3D( unsigned int dObjectSize,
108 : const CADCommonED& stCommonEntityData,
109 : CADBuffer &buffer );
110 : CADCircleObject * getCircle( unsigned int dObjectSize,
111 : const CADCommonED& stCommonEntityData,
112 : CADBuffer &buffer );
113 : CADEndblkObject * getEndBlock( unsigned int dObjectSize,
114 : const CADCommonED& stCommonEntityData,
115 : CADBuffer &buffer );
116 : CADPolyline2DObject * getPolyline2D( unsigned int dObjectSize,
117 : const CADCommonED& stCommonEntityData,
118 : CADBuffer &buffer );
119 : CADAttribObject * getAttributes( unsigned int dObjectSize,
120 : const CADCommonED& stCommonEntityData,
121 : CADBuffer &buffer );
122 : CADAttdefObject * getAttributesDefn( unsigned int dObjectSize,
123 : const CADCommonED& stCommonEntityData,
124 : CADBuffer &buffer );
125 : CADLWPolylineObject * getLWPolyLine( unsigned int dObjectSize,
126 : const CADCommonED& stCommonEntityData,
127 : CADBuffer &buffer );
128 : CADArcObject * getArc( unsigned int dObjectSize,
129 : const CADCommonED& stCommonEntityData,
130 : CADBuffer &buffer );
131 : CADSplineObject * getSpline( unsigned int dObjectSize,
132 : const CADCommonED& stCommonEntityData,
133 : CADBuffer &buffer );
134 : CADEntityObject * getEntity( int dObjectType, unsigned int dObjectSize,
135 : const CADCommonED& stCommonEntityData,
136 : CADBuffer &buffer );
137 : CADInsertObject * getInsert( int dObjectType, unsigned int dObjectSize,
138 : const CADCommonED& stCommonEntityData,
139 : CADBuffer &buffer );
140 : CADDictionaryObject * getDictionary( unsigned int dObjectSize,
141 : CADBuffer &buffer );
142 : CADXRecordObject * getXRecord( unsigned int dObjectSize,
143 : CADBuffer &buffer );
144 : CADLayerObject * getLayerObject( unsigned int dObjectSize,
145 : CADBuffer &buffer );
146 : CADLayerControlObject * getLayerControl( unsigned int dObjectSize,
147 : CADBuffer &buffer );
148 : CADBlockControlObject * getBlockControl( unsigned int dObjectSize,
149 : CADBuffer &buffer );
150 : CADBlockHeaderObject * getBlockHeader( unsigned int dObjectSize,
151 : CADBuffer &buffer );
152 : CADLineTypeControlObject * getLineTypeControl( unsigned int dObjectSize,
153 : CADBuffer &buffer );
154 : CADLineTypeObject * getLineType1( unsigned int dObjectSize,
155 : CADBuffer &buffer );
156 : CADMLineObject * getMLine( unsigned int dObjectSize,
157 : const CADCommonED& stCommonEntityData,
158 : CADBuffer &buffer );
159 : CADPolylinePFaceObject * getPolylinePFace( unsigned int dObjectSize,
160 : const CADCommonED& stCommonEntityData,
161 : CADBuffer &buffer );
162 : CADImageObject * getImage( unsigned int dObjectSize,
163 : const CADCommonED& stCommonEntityData,
164 : CADBuffer &buffer );
165 : CAD3DFaceObject * get3DFace( unsigned int dObjectSize,
166 : const CADCommonED& stCommonEntityData,
167 : CADBuffer &buffer );
168 : CADVertexMeshObject * getVertexMesh( unsigned int dObjectSize,
169 : const CADCommonED& stCommonEntityData,
170 : CADBuffer &buffer );
171 : CADVertexPFaceObject * getVertexPFace( unsigned int dObjectSize,
172 : const CADCommonED& stCommonEntityData,
173 : CADBuffer &buffer );
174 : CADDimensionObject * getDimension( short dObjectType, unsigned int dObjectSize,
175 : const CADCommonED& stCommonEntityData,
176 : CADBuffer &buffer );
177 : CADMTextObject * getMText( unsigned int dObjectSize,
178 : const CADCommonED& stCommonEntityData,
179 : CADBuffer &buffer );
180 : CADImageDefObject * getImageDef( unsigned int dObjectSize,
181 : CADBuffer &buffer );
182 : CADImageDefReactorObject * getImageDefReactor( unsigned int dObjectSize,
183 : CADBuffer &buffer );
184 : void fillCommonEntityHandleData(CADEntityObject * pEnt, CADBuffer &buffer);
185 : unsigned short validateEntityCRC(CADBuffer& buffer, unsigned int dObjectSize,
186 : const char * entityName = "ENTITY",
187 : bool bSwapEndianness = false );
188 : bool readBasicData(CADBaseControlObject * pBaseControlObject,
189 : unsigned int dObjectSize,
190 : CADBuffer &buffer);
191 : protected:
192 : int imageSeeker;
193 : std::vector<SectionLocatorRecord> sectionLocatorRecords;
194 : };
195 :
196 : #endif // DWG_R2000_H_H
|