MAK RTIspy API Documentation for HLA Evolved
Home
Modules
Namespaces
Classes
Files
Examples
Libraries
File List
File Members
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Properties
Friends
Macros
Groups
Pages
libsrc
rtiAssistantApp
networkMapNode.h
Go to the documentation of this file.
1
/*******************************************************************************
2
** Copyright (c) 2012 MAK Technologies, Inc.
3
** All rights reserved.
4
*******************************************************************************/
5
6
#ifndef _networkMapNode_H_
7
#define _networkMapNode_H_
8
10
#include <math.h>
11
#include <vlutil/vlString.h>
12
#include <
iconAndTextureManager.h
>
13
15
struct
_vec2
16
{
17
float
x
;
18
float
y
;
19
};
20
22
#define RTI_NODE_SPEED 1.25
23
26
#define RTI_NODE_DEST_RANGE 0.008
27
28
class
DtNetworkMapNode
29
{
30
public
:
31
33
DtNetworkMapNode
();
34
36
DtNetworkMapNode
(
int
fedId,
const
MAKRti::DtString& federationName,
37
const
MAKRti::DtString& processName,
const
MAKRti::DtString& federateType,
38
const
MAKRti::DtString& federateName,
float
radius
);
39
41
DtNetworkMapNode
(
int
compId,
const
MAKRti::DtString& forwarderName,
int
port,
float
radius );
42
44
DtNetworkMapNode
(
int
compId,
const
MAKRti::DtString& execName,
float
radius );
45
47
virtual
~DtNetworkMapNode
() { };
48
50
inline
void
setTextureId
(
int
id
)
51
{
52
if
(
id
>= 0 )
53
textureId
= id;
54
}
55
57
inline
int
getTextureId
()
58
{
59
return
textureId
;
60
}
61
63
inline
void
setRadius
(
float
radius )
64
{
65
this->radius =
radius
;
66
}
67
69
inline
float
getRadius
()
70
{
71
return
radius
;
72
}
73
75
inline
int
getFederateId
()
76
{
77
return
federateId
;
78
}
79
81
void
update
(
float
delta );
82
84
inline
void
setDestination
(
const
_vec2
&dest )
85
{
86
destination
.
x
= dest.
x
;
87
destination
.
y
= dest.
y
;
88
}
89
91
inline
bool
isMoving
()
const
92
{
93
float
xDiff =
position
.
x
-
destination
.
x
;
94
float
yDiff =
position
.
y
-
destination
.
y
;
95
96
if
(xDiff < 0)
97
{
98
xDiff *= -1;
99
}
100
if
(yDiff < 0)
101
{
102
yDiff *= -1;
103
}
104
105
return
(xDiff >
RTI_NODE_DEST_RANGE
&&
106
yDiff >
RTI_NODE_DEST_RANGE
);
107
}
108
110
inline
const
_vec2
&
getPosition
()
const
{
return
position
; }
111
113
inline
void
setPosition
(
const
_vec2
&pos )
114
{
115
position
.
x
= pos.
x
;
116
position
.
y
= pos.
y
;
117
}
118
120
inline
void
resetTextureId
()
121
{
122
textureId
= -1;
123
}
124
126
inline
void
showWarning
()
127
{
128
textureId
=
DtWarningTexture
;
129
}
130
132
inline
void
showError
()
133
{
134
textureId
=
DtErrorTexture
;
135
}
136
137
// Show disconnect texture
138
inline
void
showDisconnect
()
139
{
140
textureId
=
DtDisconnectedTexture
;
141
}
142
inline
bool
isDisconnected
()
143
{
144
return
(
textureId
==
DtDisconnectedTexture
?
true
:
false
);
145
}
146
147
inline
void
showNotJoined
()
148
{
149
textureId
=
DtNotJoinedTexture
;
150
}
151
inline
bool
isNotJoined
()
152
{
153
return
(
textureId
==
DtNotJoinedTexture
?
true
:
false
);
154
}
155
157
inline
void
resetTouched
()
158
{
159
wasTouched
=
true
;
160
}
161
163
inline
void
clearTouched
()
164
{
165
wasTouched
=
false
;
166
}
167
169
inline
bool
isTouched
() {
return
wasTouched
; };
170
172
inline
void
setIsCentralForwarder
() {
isCentralForwarder
=
true
;
isPeerForwarder
=
false
;
isExec
=
false
;
isLightWeightCenter
=
false
; }
173
175
inline
bool
IsCentralForwarder
() {
return
isCentralForwarder
; }
176
178
inline
void
setIsPeerForwarder
() {
isPeerForwarder
=
true
;
isCentralForwarder
=
false
;
isExec
=
false
;
isLightWeightCenter
=
false
; }
179
181
inline
bool
IsPeerForwarder
() {
return
isPeerForwarder
; }
182
184
inline
void
setIsExec
() {
isExec
=
true
;
isPeerForwarder
=
false
;
isCentralForwarder
=
false
;
isLightWeightCenter
=
false
; }
185
187
inline
bool
IsExec
() {
return
isExec
; };
188
190
inline
void
setIsLightweightCenter
() {
isLightWeightCenter
=
true
;
isExec
=
false
;
isCentralForwarder
=
false
;
isPeerForwarder
=
false
; }
191
193
inline
bool
IsLightweightCenter
() {
return
isLightWeightCenter
; }
194
196
inline
bool
shouldBeDelete
() {
return
deleteMe
; }
197
199
inline
void
startShutdown
() {
startDelete
=
true
; }
200
202
inline
MAKRti::DtString&
getFederationName
() {
return
myFederationName
; };
203
inline
MAKRti::DtString&
getProcessName
() {
return
myProcessName
; };
204
inline
MAKRti::DtString&
getFederateType
() {
return
myFederateType
; };
205
inline
MAKRti::DtString&
getFederateName
() {
return
myFederateName
; };
206
inline
int
getPort
() {
return
myPort
; };
207
inline
MAKRti::DtString
getHostPort
() {
return
myProcessName
+
":"
+ MAKRti::DtString(
myPort
);}
208
209
protected
:
210
int
textureId
;
// Texture ID ( looked up by renderer )
211
unsigned
int
federateId
;
// The federate ID ( for lookup )
212
bool
isExec
;
// are we the exec
213
bool
isCentralForwarder
;
// are we the central forwarder
214
bool
isPeerForwarder
;
// are we a peer forwarder
215
bool
isLightWeightCenter
;
// are we a lightweight center node
216
bool
wasTouched
;
// have we been touched
217
bool
deleteMe
;
// should we delete ourselves
218
bool
startDelete
;
// start deletion process
219
float
radius
;
// What's our size of this object
220
float
speed
;
// Used in acceleration
221
float
elapsedTime
;
// Delta Time
222
float
elapsedDeleteTime
;
// Delete Delta Time
223
_vec2
position
;
// Position on screen
224
_vec2
acceleration
;
// Acceleration
225
_vec2
destination
;
// Destination
226
MAKRti::DtString
myFederationName
;
// Federation name
227
MAKRti::DtString
myProcessName
;
// processName
228
MAKRti::DtString
myFederateType
;
// federate type
229
MAKRti::DtString
myFederateName
;
// federate name
230
int
myPort
;
231
};
232
233
234
235
#endif
236
Document ID: Generated on Fri Sep 27 00:57:56 EDT 2019 from SVN revision 201708
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (
www.mak.com
)