http://www.coin3d.org/
http://www.kongsberg.com/kogt/
Main Page
Classes
Files
File List
include
dime
entities
Entity.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_ENTITY_H
34
#define DIME_ENTITY_H
35
36
#include <dime/Base.h>
37
#include <dime/Basic.h>
38
#include <dime/util/Array.h>
39
#include <dime/util/Linear.h>
40
#include <dime/RecordHolder.h>
41
42
43
// misc flag values used in entityFlags.
44
#define FLAG_DELETED 0x0001 // used by dimeEntity
45
#define FLAG_TMP_BUFFER_SET 0x0002 // see dimeEntity::read()
46
#define FLAG_VERTICES_FOLLOW 0x0004 // used by dimePolyline
47
#define FLAG_TAGGED 0x0008 // used by dimeEntity
48
#define FLAG_COLOR_NUMBER 0x0010 // signals a color number was read
49
#define FLAG_SUBCLASS_MARKER 0x0020 // will subclass marker need to be written
50
#define FLAG_HANDLE 0x0040 // entity has handle in RecordHolder
51
#define FLAG_ACAD_REACTORS 0x0080 // ACAD reactors in entity
52
#define FLAG_ACAD_XDICTIONARY 0x0100 // ACAD xdictionary in entity
53
#define FLAG_PAPERSPACE 0x0200 // entity is in paperspace
54
#define FLAG_LINETYPE 0x0400 // linetype specified in entity
55
#define FLAG_FIRST_FREE 0x0800 // use this if you want to define your own flags
56
57
class
dimeLayer
;
58
class
dimeModel
;
59
60
class
DIME_DLL_API
dimeEntity
:
public
dimeRecordHolder
61
{
62
friend
class
dimeEntitiesSection
;
63
friend
class
dimeModel
;
64
friend
class
dimePolyline
;
65
friend
class
dimeBlock
;
66
friend
class
dimeInsert
;
67
68
public
:
69
dimeEntity
();
70
virtual
~dimeEntity
();
71
72
int16 getEntityFlags()
const
;
73
void
setEntityFlags(
const
int16 flags);
74
75
int16
getColorNumber
()
const
;
76
void
setColorNumber
(
const
int16 c);
77
78
virtual
void
setLayer
(
const
dimeLayer
*
const
layer);
79
virtual
const
char
*
getEntityName
()
const
= 0;
80
81
const
dimeLayer
*
getLayer
()
const
;
82
const
char
*
getLayerName
()
const
;
83
84
virtual
dimeEntity
*
copy
(
dimeModel
*
const
model)
const
= 0;
85
virtual
bool
read
(
dimeInput
*
const
in);
86
virtual
bool
write
(
dimeOutput
*
const
out);
87
virtual
bool
isOfType
(
const
int
thetypeid)
const
;
88
virtual
int
countRecords
()
const
;
89
virtual
void
print()
const
{}
90
91
92
bool
isDeleted
()
const
;
93
void
setDeleted
(
const
bool
onOff =
true
);
94
95
bool
isTagged
()
const
;
96
void
setTagged
(
const
bool
onOff =
true
);
97
98
virtual
bool
getRecord
(
const
int
groupcode,
99
dimeParam
¶m,
100
const
int
index = 0)
const
;
101
102
enum
GeometryType {
103
NONE,
104
POLYGONS,
105
LINES,
106
POINTS
107
};
108
109
virtual
GeometryType
extractGeometry
(
dimeArray <dimeVec3f>
&verts,
110
dimeArray <int>
&indices,
111
dimeVec3f
&extrusionDir,
112
dxfdouble &thickness);
113
protected
:
114
115
bool
preWrite
(
dimeOutput
*
const
file);
116
117
virtual
bool
traverse
(
const
dimeState
*
const
state,
118
dimeCallback callback,
119
void
*userdata);
120
121
virtual
void
fixReferences
(
dimeModel
*
const
model);
122
virtual
bool
handleRecord
(
const
int
groupcode,
123
const
dimeParam
¶m,
124
dimeMemHandler
*
const
memhandler);
125
virtual
bool
shouldWriteRecord
(
const
int
groupcode)
const
;
126
127
public
:
128
static
dimeEntity
*
createEntity
(
const
char
*
const
name,
129
dimeMemHandler
*
const
memhandler = NULL);
130
static
bool
readEntities
(
dimeInput
*
const
file,
131
dimeArray <dimeEntity*>
&array,
132
const
char
*
const
stopat);
133
134
static
bool
copyEntityArray
(
const
dimeEntity
*
const
*
const
array,
135
const
int
nument,
136
dimeModel
*
const
model,
137
dimeArray <dimeEntity*>
&destarray);
138
static
dimeEntity
**
copyEntityArray
(
const
dimeEntity
*
const
*
const
array,
139
int
&nument,
140
dimeModel
*
const
model);
141
142
static
void
arbitraryAxis
(
const
dimeVec3f
&givenaxis,
dimeVec3f
&newaxis);
143
static
void
generateUCS
(
const
dimeVec3f
&givenaxis,
dimeMatrix
&m);
144
145
protected
:
146
bool
copyRecords
(
dimeEntity
*
const
entity,
dimeModel
*
const
model)
const
;
147
148
private
:
149
const
dimeLayer
*layer;
150
int16 entityFlags;
151
int16 colorNumber;
152
};
// class dimeEntity
153
154
inline
const
dimeLayer
*
155
dimeEntity::getLayer
()
const
156
{
157
return
this->layer;
158
}
159
160
inline
int16
161
dimeEntity::getColorNumber
()
const
162
{
163
return
this->colorNumber;
164
}
165
166
inline
void
167
dimeEntity::setColorNumber
(
const
int16 c)
168
{
169
this->colorNumber = c;
170
}
171
172
inline
int16
173
dimeEntity::getEntityFlags()
const
174
{
175
return
this->entityFlags;
176
}
177
178
inline
void
179
dimeEntity::setEntityFlags(
const
int16 flags)
180
{
181
this->entityFlags = flags;
182
}
183
184
185
186
#endif // ! DIME_ENTITY_H
187
Copyright © by
Kongsberg Oil & Gas Technologies
. All rights reserved.
Generated on Tue Nov 18 2014 14:22:40 for Dime by
Doxygen
1.8.1.2.