All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TrainVehicleFactory.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "Navigation.h"
6 #include "IVehicleFactory.h"
7 #include "Traffic.h"
8 #include "Location.h"
9 #include "Random.h"
10 #include "TrafficSimulationConfiguration.h"
11 #include "ParsedNavGraph.h"
12 #include <string>
13 #include <vector>
14 
15 namespace Eegeo
16 {
17  namespace Traffic
18  {
19  using Resources::Roads::Navigation::NavigationGraph;
20 
21 
23  {
24  IVehicle* vehicle;
25  double distance;
26 
27  ClosestVehicle(IVehicle* vehicle, double distance) : vehicle(vehicle), distance(distance)
28  {
29  }
30  };
31 
33  {
34  public:
35 
37  Random& randomGenerator,
38  const TrafficSimulationCellsModel* cellsModel);
39 
40  void CreateVehicles(int vehicleCount, const NavigationGraph& navGraph, TVehicleVector& vehicles);
41 
42  void SetConfig(const Config::TrafficSimulationConfiguration& roadConfig);
43  void ApplyVehicleSuffixChange(const std::string &suffix);
44 
45  int CalcInitialVehicleCount(const NavigationGraph& navGraph);
46 
47  private:
48  const ClosestVehicle GetNearestTrainVehicle(const Eegeo::dv3& ecefPosition);
49  const TrafficSimulationCellsModel* m_cellsModel;
51  Random& m_random;
52  std::string m_modelNodeSuffix;
53 
54  std::vector<IVehicle*> CreateRandomVehicle(const NavigationGraph* navGraph,
55  int beginningRoadIndex) const;
56  std::vector<IVehicle*> CreateRandomVehicleFromConfig(const NavigationGraph* navGraph,
57  int beginningRoadIndex,
58  const Config::TrafficSimulationVehicleConfiguration& vehicleConfig) const;
59  std::vector<const Config::TrafficSimulationVehicleConfiguration*> GetVehicleConfigsAcceptableForRoadClass(Resources::Roads::FunctionalRoadClass::Type functionalRoadClass) const;
60  };
61 
62  }
63 }