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  virtual ~DtNetworkMapNode() { };
42 
44  inline void setTextureId( int id )
45  {
46  if( id >= 0 )
47  textureId = id;
48  }
49 
51  inline int getTextureId()
52  {
53  return textureId;
54  }
55 
57  inline void setRadius( float radius )
58  {
59  this->radius = radius;
60  }
61 
63  inline float getRadius()
64  {
65  return radius;
66  }
67 
69  inline int getFederateId()
70  {
71  return federateId;
72  }
73 
75  void update( float delta );
76 
78  inline void setDestination( const _vec2 &dest )
79  {
80  destination.x = dest.x;
81  destination.y = dest.y;
82  }
83 
85  inline bool isMoving() const
86  {
87  float xDiff = position.x - destination.x;
88  float yDiff = position.y - destination.y;
89 
90  if(xDiff < 0)
91  {
92  xDiff *= -1;
93  }
94  if(yDiff < 0)
95  {
96  yDiff *= -1;
97  }
98 
99  return (xDiff > RTI_NODE_DEST_RANGE &&
100  yDiff > RTI_NODE_DEST_RANGE);
101  }
102 
104  inline const _vec2 & getPosition() const { return position; }
105 
107  inline void setPosition(const _vec2 &pos )
108  {
109  position.x = pos.x;
110  position.y = pos.y;
111  }
112 
114  inline void resetTextureId()
115  {
116  textureId = -1;
117  }
118 
120  inline void showWarning()
121  {
123  }
124 
126  inline void showError()
127  {
129  }
130 
131  // Show disconnect texture
132  inline void showDisconnect()
133  {
135  }
136  inline bool isDisconnected()
137  {
138  return ( textureId == DtDisconnectedTexture ? true : false );
139  }
140 
141  inline void showNotJoined()
142  {
144  }
145  inline bool isNotJoined()
146  {
147  return ( textureId == DtNotJoinedTexture ? true : false );
148  }
149 
151  inline void resetTouched()
152  {
153  wasTouched = true;
154  }
155 
157  inline void clearTouched()
158  {
159  wasTouched = false;
160  }
161 
163  inline bool isTouched() { return wasTouched; };
164 
166  inline void setIsCentralForwarder() { isCentralForwarder = true; isPeerForwarder = false; isExec = false; isLightWeightCenter = false; }
167 
169  inline bool IsCentralForwarder() { return isCentralForwarder; }
170 
172  inline void setIsPeerForwarder() { isPeerForwarder = true; isCentralForwarder = false; isExec = false; isLightWeightCenter = false; }
173 
175  inline bool IsPeerForwarder() { return isPeerForwarder; }
176 
178  inline void setIsExec() { isExec = true; isPeerForwarder = false; isCentralForwarder = false; isLightWeightCenter = false; }
179 
181  inline bool IsExec() { return isExec; };
182 
184  inline void setIsLightweightCenter() { isLightWeightCenter = true; isExec = false; isCentralForwarder = false; isPeerForwarder = false; }
185 
187  inline bool IsLightweightCenter() { return isLightWeightCenter; }
188 
190  inline bool shouldBeDelete() { return deleteMe; }
191 
193  inline void startShutdown() { startDelete = true; }
194 
196  inline MAKRti::DtString& getFederationName() { return myFederationName; };
197  inline MAKRti::DtString& getProcessName() { return myProcessName; };
198  inline MAKRti::DtString& getFederateType() { return myFederateType; };
199  inline MAKRti::DtString& getFederateName() { return myFederateName; };
200 
201 protected:
202  int textureId; // Texture ID ( looked up by renderer )
203  unsigned int federateId; // The federate ID ( for lookup )
204  bool isExec; // are we the exec
205  bool isCentralForwarder; // are we the central forwarder
206  bool isPeerForwarder; // are we a peer forwarder
207  bool isLightWeightCenter; // are we a lightweight center node
208  bool wasTouched; // have we been touched
209  bool deleteMe; // should we delete ourselves
210  bool startDelete; // start deletion process
211  float radius; // What's our size of this object
212  float speed; // Used in acceleration
213  float elapsedTime; // Delta Time
214  float elapsedDeleteTime; // Delete Delta Time
215  _vec2 position; // Position on screen
216  _vec2 acceleration; // Acceleration
217  _vec2 destination; // Destination
218  MAKRti::DtString myFederationName; // Federation name
219  MAKRti::DtString myProcessName; // processName
220  MAKRti::DtString myFederateType; // federate type
221  MAKRti::DtString myFederateName; // federate name
222 };
223 
224 
225 
226 #endif
227 

Document ID: Generated on Wed Mar 11 20:26:49 EDT 2015 from SVN revision 150939
Copyright © 2005-2015 VT MÄK Inc. All Rights Reserved (www.mak.com)