MAK RTIspy API Documentation for HLA Evolved
networkMapWidget.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2012 MAK Technologies, Inc.
3 ** All rights reserved.
4 *******************************************************************************/
5 
6 #ifndef networkMapWidget_H_
7 #define networkMapWidget_H_
8 
10 #include "forwarderInfo.h"
11 #include "assistantEnums.h"
12 #include <QtOpenGL/QtOpenGL>
13 //#include <qgl.h>
14 #include <Qt/qtimer.h>
15 #include <string>
16 
17 
20 class DtNetworkMapCamera;
21 
22 
25 {
26  Q_OBJECT
27 public:
29  DtNetworkMapWidget( QWidget * parent );
30 
32  virtual ~DtNetworkMapWidget();
33 
35  virtual QSize sizeHint() const;
36 
38  void addPeerForwarderNode( const MAKRti::DtString& forwarderName );
39  void removeForwarderNode( const MAKRti::DtString& forwarderName );
40  void addExecNode();
41  void removeExecNode();
42  void addFederateNode( int fedHandle, const MAKRti::DtString& federationName,
43  const MAKRti::DtString& processName, const MAKRti::DtString& fedType,
44  const MAKRti::DtString& fedName, bool notJoined = false, bool isDropped = false);
45  void removeFederateNode(int fedHandle, const MAKRti::DtString& federationName );
46  void checkAndAddMainForwarder( const MAKRti::DtString& forwarderName );
47  void checkAndAddLightweight( const MAKRti::DtString& connName );
48 
49  // Update the federate information
50  void updateFederateInfo( int fedHandle,
51  const MAKRti::DtString& federationName, int queueStatus,
52  bool disconnected, bool reconnecting, bool inErrorState = false );
53 
54  // update / refresh all values for federates
55  void refreshPositions();
56 
58  bool doesFederateExist( int fedHandle, const MAKRti::DtString& federationName );
59 
61  bool doesRtiexecExist();
62 
64  void clearFederateFlags( int fedHandle, const MAKRti::DtString& federationName );
65 
67  void forceFederateSelection( int fedHandle, const MAKRti::DtString& federationName);
68 
70  void forceRtiexecSelection();
71 
73  void forceForwarderSelection(const MAKRti::DtString& forwarderName);
74 
76  void forceClearSelection();
77 
79  virtual void tick( float delta );
80 
82  virtual void selection( int x, int y, bool onHover = false );
83 
85  virtual void clearList();
86 
88  virtual bool hasSelection();
89 
91  virtual inline int getSelectedHandle() { return mySelectedIndex; };
92 
94  virtual void getSelectedNodeInfo( MAKRti::DtString& federationName,
95  int& federateHandle, bool& isForwarder, bool& isExec, bool& isLightweightCenter );
96 
98  virtual QColor getFederationColor( const MAKRti::DtString & federationName );
99 
101  virtual void changeFederationColor( const MAKRti::DtString& federationName,
102  const QColor& newColor );
103 
105  virtual void enableFederationColors(bool enable);
106 
108  virtual void setFederateIdentifierType(DtFederateIdentifierType fedIdType);
109 
111  virtual void setContextMenu(QMenu* contextMenu);
112 
113 public slots:
114 
116  void selectAndHoverText();
117 
119  void showContextMenu(const QPoint & pos);
120 
121 signals:
122 
124  void federateSelected(const MAKRti::DtString& federationName, int federateHandle);
125 
127  void rtiexecSelected();
128 
130  void forwarderSelected(const MAKRti::DtString& forwarderName);
131 
133  void peerForwarderSelected(const MAKRti::DtString& forwarderName);
134 
136  void lightweightSelected();
137 
139  void nothingSelected();
140 
141 protected:
143  virtual void resizeEvent( QResizeEvent* evt );
144 
146  virtual void closeEvent( QCloseEvent* evt );
147 
149  virtual void wheelEvent(QWheelEvent* evt);
150 
152  virtual void mouseMoveEvent(QMouseEvent* evt);
153 
155  virtual void keyPressEvent(QKeyEvent* evt);
156 
158  virtual void mousePressEvent(QMouseEvent* evt);
159 
161  virtual void mouseDoubleClickEvent(QMouseEvent* evt);
162 
164  virtual void initializeGL();
165 
167  virtual void paintGL();
168 
170  virtual void drawLines();
171 
173  virtual void drawNodes();
174 
176  virtual void drawForwarderNodes();
177 
179  virtual void drawForwarderNodeLines();
180 
182  virtual void drawText();
183 
185  virtual QColor addFederationColor( const MAKRti::DtString& federationName );
186 
188  virtual void drawWarning( int textIndex );
189 
190 protected:
191  int myWidth; // widget width
192  int myHeight; // widget height
193  unsigned mySelectedIndex; // currently selected node
194  unsigned myHoverIndex; // index when hovering
195  float myCameraDelta; // Camera Zoom Delta
196  QPoint myOldMouse; // Old Mouse Position
197  QPoint myNewMouse; // New Mouse Position
198  QPoint myDeltaMouse; // Delta Mouse Position
199  DtNetworkMapCentralNode* myCentralNode; // Our central node and its children
200  DtNetworkMapCamera* myCamera; // Our Camera Class
201 
204 
206  std::vector<QColor> myDefaultColors;
207 
210 
213 
216 
218  std::set<QRgb> myInUseColors;
219 
220  QTimer* myHoverTimer; // Our hover timer
221 
223  std::map< MAKRti::DtString, QColor > myFederationColors;
224 
227 
229 
230  static const int theRtiexecId;
231  static const int theForwarderId;
232  static const int theLigthweightCenterId;
234 
236 
237  static const MAKRti::DtString theRtiexecName;
238  static const MAKRti::DtString theForwarderName;
239  static const MAKRti::DtString theLigthweightCenterName;
241 
243  static const int theStandardNodeRadius;
244 
246  static const unsigned theInvalidMapNodeIndex;
247 
249  static const unsigned theInitialFwIndex;
250 };
251 
252 
253 #endif
254 
255 

Document ID: Generated on Tue May 7 16:26:47 EDT 2013 from SVN revision 126903
Copyright © 2005-2013 VT MÄK Inc. All Rights Reserved (www.mak.com)