00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef HOST_MOVE_H
00021 #define HOST_MOVE_H
00022
00023 #include <string>
00024 #include "Coord.h"
00025 #include "Blackboard.h"
00026 #include <omnetpp.h>
00027 #include <cmath>
00028
00038 class HostMove : public BBItem
00039 {
00040 BBITEM_METAINFO(BBItem);
00041
00042 public:
00044 Coord startPos;
00046 simtime_t startTime;
00048 Coord direction;
00050 double speed;
00051
00052 public:
00053 void setDirection(const Coord& target) {
00054 double d = startPos.distance( target );
00055 direction.x = (target.x - startPos.x) / d;
00056 direction.y = (target.y - startPos.y) / d;
00057
00058
00059
00060
00061 }
00062
00063 public:
00064
00065 std::string info() {
00066 std::ostringstream ost;
00067 ost << " HostMove "
00068 << " startPos.x: "<<startPos.x
00069 << " startPos.y: "<<startPos.y
00070 << " direction.x: "<< direction.x
00071 << " direction.y: "<< direction.y
00072 << " startTime: " << startTime
00073 << " speed: " << speed;
00074 return ost.str();
00075 }
00076 };
00077
00078 #endif