MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
29 {
30 public:
31 
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  {
129  }
130 
132  inline void showError()
133  {
135  }
136 
137  // Show disconnect texture
138  inline void showDisconnect()
139  {
141  }
142  inline bool isDisconnected()
143  {
144  return ( textureId == DtDisconnectedTexture ? true : false );
145  }
146 
147  inline void showNotJoined()
148  {
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 
bool isPeerForwarder
Definition: networkMapNode.h:214
bool IsPeerForwarder()
Gets whether this node is a peer forwarder.
Definition: networkMapNode.h:181
bool deleteMe
Definition: networkMapNode.h:217
bool startDelete
Definition: networkMapNode.h:218
float getRadius()
returns the radius
Definition: networkMapNode.h:69
void showDisconnect()
Definition: networkMapNode.h:138
bool isTouched()
Have we been touched?
Definition: networkMapNode.h:169
int textureId
Definition: networkMapNode.h:210
const _vec2 & getPosition() const
Gets the position.
Definition: networkMapNode.h:110
float speed
Definition: networkMapNode.h:220
void setTextureId(int id)
Sets the texture ID.
Definition: networkMapNode.h:50
void setIsCentralForwarder()
Sets this node to be the forwarder.
Definition: networkMapNode.h:172
void setIsPeerForwarder()
Sets this node to be a peer forwarder.
Definition: networkMapNode.h:178
void update(float delta)
Update function - does the animating.
void resetTextureId()
No warning / error texture.
Definition: networkMapNode.h:120
void setIsLightweightCenter()
Sets this node to be the center node for lightweight connections.
Definition: networkMapNode.h:190
void clearTouched()
clear touched flag
Definition: networkMapNode.h:163
DtNetworkMapNode()
default Constructor
void setPosition(const _vec2 &pos)
Sets the position.
Definition: networkMapNode.h:113
int getTextureId()
gets the textureId
Definition: networkMapNode.h:57
bool shouldBeDelete()
gets whether this node should be deleted
Definition: networkMapNode.h:196
Includes –—.
Definition: networkMapNode.h:15
void setRadius(float radius)
sets the radius
Definition: networkMapNode.h:63
int myPort
Definition: networkMapNode.h:230
float elapsedDeleteTime
Definition: networkMapNode.h:222
MAKRti::DtString myFederateType
Definition: networkMapNode.h:228
MAKRti::DtString myFederationName
Definition: networkMapNode.h:226
bool IsCentralForwarder()
Gets whether this node is the forwarder.
Definition: networkMapNode.h:175
Definition: iconAndTextureManager.h:24
MAKRti::DtString & getFederateName()
Definition: networkMapNode.h:205
MAKRti::DtString & getFederationName()
Get the federation name.
Definition: networkMapNode.h:202
void setIsExec()
Sets this node to be the exec.
Definition: networkMapNode.h:184
MAKRti::DtString myProcessName
Definition: networkMapNode.h:227
float y
Definition: networkMapNode.h:18
unsigned int federateId
Definition: networkMapNode.h:211
Definition: iconAndTextureManager.h:21
float radius
Definition: networkMapNode.h:219
bool isNotJoined()
Definition: networkMapNode.h:151
float x
Definition: networkMapNode.h:17
_vec2 position
Definition: networkMapNode.h:223
virtual ~DtNetworkMapNode()
Destructor.
Definition: networkMapNode.h:47
Definition: iconAndTextureManager.h:23
Definition: networkMapNode.h:28
_vec2 destination
Definition: networkMapNode.h:225
MAKRti::DtString myFederateName
Definition: networkMapNode.h:229
void setDestination(const _vec2 &dest)
Sets the destination.
Definition: networkMapNode.h:84
int getFederateId()
Returns the federate id.
Definition: networkMapNode.h:75
bool IsLightweightCenter()
Gets whether this node is the forwarder.
Definition: networkMapNode.h:193
float elapsedTime
Definition: networkMapNode.h:221
bool isMoving() const
Returns true if the node is currently moving.
Definition: networkMapNode.h:91
bool isLightWeightCenter
Definition: networkMapNode.h:215
bool IsExec()
gets whether this node is the exec
Definition: networkMapNode.h:187
MAKRti::DtString & getFederateType()
Definition: networkMapNode.h:204
int getPort()
Definition: networkMapNode.h:206
bool isCentralForwarder
Definition: networkMapNode.h:213
MAKRti::DtString & getProcessName()
Definition: networkMapNode.h:203
bool isExec
Definition: networkMapNode.h:212
void showNotJoined()
Definition: networkMapNode.h:147
void showWarning()
Shows warning texture.
Definition: networkMapNode.h:126
bool wasTouched
Definition: networkMapNode.h:216
#define RTI_NODE_DEST_RANGE
Defines how close a node should be to its destination before we consider it there.
Definition: networkMapNode.h:26
Definition: iconAndTextureManager.h:22
void showError()
Show Error texture.
Definition: networkMapNode.h:132
bool isDisconnected()
Definition: networkMapNode.h:142
void resetTouched()
rest whether we&#39;ve been touched or not
Definition: networkMapNode.h:157
_vec2 acceleration
Definition: networkMapNode.h:224
void startShutdown()
Starts the shutdown/deletion process.
Definition: networkMapNode.h:199
MAKRti::DtString getHostPort()
Definition: networkMapNode.h:207

Document ID: Generated on Mon Sep 7 15:40:32 EDT 2020 from SVN revision 217499
Copyright © 2005-2020 MAK Technologies Inc. All Rights Reserved (www.mak.com)