VR-Forces Development_Version Class Documentation
Home
Modules
Namespaces
Classes
Files
Examples
Behavior Models
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
include
gdb
gridPostList.h
Go to the documentation of this file.
1
/*********************************************************************
2
** Copyright (c) 1999 MaK Technologies, Inc.
3
** All rights reserved.
4
*********************************************************************/
5
/*********************************************************************
6
** $RCSfile: gridPstLst.h,v $ $Revision: 1.9 $ $State: Exp $
7
*********************************************************************/
8
9
#ifndef gridPostList_H_
10
#define gridPostList_H_
11
12
// include files
13
#include "
gdb/gdbDefines.h
"
14
#include "
gdb/baseVertexList.h
"
15
#include "
geometry/point.h
"
16
#include "
gdb/surfaceManager.h
"
17
21
typedef
enum
22
{
23
24
SW_NE_DIAGONAL
,
25
NW_SE_DIAGONAL
26
27
}
DtGridDiagonalType
;
28
29
30
// forward declarations
31
class
DtSurface
;
32
class
DtSurfaceManager
;
33
class
DtGroup
;
34
class
DtVertexManager
;
35
36
37
//
38
// class DtGridPostList:
39
//
40
// DtGridPostList is used to describe the terrain skin.
41
// Posts are uniformly spaced in the x and y directions.
42
// Diagonalization at posts runs southwest to northeast,
43
// or southeast to northwest. However, the convention is
44
// uniform for the entire database.
45
// At each post, the elevation of the terrain is
46
// specified. Also defined are the characterization of surfaces
47
// of the two triangles in the square that is to the NE of the
48
// post. The last row and the last column have no surface
49
// associations. They do have corresponding elevation data.
50
//
51
class
DT_DLL_gdb
DtGridPostList
:
public
DtBaseVertexList
52
{
53
public
:
54
55
// default constructor
56
DtGridPostList
();
57
58
// destructor
59
virtual
~
DtGridPostList
();
60
61
// additional constructor that specifies the origin of the grid
62
// post list, associated surface manager, post interval, width and
63
// height of the grid post list measured in posts, and the
64
// diagonalization of the database.
65
DtGridPostList
(
DtSurfaceManager
* surfaceManager,
66
const
DtPoint
o,
67
double
interval,
68
unsigned
int
pwide,
69
unsigned
int
phigh,
70
bool
swNeDiag);
71
72
// copy constructor
73
DtGridPostList
(
const
DtGridPostList
& orig);
74
75
// assignment operator
76
DtGridPostList
&
operator=
(
const
DtGridPostList
& orig);
77
78
// return the type of the node.
79
virtual
DtGdbNode::DtGdbNodeType
type
()
const
;
80
81
//accessor functions
82
83
// returns origin of grid post list
84
virtual
const
DtPoint
& origin()
const
;
85
86
// returns number of posts along x-axis
87
virtual
unsigned
int
width()
const
;
88
89
// returns number of posts along y-axis
90
virtual
unsigned
int
height()
const
;
91
92
// returns distance between adjacent posts in x- or y- direction.
93
virtual
double
interval()
const
;
94
95
// a grid post list may be diagonalized SW-NE or SE_NW. Returns the
96
// diagonalization associated with this grid post list.
97
virtual
DtGridDiagonalType
diagonal()
const
;
98
99
// used to set the diagonal from the value read from
100
// a GDB1.0 Grid Node; generally, it should not be used!
101
virtual
void
setDiagonal(
bool
diag);
102
103
// returns array of elevations associated with the grid post list
104
virtual
double
* elevations()
const
;
105
106
// returns a pointer to the surface manager associated with the grid post list
107
virtual
DtSurfaceManager
* surfaces()
const
;
108
109
// sets the surface list associated with the grid post list
110
virtual
void
setSurfaceManager(
DtSurfaceManager
* surfMgr);
111
112
// returns index into surface list associated with triangle 0 (top-left
113
// for SW-NE, bottom-left for SE_NW) for post n.
114
virtual
unsigned
int
tri0Surface(
unsigned
int
n)
const
;
115
116
// returns index into surface list associated with triangle 1 (bottom-right
117
// for SW-NE, top-right for SE_NW) for post n.
118
virtual
unsigned
int
tri1Surface(
unsigned
int
n)
const
;
119
120
// get the i-th vertex of gridpost list
121
virtual
DtPoint
vertex
(
unsigned
int
i)
const
;
122
123
// return the i-th vertex of gridpost list in retVal
124
virtual
bool
getVertex
(
DtPoint
& retVal,
unsigned
int
i)
const
;
125
126
//access the surface description of Triangle0(SW)? at postnum.
127
virtual
DtSurface
& getTri0Surface(
unsigned
int
postnum)
const
;
128
129
//access the surface description of Triangle1(NE)? at postnum.
130
virtual
DtSurface
& getTri1Surface(
unsigned
int
postnum)
const
;
131
132
// This function is used when elevations are specified sequentially.
133
// when you add a grid post, should you specify elevation and
134
// and surface indices for the next post?? -- RVK
135
virtual
unsigned
int
addGridPost(
double
elevation);
136
137
// set the elevation at postnum as specified.
138
virtual
void
setElevation(
unsigned
int
postnum,
double
elevation);
139
140
// set the surface of Triangle0(top-left for SW-NE diagonal, bottom-left
141
// for SE-NW diagonal) at postnum.
142
virtual
void
setTri0Surface(
unsigned
int
postnum,
DtSurfaceID
surfaceID,
bool
check =
true
);
143
144
// set the surface of Triangle1(bottom-right if SW-NE diagonal, top-right
145
// for SE-NW diagonal) at postnum.
146
virtual
void
setTri1Surface(
unsigned
int
postnum,
DtSurfaceID
surfaceID,
bool
check =
true
);
147
148
// determines if postNum is the last grid post of a row
149
virtual
bool
isLastGridpostOfRow(
unsigned
int
pnum)
const
;
150
151
// determines if postNum is the last grid post of a column
152
virtual
bool
isLastGridpostOfColumn(
unsigned
int
pnum)
const
;
153
154
// Triangulates the gridpostlist returning 2 * (height - 1) * (width - 1)
155
// triangles as children of the specified group.
156
// Needs the terrain database for vertex manager and surface manager pointers
157
// Uses the specified vertex manager and sets the triangles to reference
158
// the same SurfaceManager that this class references.
159
// Returns false if triangulation failed for any reason.
160
virtual
bool
triangulate(
DtGroup
& parent,
DtTerrainDatabase
* terrainDatabase)
const
;
161
162
//debugging aid function
163
virtual
void
dump
(
int
indentLevel)
const
;
164
165
virtual
int
sizeInBytes
()
const
;
166
167
protected
:
168
169
virtual
unsigned
int
* tri0Surfaces()
const
;
170
virtual
unsigned
int
* tri1Surfaces()
const
;
171
172
protected
:
173
174
DtPoint
myOrigin
;
175
unsigned
int
myWidthInPosts
;
176
unsigned
int
myHeightInPosts
;
177
double
myPostInterval
;
178
bool
mySwNeDiag
;
179
180
// Dynamically allocated array of elevations.
181
double
*
myElevationList
;
182
183
// my list of surfaces
184
mutable
DtSurfaceManager
*
mySurfaceManager
;
185
186
// Dynamically allocated array of surface indices for
187
// left triangle
188
unsigned
int
*
myTri0Surfaces
;
189
190
// Dynamically allocated array of surface indices for
191
// triangle to the right.
192
unsigned
int
*
myTri1Surfaces
;
193
};
194
195
199
200
inline
DtGdbNode::DtGdbNodeType
DtGridPostList::type
()
const
201
{
202
return
(
DtGdbNode::GRIDPOST_LIST
);
203
}
204
205
inline
const
DtPoint
&
DtGridPostList::origin
()
const
206
{
207
return
myOrigin
;
208
}
209
210
inline
unsigned
int
DtGridPostList::width
()
const
211
{
212
return
myWidthInPosts
;
213
}
214
215
inline
unsigned
int
DtGridPostList::height
()
const
216
{
217
return
myHeightInPosts
;
218
}
219
220
inline
double
DtGridPostList::interval
()
const
221
{
222
return
myPostInterval
;
223
}
224
225
inline
DtGridDiagonalType
DtGridPostList::diagonal
()
const
226
{
227
if
(
mySwNeDiag
)
228
return
(
SW_NE_DIAGONAL
);
229
else
230
return
(
NW_SE_DIAGONAL
);
231
}
232
233
inline
void
DtGridPostList::setDiagonal
(
bool
diag)
234
{
235
mySwNeDiag
= diag;
236
}
237
238
inline
double
*
DtGridPostList::elevations
()
const
239
{
240
return
myElevationList
;
241
}
242
243
inline
DtSurfaceManager
*
DtGridPostList::surfaces
()
const
244
{
245
return
mySurfaceManager
;
246
}
247
248
inline
void
DtGridPostList::setSurfaceManager
(
DtSurfaceManager
* surfMgr)
249
{
250
mySurfaceManager
= surfMgr;
251
}
252
253
inline
unsigned
int
*
DtGridPostList::tri0Surfaces
()
const
254
{
255
return
myTri0Surfaces
;
256
}
257
258
inline
unsigned
int
*
DtGridPostList::tri1Surfaces
()
const
259
{
260
return
myTri1Surfaces
;
261
}
262
263
#endif
Document ID: Generated on Mon Jul 4 01:00:18 EDT 2016 from SVN revision 166489
Copyright © 2005-2015 VT MÄK. All Rights Reserved (
www.mak.com
)