MAK RTIspy API Documentation for HLA Evolved
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
ballData.h
Go to the documentation of this file.
1 /*******************************************************************************
2 ** Copyright (c) 2010 MaK Technologies, Inc.
3 ** All rights reserved.
4 ********************************************************************************/
5 /*******************************************************************************
6 ** $RCSfile: .h,v $ $Revision: 1.2 $ $State: Exp $
7 *******************************************************************************/
8 
9 #ifndef BallData_H_
10 #define BallData_H_
11 
12 #include <map>
13 #include <string>
14 
15 class QGraphicsSvgItem;
16 
17 
18 
19 // Enumeration defining possible ball colors
20 // Don't make more than 255 colors
21 typedef unsigned char BallColor;
22 static const BallColor RedBall(0);
23 static const BallColor BlueBall(1);
24 static const BallColor YellowBall(2);
25 static const BallColor GreenBall(3);
26 static const BallColor VioletBall(4);
27 static const BallColor AquaBall(5);
28 static const BallColor NumBallColors(6);
29 
30 
31 // Generic class for implementation specific object parameters
33 {
34 public:
35 
36  ObjectParams();
37  virtual ~ObjectParams();
38 
39  // Get a unique ID for this object based on the object handle
40  virtual const std::wstring& id() const = 0;
41 
42  // Get the object name
43  virtual const std::wstring& name() const = 0;
44 };
45 
46 // Class with all information on a single ball object
47 class Ball
48 {
49 public:
50 
51  Ball();
52  virtual ~Ball();
53 
54  // Accessors and mutators for ball attributes and information
55  BallColor color() const;
56  void setColor(BallColor newColor);
57 
58  short x() const;
59  void setX(short newXCoord);
60  short y() const;
61  void setY(short newYCoord);
62  void setLocation(short newXCoord, short newYCoord);
63 
64  unsigned short size() const;
65  void setSize(unsigned short newSize);
66 
67  double direction() const;
68  void setDirection(double newDirection);
69 
70  unsigned short speed() const;
71  void setSpeed(unsigned short newSpeed);
72 
73  // Indicates whether this federate owns the ball
74  bool isMine() const;
75  void setIsMine(bool newIsMine);
76 
77  // If true, ball will be deleted by the GUI at the next update
78  bool isMarkedForDeletion() const;
79  void markForDeletion(bool mark);
80 
81  // If true, ball will not be drawn
82  bool isVisible() const;
83  void setVisible(bool visible);
84 
85  // Unique object ID (based on HLA object instance handle)
86  const std::wstring& id() const;
87 
88  // Object name
89  const std::wstring& name() const;
90 
91  // Implementation specific information (name, type, handle, etc.)
93  const ObjectParams* objectParams() const;
94 
95  // Takes ownership of newParams object and will delete the old
96  void setObjectParams(ObjectParams* newParams);
97 
98  // Pointer to the Qt item for this ball
99  QGraphicsSvgItem* graphicsItem();
100  void setGraphicsItem(QGraphicsSvgItem* item);
101 
102 protected:
103 
105  QGraphicsSvgItem* myGraphicsItem;
107  short myX;
108  short myY;
109  short mySize;
110  double myDirection;
111  unsigned short mySpeed;
112  bool myIsMine;
115 };
116 
117 // Map of IDs to ball objects
118 typedef std::map<std::wstring, Ball*> BallMap;
119 
120 #endif

Document ID: Generated on Mon Jul 9 10:30:41 EDT 2018 from SVN revision 190224
Copyright © 2005-2018 VT MÄK Inc. All Rights Reserved (www.mak.com)