FIX: fixed track class bugs

This commit is contained in:
Henry Winkel
2022-12-21 15:18:57 +01:00
parent 56833c93f2
commit a570766dc6
4 changed files with 81 additions and 20 deletions

View File

@@ -8,6 +8,7 @@ namespace SimCore {
class Entity {
public:
Entity();
private:

View File

@@ -22,40 +22,89 @@ namespace SimCore {
class Track : public WHISPER::Message
{
private:
/// message object from google protobuf
messages::track::Track trackMessage_;
messages::track::Track trackMessage_;
/// position of the track
Position position_;
/// speed the track
double speed_ = 0;
/// course of the track
double course_ = 0;
/// indicates if track is from an external source
bool external_ = false;
/// function that packs all information to a protobuf message
void packToMessage();
/// the unique tracknumber for now
std::uint32_t trackNo_;
public:
std::uint32_t trackNo_;
/**
* @brief a cuntructor that builds the object from a received message
* @param std::string the received thring from the line
*/
Track(std::string receivedMessage);
Track(std::uint32_t deviceID, WHISPER::SourceType src,std::uint32_t trackNo,Position pos, bool external);
/**
* @brief constructor for building a track which is also the trackmessage to send
* @param uint32_t deviceID the id of the sending device
* @param WHISPER::SourceType sourcetype of the sending device
* @param uint32_t internal tracknumber
* @param bool external indicates if track is from an external source e.g. dis
*
* @return
*/
Track(std::uint32_t deviceID, WHISPER::SourceType src,std::uint32_t trackNo, bool external);
/**
* @brief set the position of the track
* @param Position object of the position class
*
*/
void setPosition(Position pos);
/**
* @brief set the position of the track
* @param 3x double set the x,y,z coordinates direkt which causes that an object of position class is created
*/
void setPosition(double x,double y,double z);
/**
* @brief returns the position
* @return object of position class
*
*/
Position getPostion();
/// sets speed
void setSpeed(double speed);
/// set speed in knots
void setSpeedinKnots(double knots);
/// return sspeed
double getSpeed();
/// returns speed as knots
double getSpeedinKnots();
/// set course
void setCourse(double course);
///returns course
double getCourse();
/// set external indicator
void setExternal(bool val);
double getSpeed();
double getSpeedinKnots();
void setSpeedinKnots(double knots);
double getCourse();
/// return true if is external
bool isExternal();
};
}