MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
networkMapWidget.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #pragma once
7 
9 #include "forwarderInfo.h"
10 #include "assistantEnums.h"
12 
13 #include <QtOpenGL/QtOpenGL>
14 //#include <qgl.h>
15 #include <QtCore/QTimer>
16 #include <string>
17 
18 
21 class DtNetworkMapCamera;
22 class DtNetworkMapNode;
23 
24 
27 {
28  Q_OBJECT
29 public:
31  DtNetworkMapWidget( QWidget * parent );
32 
34  virtual ~DtNetworkMapWidget();
35 
37  virtual QSize sizeHint() const;
38 
40  void addPeerForwarderNode( const MAKRti::DtString& forwarderHostName, int port );
41  void removeForwarderNode( const MAKRti::DtString& forwarderHostName, int port );
42  void addExecNode();
43  void removeExecNode();
44  void addFederateNode( int fedHandle, const MAKRti::DtString& federationName,
45  const MAKRti::DtString& processName, const MAKRti::DtString& fedType,
46  const MAKRti::DtString& fedName, bool notJoined = false, bool isDropped = false);
47  void removeFederateNode(int fedHandle, const MAKRti::DtString& federationName );
48  void checkAndAddMainForwarder( const MAKRti::DtString& forwarderHostName, int port );
49  void checkAndAddLightweight( const MAKRti::DtString& connName );
50 
51  // Update the federate information
52  void updateFederateInfo( int fedHandle,
53  const MAKRti::DtString& federationName, int queueStatus,
54  bool disconnected, bool reconnecting, bool inErrorState = false );
55 
56  // Information about a node
57  bool isPeerForwarder( const MAKRti::DtString& forwarderHostName, int port );
58 
59  // update / refresh all values for federates
60  void refreshPositions();
61 
63  bool doesFederateExist( int fedHandle, const MAKRti::DtString& federationName );
64 
66  void clearFederateFlags( int fedHandle, const MAKRti::DtString& federationName );
67 
69  void forceFederateSelection( int fedHandle, const MAKRti::DtString& federationName);
70 
72  void forceRtiexecSelection();
73 
75  void forceForwarderSelection(const MAKRti::DtString& forwarderName, int port);
76 
78  void forceClearSelection();
79 
81  virtual void tick( float delta );
82 
84  virtual void selection( int x, int y, bool onHover = false );
85 
87  virtual void clearList();
88 
90  virtual bool hasSelection();
91 
93  virtual inline int getSelectedHandle() { return mySelectedId; };
94 
96  virtual void getSelectedNodeInfo( MAKRti::DtString& federationName,
97  int& federateHandle, bool& isForwarder, bool& isExec, bool& isLightweightCenter );
98 
100  virtual QColor getFederationColor( const MAKRti::DtString & federationName );
101 
103  virtual void changeFederationColor( const MAKRti::DtString& federationName,
104  const QColor& newColor );
105 
107  virtual void enableFederationColors(bool enable);
108 
110  virtual void setFederateIdentifierType(DtFederateIdentifierType fedIdType);
111 
113  virtual void setContextMenu(QMenu* contextMenu);
114 
116  virtual bool hasForwarder() const;
117 
119  virtual bool hasExec() const;
120 
122  virtual bool isLightweight() const;
123 
124 public slots:
125 
127  void selectAndHoverText();
128 
130  void showContextMenu(const QPoint & pos);
131 
132 signals:
133 
135  void federateSelected(const MAKRti::DtString& federationName, int federateHandle);
136 
138  void rtiexecSelected();
139 
141  void forwarderSelected(const MAKRti::DtString& forwarderName, int port);
142 
144  void peerForwarderSelected(const MAKRti::DtString& forwarderName, int port);
145 
147  void switchToPeerForwarder(const MAKRti::DtString& forwarderName, int port);
148 
150  void lightweightSelected();
151 
153  void nothingSelected();
154 
155 protected:
157  virtual void resizeEvent( QResizeEvent* evt );
158 
160  virtual void closeEvent( QCloseEvent* evt );
161 
163  virtual void wheelEvent(QWheelEvent* evt);
164 
166  virtual void mouseMoveEvent(QMouseEvent* evt);
167 
169  virtual void keyPressEvent(QKeyEvent* evt);
170 
172  virtual void mousePressEvent(QMouseEvent* evt);
173 
175  virtual void mouseDoubleClickEvent(QMouseEvent* evt);
176 
178  virtual void initializeGL();
179 
181  virtual void paintGL();
182 
184  virtual void drawLines();
185 
187  virtual void drawNodes();
188 
190  virtual void drawForwarderNodes();
191 
193  virtual void drawForwarderNode(DtNetworkMapNode* node, unsigned int index);
194 
196  virtual void drawForwarderNodeLines();
197 
199  virtual void drawText();
200 
202  virtual QColor addFederationColor( const MAKRti::DtString& federationName );
203 
205  virtual void drawWarning( int textIndex );
206 
207 protected:
208  int myWidth; // widget width
209  int myHeight; // widget height
210  unsigned mySelectedId; // currently selected node
211  unsigned myHoverId; // id of node hovering over
212  float myCameraDelta; // Camera Zoom Delta
213  QPoint myOldMouse; // Old Mouse Position
214  QPoint myNewMouse; // New Mouse Position
215  QPoint myDeltaMouse; // Delta Mouse Position
216  DtNetworkMapCentralNode* myCentralNode; // Our central node and its children
217  DtNetworkMapCamera* myCamera; // Our Camera Class
218 
221 
223  std::vector<QColor> myDefaultColors;
224 
227 
230 
233 
235  std::set<QRgb> myInUseColors;
236 
237  QTimer* myHoverTimer; // Our hover timer
238 
240  std::map< MAKRti::DtString, QColor > myFederationColors;
241 
244 
246 
247  static const int theRtiexecId;
248  static const int theForwarderId;
249  static const int theLigthweightCenterId;
250  static const int theEmptyNodeId;
252 
254 
255  static const MAKRti::DtString theRtiexecName;
256  static const MAKRti::DtString theForwarderName;
257  static const MAKRti::DtString theLigthweightCenterName;
258  static const MAKRti::DtString theEmptyNodeName;
260 
262  static const int theStandardNodeRadius;
263 
265  static const unsigned theInvalidMapNodeId;
266 
268  static const unsigned theInitialFwId;
269 };
270 
static const int theStandardNodeRadius
The standard radius for all nodes.
Definition: networkMapWidget.h:262
static const int theForwarderId
Standard IDs to use for non-federate nodes.
Definition: networkMapWidget.h:248
unsigned myNextDefaultColor
Index of next color to use.
Definition: networkMapWidget.h:232
DtNetworkMapCentralNode * myCentralNode
Definition: networkMapWidget.h:216
static const MAKRti::DtString theEmptyNodeName
Standard names to use for non-federate nodes.
Definition: networkMapWidget.h:258
This file contains the declaration of DtRtiConnectionInfo.
Definition: networkMapWidget.h:26
QPoint myNewMouse
Definition: networkMapWidget.h:214
float myCameraDelta
Definition: networkMapWidget.h:212
QMenu * myCurrentContextMenu
The context menu to display for the current selected node, if requested.
Definition: networkMapWidget.h:243
Definition: networkMapCamera.h:18
QPoint myOldMouse
Definition: networkMapWidget.h:213
QPoint myDeltaMouse
Definition: networkMapWidget.h:215
unsigned mySelectedId
Definition: networkMapWidget.h:210
std::map< MAKRti::DtString, QColor > myFederationColors
map that holds federation names to colors
Definition: networkMapWidget.h:240
Definition: networkMapCentralNode.h:17
virtual int getSelectedHandle()
Returns the selected index.
Definition: networkMapWidget.h:93
bool myNodesAreMoving
Whether nodes are currently moving.
Definition: networkMapWidget.h:229
static const unsigned theInvalidMapNodeId
Represents an invalid map node ID.
Definition: networkMapWidget.h:265
static const MAKRti::DtString theLigthweightCenterName
Standard names to use for non-federate nodes.
Definition: networkMapWidget.h:257
Definition: networkMapNode.h:28
static const MAKRti::DtString theForwarderName
Standard names to use for non-federate nodes.
Definition: networkMapWidget.h:256
DtNetworkMapCamera * myCamera
Definition: networkMapWidget.h:217
std::vector< QColor > myDefaultColors
Available default colors.
Definition: networkMapWidget.h:223
static const unsigned theInitialFwId
The first forwarder node ID.
Definition: networkMapWidget.h:268
#define DT_DLL_ASSISTANTAPP
Definition: rtiMsConfig.h:151
static const int theEmptyNodeId
Standard IDs to use for non-federate nodes.
Definition: networkMapWidget.h:250
DtFederateIdentifierType
Definition: assistantEnums.h:10
static const MAKRti::DtString theRtiexecName
Standard names to use for non-federate nodes.
Definition: networkMapWidget.h:255
static const int theRtiexecId
Standard IDs to use for non-federate nodes.
Definition: networkMapWidget.h:247
bool myDisplayFederationColors
Whether the federation colors are displayed.
Definition: networkMapWidget.h:226
int myWidth
Definition: networkMapWidget.h:208
int myHeight
Definition: networkMapWidget.h:209
unsigned myHoverId
Definition: networkMapWidget.h:211
static const int theLigthweightCenterId
Standard IDs to use for non-federate nodes.
Definition: networkMapWidget.h:249
DtFederateIdentifierType myFedIdType
The identifying text to be used to identify federates.
Definition: networkMapWidget.h:220
QTimer * myHoverTimer
Definition: networkMapWidget.h:237
std::set< QRgb > myInUseColors
Colors currently in use.
Definition: networkMapWidget.h:235

Document ID: Generated on Wed Jul 8 16:20:32 EDT 2026 from SVN revision 291616
Copyright © 2005-2025 MAK Technologies Inc. All Rights Reserved (www.mak.com)