diff --git a/Simulation.cpp b/Simulation.cpp index 6b9242dfb8992045c902c918adab38a4b8f91045..a930e93222f2ab951d6912739ede974cf3344f40 100644 --- a/Simulation.cpp +++ b/Simulation.cpp @@ -546,7 +546,8 @@ double Simulation::RunBody(double maxSimTime) } } - if (_routingEngine->isNeedUpdate()){ + // here the used routers are update, when needed due to external changes + if (_routingEngine->NeedsUpdate()){ _routingEngine->UpdateRouter(); } diff --git a/routing/Router.h b/routing/Router.h index eb9b2c93a4eba6dc12c741695fef10f85c6ce3cf..b2a65e3272e767389d7cb020d87fc8e970fa078d 100644 --- a/routing/Router.h +++ b/routing/Router.h @@ -142,6 +142,10 @@ public: void SetTrips(const Trips& trips); + /** + * Update the router, when geometry changed due to external changes. + * Remark: Depends on router if needed! + */ virtual void Update(); }; diff --git a/routing/RoutingEngine.cpp b/routing/RoutingEngine.cpp index 5e09f5b8f5cfcfab27b2a65dd465567109195a62..494f7f51c51cd7e8b4c4a2b7e10b3fba2e63152d 100644 --- a/routing/RoutingEngine.cpp +++ b/routing/RoutingEngine.cpp @@ -131,7 +131,7 @@ bool RoutingEngine::Init(Building* building) return status; } -bool RoutingEngine::isNeedUpdate() const +bool RoutingEngine::NeedsUpdate() const { return _needUpdate; } diff --git a/routing/RoutingEngine.h b/routing/RoutingEngine.h index ef5bb52a7d72437fdfce1b3286edb3dced5925b9..ef09a04055249caeeb6406642fdaad9067de06a2 100644 --- a/routing/RoutingEngine.h +++ b/routing/RoutingEngine.h @@ -107,6 +107,22 @@ public: */ bool Init(Building* building); + /** + * Returns if routers need to be updated + * @return routers need to be updated + */ + bool NeedsUpdate() const; + + /** + * Set if routers need to be updated + * @param needUpdate + */ + void setNeedUpdate(bool needUpdate); + + /** + * Updates all used routers + */ + void UpdateRouter(); private: /// collections of all routers used @@ -114,12 +130,6 @@ private: /// collection of all trips/routes Trips _tripsCollection; bool _needUpdate = false; -public: - bool isNeedUpdate() const; - - void setNeedUpdate(bool needUpdate); - - void UpdateRouter(); }; #endif /* ROUTINGENGINE_H_ */