#include <string>
#include <vector>
+#include <list>
+class Block;
using std::string;
using std::vector;
+using std::list;
#include "gnnode.hxx"
#include "parking.hxx"
//typedef vector<FGTaxiSegment*> FGTaxiSegmentPointerVector;
//typedef vector<FGTaxiSegment*>::iterator FGTaxiSegmentPointerVectorIterator;
+class Block
+{
+private:
+ int id;
+ time_t blocktime;
+ time_t touch;
+public:
+ Block(int i, time_t bt, time_t curr) { id = i; blocktime= bt; touch = curr; };
+ ~Block() {};
+ int getId() { return id; };
+ void updateTimeStamps(time_t bt, time_t now) { blocktime = (bt < blocktime) ? bt : blocktime; touch = now; };
+ const time_t getBlockTime() const { return blocktime; };
+ time_t getTimeStamp() { return touch; };
+ bool operator< (const Block &other) const { return blocktime < other.blocktime; };
+};
+
+typedef vector<Block> BlockList;
+typedef BlockList::iterator BlockListIterator;
+
/***************************************************************************************
* class FGTaxiSegment
**************************************************************************************/
SGGeod center;
bool isActive;
bool isPushBackRoute;
- bool isBlocked;
+ BlockList blockTimes;
FGTaxiNode *start;
FGTaxiNode *end;
int index;
heading(0),
isActive(0),
isPushBackRoute(0),
- isBlocked(0),
start(0),
end(0),
index(0),
center (other.center),
isActive (other.isActive),
isPushBackRoute (other.isPushBackRoute),
- isBlocked (other.isBlocked),
+ blockTimes (other.blockTimes),
start (other.start),
end (other.end),
index (other.index),
center = other.center;
isActive = other.isActive;
isPushBackRoute = other.isPushBackRoute;
- isBlocked = other.isBlocked;
+ blockTimes = other.blockTimes;
start = other.start;
end = other.end;
index = other.index;
isPushBackRoute = val;
};
void setDimensions(double elevation);
- void block() {
- isBlocked = true;
- }
- void unblock() {
- isBlocked = false;
- };
- bool hasBlock() {
- return isBlocked;
- };
+ void block(int id, time_t blockTime, time_t now);
+ void unblock(time_t now);
+ bool hasBlock(time_t now);
FGTaxiNode * getEnd() {
return end;
time_t nextSave;
//int maxDepth;
int count;
+ int version;
FGTaxiNodeVector nodes;
FGTaxiNodeVector pushBackNodes;
FGTaxiSegmentVector segments;
void addNode (const FGTaxiNode& node);
void addNodes (FGParkingVec *parkings);
void addSegment(const FGTaxiSegment& seg);
+ void setVersion (int v) { version = v;};
+
+ int getVersion() { return version; };
void init();
bool exists() {
int findNearestNode(double lat, double lon);
int findNearestNode(const SGGeod& aGeod);
+ int findNearestNodeOnRunway(const SGGeod& aGeod);
FGTaxiNode *findNode(unsigned idx);
FGTaxiSegment *findSegment(unsigned idx);
virtual void update(double dt);
void saveElevationCache();
+ void addVersion(int v) {version = v; };
};