libopencad
r2000.h
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 NextGIS, <info@nextgis.com>
12  *
13  * Permission is hereby granted, free of charge, to any person obtaining a copy
14  * of this software and associated documentation files (the "Software"), to deal
15  * in the Software without restriction, including without limitation the rights
16  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
17  * copies of the Software, and to permit persons to whom the Software is
18  * furnished to do so, subject to the following conditions:
19  *
20  * The above copyright notice and this permission notice shall be included in all
21  * copies or substantial portions of the Software.
22  *
23  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
24  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
25  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
26  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
27  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
28  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29  * SOFTWARE.
30  *******************************************************************************/
31 
32 #ifndef DWG_R2000_H_H
33 #define DWG_R2000_H_H
34 
35 #include "cadfile.h"
36 
38 {
39  char byRecordNumber = 0;
40  int dSeeker = 0;
41  int dSize = 0;
42 };
43 
44 struct DWG2000Ced
45 {
46  long dLength;
47  short dType;
48  int dObjSizeInBits;
49  CADHandle hHandle;
50  CADEedArray eEED;
51  bool bGraphicPresentFlag;
52 
53  char dEntMode;
54  int dNumReactors;
55 
56  bool bNoLinks;
57  short dCMColorIndex;
58  double dfLtypeScale;
59 
60  char ltype_flags;
61  char plotstyle_flags;
62 
63  short dInvisibility;
64  char cLineWeight;
65 };
66 
68 {
69  CADHandle hOwner;
70  CADHandle hReactors;
71  CADHandle hxdibobjhandle;
72  CADHandle hprev_entity, hnext_entity;
73  CADHandle hlayer;
74  CADHandle hltype;
75  CADHandle hplotstyle;
76 };
77 
78 class DWGFileR2000 : public CADFile
79 {
80 public:
81  DWGFileR2000(CADFileIO* poFileIO);
82  virtual ~DWGFileR2000();
83 
84 protected:
85  virtual int readSectionLocator() override;
86  virtual int readHeader(enum OpenOptions eOptions) override;
87  virtual int readClasses(enum OpenOptions eOptions) override;
88  virtual int createFileMap() override;
89 
90  CADObject * getObject(long index, bool bHandlesOnly = false) override;
91  CADGeometry * getGeometry(long index) override;
92 protected:
93  CADBlockObject *getBlock(long dObjectSize, CADCommonED stCommonEntityData,
94  const char *pabyInput, size_t &nBitOffsetFromStart);
95  CADEllipseObject *getEllipse(long dObjectSize, CADCommonED stCommonEntityData,
96  const char *pabyInput, size_t &nBitOffsetFromStart);
97  CADSolidObject *getSolid(long dObjectSize, CADCommonED stCommonEntityData,
98  const char *pabyInput, size_t &nBitOffsetFromStart);
99  CADPointObject *getPoint(long dObjectSize, CADCommonED stCommonEntityData,
100  const char *pabyInput, size_t &nBitOffsetFromStart);
101  CADPolyline3DObject *getPolyLine3D(long dObjectSize,
102  CADCommonED stCommonEntityData,
103  const char *pabyInput, size_t &nBitOffsetFromStart);
104  CADRayObject *getRay(long dObjectSize, CADCommonED stCommonEntityData,
105  const char *pabyInput, size_t &nBitOffsetFromStart);
106  CADXLineObject *getXLine(long dObjectSize, CADCommonED stCommonEntityData,
107  const char *pabyInput, size_t &nBitOffsetFromStart);
108  CADLineObject *getLine(long dObjectSize, CADCommonED stCommonEntityData,
109  const char *pabyInput, size_t &nBitOffsetFromStart);
110  CADTextObject *getText(long dObjectSize, CADCommonED stCommonEntityData,
111  const char *pabyInput, size_t &nBitOffsetFromStart);
112  CADVertex3DObject *getVertex3D(long dObjectSize, CADCommonED stCommonEntityData,
113  const char *pabyInput, size_t &nBitOffsetFromStart);
114  CADCircleObject *getCircle(long dObjectSize, CADCommonED stCommonEntityData,
115  const char *pabyInput, size_t &nBitOffsetFromStart);
116  CADEndblkObject *getEndBlock(long dObjectSize, CADCommonED stCommonEntityData,
117  const char *pabyInput, size_t &nBitOffsetFromStart);
118  CADPolyline2DObject *getPolyline2D(long dObjectSize, CADCommonED stCommonEntityData,
119  const char *pabyInput, size_t &nBitOffsetFromStart);
120  CADAttribObject *getAttributes(long dObjectSize, CADCommonED stCommonEntityData,
121  const char *pabyInput, size_t &nBitOffsetFromStart);
122  CADAttdefObject *getAttributesDefn(long dObjectSize, CADCommonED stCommonEntityData,
123  const char *pabyInput, size_t &nBitOffsetFromStart);
124  CADLWPolylineObject *getLWPolyLine(long dObjectSize, CADCommonED stCommonEntityData,
125  const char *pabyInput, size_t &nBitOffsetFromStart);
126  CADArcObject *getArc(long dObjectSize, CADCommonED stCommonEntityData,
127  const char *pabyInput, size_t &nBitOffsetFromStart);
128  CADSplineObject *getSpline(long dObjectSize, CADCommonED stCommonEntityData,
129  const char *pabyInput, size_t &nBitOffsetFromStart);
130  CADEntityObject *getEntity(int dObjectType, long dObjectSize,
131  CADCommonED stCommonEntityData,
132  const char *pabyInput, size_t &nBitOffsetFromStart);
133  CADDictionaryObject *getDictionary(long dObjectSize,
134  const char *pabyInput, size_t &nBitOffsetFromStart);
135  CADLayerObject *getLayer(long dObjectSize,
136  const char *pabyInput, size_t &nBitOffsetFromStart);
137  CADLayerControlObject *getLayerControl(long dObjectSize,
138  const char *pabyInput, size_t &nBitOffsetFromStart);
139  CADBlockControlObject *getBlockControl(long dObjectSize,
140  const char *pabyInput, size_t &nBitOffsetFromStart);
141  CADBlockHeaderObject *getBlockHeader(long dObjectSize,
142  const char *pabyInput, size_t &nBitOffsetFromStart);
143  CADLineTypeControlObject *getLineTypeControl(long dObjectSize,
144  const char *pabyInput, size_t &nBitOffsetFromStart);
145  CADLineTypeObject *getLineType1(long dObjectSize,
146  const char *pabyInput, size_t &nBitOffsetFromStart);
147  CADMLineObject *getMLine(long dObjectSize, CADCommonED stCommonEntityData,
148  const char *pabyInput, size_t &nBitOffsetFromStart);
149  CADPolylinePFaceObject *getPolylinePFace(long dObjectSize,
150  CADCommonED stCommonEntityData,
151  const char *pabyInput,
152  size_t &nBitOffsetFromStart);
153  CADImageObject *getImage(long dObjectSize, CADCommonED stCommonEntityData,
154  const char *pabyInput, size_t &nBitOffsetFromStart);
155  CAD3DFaceObject *get3DFace(long dObjectSize, CADCommonED stCommonEntityData,
156  const char *pabyInput, size_t &nBitOffsetFromStart);
157  CADVertexMeshObject *getVertexMesh(long dObjectSize, CADCommonED stCommonEntityData,
158  const char *pabyInput, size_t &nBitOffsetFromStart);
159  CADVertexPFaceObject *getVertexPFace(long dObjectSize, CADCommonED stCommonEntityData,
160  const char *pabyInput, size_t &nBitOffsetFromStart);
161  CADDimensionObject *getDimension(short dObjectType, long dObjectSize,
162  CADCommonED stCommonEntityData,
163  const char *pabyInput,
164  size_t &nBitOffsetFromStart);
165  CADMTextObject *getMText(long dObjectSize, CADCommonED stCommonEntityData,
166  const char *pabyInput, size_t &nBitOffsetFromStart);
167  CADImageDefObject *getImageDef(long dObjectSize,
168  const char *pabyInput, size_t &nBitOffsetFromStart);
169  CADImageDefReactorObject *getImageDefReactor(long dObjectSize,
170  const char *pabyInput,
171  size_t &nBitOffsetFromStart);
172 protected:
173  int imageSeeker;
174  std::vector<SectionLocatorRecord> sectionLocatorRecords;
175 };
176 
177 #endif // DWG_R2000_H_H
The CAD Block Object class.
Definition: cadobjects.h:361
Definition: cadheader.h:39
The CAD3DFaceObject class.
Definition: cadobjects.h:1166
The CADVertexPFaceObject class.
Definition: cadobjects.h:478
The CADVertex3DObject class.
Definition: cadobjects.h:457
The CADArc class.
Definition: cadobjects.h:542
The CADPolyline3DObject class.
Definition: cadobjects.h:525
The CAD Attribute definition Object class.
Definition: cadobjects.h:351
Base CAD geometry class.
Definition: cadgeometry.h:46
The CADCircleObject class.
Definition: cadobjects.h:557
The CADLWPolylineObject class.
Definition: cadobjects.h:852
OpenOptions
The CAD file open options enum.
Definition: cadfile.h:51
The CADSolidObject class.
Definition: cadobjects.h:772
The base CAD object class.
Definition: cadobjects.h:82
The CAD End block Object class.
Definition: cadobjects.h:372
The CADPolylinePFaceObject class.
Definition: cadobjects.h:1180
The CADLineTypeObject class.
Definition: cadobjects.h:728
Definition: r2000.h:78
The CADImageObject class.
Definition: cadobjects.h:1025
The CADCommonED struct.
Definition: cadobjects.h:229
The CADMLineObject class.
Definition: cadobjects.h:1145
The CADImageDefObject class.
Definition: cadobjects.h:1078
The CAD Text Object class.
Definition: cadobjects.h:296
The CADLayerObject class.
Definition: cadobjects.h:662
The CADLayerControlObject class.
Definition: cadobjects.h:643
The CADFileIO class provides in/out file operations as read, write, seek, etc. This is abstract class...
Definition: cadfileio.h:40
The CADXLineObject class.
Definition: cadobjects.h:814
The CADSplineObject class.
Definition: cadobjects.h:870
The CADImageDefReactorObject class.
Definition: cadobjects.h:1059
The CADMTextObject class.
Definition: cadobjects.h:1095
The CADEllipseObject class.
Definition: cadobjects.h:786
Definition: r2000.h:67
The CAD Attribute Object class.
Definition: cadobjects.h:321
Definition: r2000.h:37
The CADVertexMesh class.
Definition: cadobjects.h:468
The CADLineTypeControlObject class.
Definition: cadobjects.h:697
The CADRayObject class.
Definition: cadobjects.h:802
The CADLineObject class.
Definition: cadobjects.h:570
Definition: r2000.h:44
The CADDictionaryObject class.
Definition: cadobjects.h:826
Definition: cadobjects.h:286
The CADBlockHeaderObject class.
Definition: cadobjects.h:601
The CADPolyline2DObject class.
Definition: cadobjects.h:502
The abstact CAD file class.
Definition: cadfile.h:43
The CADBlockControlObject class.
Definition: cadobjects.h:583
The CADPointObject class.
Definition: cadobjects.h:758
The CADDimensionObject class.
Definition: cadobjects.h:933