22 using namespace vrecko;
32 void preInitialize(
void);
33 void processEvent(
const std::string &input_name,
void *value);
34 void *processRequest(
const std::string &input_name,
void *value);
36 virtual void update(
void);
38 bool loadXMLParameters(XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *pParametersNode);
61 std::map<unsigned int, std::map<unsigned int,unsigned int> >
roads;
105 void loadJuncPolyRoad(XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode const *
const pRoadNetNode);
107 void loadJunction(XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap
const *
const pAttributes);
109 void loadPolygonPoint(XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap
const *
const pAttributes);
113 void loadRoad(XERCES_CPP_NAMESPACE_QUALIFIER DOMNamedNodeMap
const *
const pAttributes);
117 void addEdgesAsEO() ;
120 void checkEdgesFromToAndTheirPolygonPoints();
126 void findShortestPath(std::vector<unsigned int> *
const pResultPath,
141 void findPath(std::vector<unsigned int> *
const pResultPath,
const unsigned int startEdge);
147 void getAbsPos(osg::Vec3 &resultPos,
const unsigned int edge,
152 void computeEdgesAttributes();
158 void computeJunctionsEdges();
170 void interPointOfLineAndPerpendicularPlane(osg::Vec3 &inter,
const osg::Vec3 &linePoint,
171 const osg::Vec3 &lineVec,
const osg::Vec3 &planePoint);
174 const float distFromPointToLine(
const osg::Vec3 &linePoint,
175 const osg::Vec3 &lineVec,
const osg::Vec3 &point);
177 void herFerDeriv(osg::Vec3 &result,
const float d,
const osg::Vec3 &P1,
178 const osg::Vec3 &P4,
const osg::Vec3 &R1,
const osg::Vec3 &R4);
187 bool pointInHalfSpace(
const osg::Vec3 &point,
const osg::Vec3 &halfSpacePoint,
188 const osg::Vec3 &halfSpaceVec);
196 void getCarEdgeId(
unsigned int &carEdgeId,
const unsigned int lastCarEdgeId,
197 const osg::Vec3 &bottomCarPosition,
const unsigned int juncId,
198 const unsigned int outEdgeId);
202 void distPointToPlane(
float &dist,
const osg::Vec3 &point,
203 const osg::Vec3 &planePoint,
const osg::Vec3 &planeNormal);
209 void linesInter2D(osg::Vec2 &result,
const osg::Vec2 &line1Point,
210 const osg::Vec2 &line1Vec,
const osg::Vec2 &line2Point,
211 const osg::Vec2 &line2Vec);
221 void findJuncsSinglePolyPoints();
228 void addTerminatorEdges(
unsigned int fstSinglePolyPoint,
229 unsigned int sndSinglePolyPoint,
unsigned int fstEdgeId,
230 unsigned int sndEdgeId,
const unsigned int juncId);
242 void mergeCloseJunctions();
245 void addEdgeAsEO(
const unsigned int edgeId);
248 void orderJunctionsEdges();
253 void computeJuncInOutEdgesAttr();
258 void unregCarForEdge(
const unsigned int carId,
const unsigned int edgeId);
261 void unregLastCarForEdge(
const unsigned int edgeId);
275 bool regCarForEdge(
const unsigned int carId,
const unsigned int startEdgeId,
276 const float startOffset,
const float carLength,
const bool showErrors);
280 void regFstCarForEdge(
const unsigned int carId,
const unsigned int edgeId,
281 const float offset,
const float carLength,
const float vel);
284 bool isCarRegForEdge(
const unsigned int carId,
const unsigned int edgeId);
288 void updateCarForEdge(
const unsigned int carId,
const unsigned int edgeId,
289 const float headOffset,
const float rearOffset,
const float vel);
296 void getNextCarDistAndVel(
float &nextCarDist,
float &nextCarVel,
297 const unsigned int carId,
const unsigned int edgeId);
312 bool isCarStopPositionRight(
const unsigned int stopEdgeId,
const float stopOffset,
313 const float carLength);
319 bool isFreeSpaceForCarGroupOnEdge(
const unsigned int edgeId,
const float fstCarInGroupLength,
unsigned int carCount);
406 bool lockJuncsEdgesForNewCar(
const std::vector<unsigned int> *
const pPath,
407 const unsigned int lastJuncInPath,
const bool isLastCar,
const bool isStopedCar,
408 const float carLength,
const unsigned int carId);
424 void regIncomingCarToShortEdges(
const std::vector<unsigned int> *
const pPath,
425 const unsigned int lastJuncInPath,
const unsigned int carId);
440 void setStopedIncomingCarToShortEdges(
const std::vector<unsigned int> *
const pPath,
441 const unsigned int lastJuncInPath,
const unsigned int carId);
478 bool rightHandRule(
bool &withDeadlock,
const unsigned int inEdge,
const unsigned int outEdge,
479 const unsigned int juncId,
const bool isCarLastStoped,
const unsigned int carId);
502 void decreaseLockCountForPrevEdge(
const unsigned int edgeId,
503 const unsigned int lastJuncId,
const unsigned int nextJuncId,
504 const unsigned int nextNextJuncId,
const bool mergedEdgeSkiped,
505 const unsigned int carId);
509 void computeRecVelocityOnJunc(
float &recVel,
const unsigned int juncId,
510 const unsigned int inEdge,
const unsigned int outEdge);
515 void getTurnOnJunc(
unsigned int &turnOnJunc,
const unsigned int juncId,
516 const unsigned int inEdge,
const unsigned int outEdge);
521 void generateCars(
const unsigned int numOfGenCars,
const bool genShortestPath);
524 void showPoint(
const osg::Vec3 &point);
545 bool isDeadlock(
const unsigned int juncId);
550 void loadTLparameters(XERCES_CPP_NAMESPACE_QUALIFIER
DOMNode *
const pTLparametersNode);
553 void createTrafficLights(
void);
560 bool isValidJuncWithTLs(
unsigned int juncId);