dime  0.9.1
Portable DXF file library
Loading...
Searching...
No Matches
Insert.h
1/**************************************************************************\
2 * Copyright (c) Kongsberg Oil & Gas Technologies AS
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met:
8 *
9 * Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution.
15 *
16 * Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31\**************************************************************************/
32
33#ifndef DIME_INSERT_H
34#define DIME_INSERT_H
35
36#include <dime/Basic.h>
37#include <dime/entities/Entity.h>
38#include <dime/util/Linear.h>
39
40class dimeBlock;
41
42class DIME_DLL_API dimeInsert : public dimeEntity
43{
44 friend class dimeEntitiesSection;
45 friend class dimeBlocksSection;
46
47public:
48 dimeInsert();
49 virtual ~dimeInsert();
50
51 void setBlock(dimeBlock * const block);
52 dimeBlock * getBlock() const;
53
54 virtual dimeEntity *copy(dimeModel * const model) const;
55 virtual bool getRecord(const int groupcode,
56 dimeParam &param,
57 const int index = 0) const;
58 virtual const char *getEntityName() const;
59
60 virtual bool read(dimeInput * const in);
61 virtual bool write(dimeOutput * const out);
62 virtual int typeId() const;
63 virtual int countRecords() const;
64
65 void setInsertionPoint(const dimeVec3f &v);
66 const dimeVec3f &getInsertionPoint() const;
67
68 void setScale(const dimeVec3f &v);
69 const dimeVec3f & getScale() const;
70
71 void setRotAngle(dxfdouble angle);
72 dxfdouble getRotAngle() const;
73
74 // FIXME: more set and get methods
75
76protected:
77 virtual void fixReferences(dimeModel * const model);
78 virtual bool handleRecord(const int groupcode,
79 const dimeParam &param,
80 dimeMemHandler * const memhandler);
81 virtual bool traverse(const dimeState * const state,
82 dimeCallback callback,
83 void *userdata);
84
85private:
86 void makeMatrix(dimeMatrix &m) const;
87
88 int16 attributesFollow;
89 const char *blockName;
90 dimeVec3f insertionPoint;
91 dimeVec3f extrusionDir;
92 dimeVec3f scale;
93 dxfdouble rotAngle;
94 dimeEntity **entities;
95 int numEntities;
96#ifdef DIME_FIXBIG
97 int32 rowCount;
98#else
99 int16 rowCount;
100#endif
101 int16 columnCount;
102 dxfdouble rowSpacing;
103 dxfdouble columnSpacing;
104 dimeEntity *seqend;
105 dimeBlock *block;
106
107}; // class dimeInsert
108
109
110
111inline void
112dimeInsert::setInsertionPoint(const dimeVec3f &v)
113{
114 this->insertionPoint = v;
115}
116
117inline const dimeVec3f &
118dimeInsert::getInsertionPoint() const
119{
120 return this->insertionPoint;
121}
122
123inline dimeBlock *
124dimeInsert::getBlock() const
125{
126 return this->block;
127}
128
129inline void
130dimeInsert::setScale(const dimeVec3f &v)
131{
132 this->scale = v;
133}
134
135inline const dimeVec3f &
136dimeInsert::getScale() const
137{
138 return this->scale;
139}
140
141inline void
142dimeInsert::setRotAngle(dxfdouble angle)
143{
144 this->rotAngle = angle;
145}
146
147inline dxfdouble
148dimeInsert::getRotAngle() const
149{
150 return this->rotAngle;
151}
152
153
154#endif // ! DIME_INSERT_H
155
virtual int typeId() const =0
The dimeBlock class handles a BLOCK entity.
Definition Block.h:46
The dimeBlocksSection class handles a BLOCKS section.
Definition BlocksSection.h:40
The dimeEntitiesSection class handles an ENTITIES section.
Definition EntitiesSection.h:40
The dimeEntity class is the superclass of all entity classes.
Definition Entity.h:61
virtual bool getRecord(const int groupcode, dimeParam &param, const int index=0) const
Definition Entity.cpp:715
virtual bool write(dimeOutput *const out)
Definition Entity.cpp:271
virtual void fixReferences(dimeModel *const model)
Definition Entity.cpp:476
virtual bool read(dimeInput *const in)
Definition Entity.cpp:612
virtual const char * getEntityName() const =0
virtual int countRecords() const
Definition Entity.cpp:526
virtual bool handleRecord(const int groupcode, const dimeParam &param, dimeMemHandler *const memhandler)
Definition Entity.cpp:659
virtual dimeEntity * copy(dimeModel *const model) const =0
virtual bool traverse(const dimeState *const state, dimeCallback callback, void *userdata)
Definition Entity.cpp:541
The dimeInput class offers transparent file I/O for DXF and DXB.
Definition Input.h:42
The dimeInsert class handles an INSERT entity.
Definition Insert.h:43
The dimeMatrix class is for containing and operating on a four-by-four matrix.
Definition Linear.h:159
The dimeMemHandler class is a special-purpose memory manager.
Definition MemHandler.h:39
The dimeModel class organizes a model.
Definition Model.h:55
The dimeOutput class handles writing of DXF and DXB files.
Definition Output.h:42
The dimeState class manages various state variables while the model is traversed.
Definition State.h:41
The dimeVec3f class is for containing and operating on a 3D vector / coordinate.
Definition Linear.h:62
The dimeParam class is a union of the different parameter types.
Definition Basic.h:102