All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
TrafficSimulationConfiguration.h
1 // Copyright eeGeo Ltd (2012-2014), All Rights Reserved
2 
3 #pragma once
4 
5 #include "ParsedNavGraph.h"
6 #include "TrainVehicle.h"
7 #include <string>
8 #include <vector>
9 
10 namespace Eegeo
11 {
12  namespace Traffic
13  {
14  namespace Config
15  {
16  namespace FunctionalRoadClassFilterType
17  {
18  enum Values
19  {
20  None = 0,
21  Exclusive, // Vehicle cannot travel on the road classes in the filter list
22  Inclusive, // Vehicle can only travel on the road clases in the filter list
23  Count // Invalid value, just used to tell the number of different enum values
24  };
25  }
26 
28  {
29  TrafficSimulationRoadClassFilter() : FilterType(FunctionalRoadClassFilterType::None) {}
30 
31  std::vector<Resources::Roads::FunctionalRoadClass::Type> FilterList;
32  FunctionalRoadClassFilterType::Values FilterType;
33 
34  //Needed to deserialize from the manifest
35  static const char* FunctionalRoadClassFilterTypeStrings[];
36 
37  bool CanUseFunctionalRoadClass(Resources::Roads::FunctionalRoadClass::Type roadClass) const
38  {
39  if(FilterType == FunctionalRoadClassFilterType::None)
40  {
41  return true;
42  }
43 
44  std::vector<Resources::Roads::FunctionalRoadClass::Type>::const_iterator iterator = std::find(FilterList.begin(), FilterList.end(), roadClass);
45  if( (FilterType == FunctionalRoadClassFilterType::Exclusive && iterator == FilterList.end()) ||
46  (FilterType == FunctionalRoadClassFilterType::Inclusive && iterator != FilterList.end()) )
47  {
48  return true;
49  }
50 
51  return false;
52  }
53 
54  };
55 
57  {
58  TrafficSimulationVehicleConfiguration(std::string name, std::string modelNode, float speed)
59  : Name(name)
60  , ModelNode(modelNode)
61  , EngineNodeLength(Eegeo::Traffic::TRAIN_CARRIAGE_SEPARATION)
62  , CarriageNode("")
63  , CarriageNodeLength(Eegeo::Traffic::TRAIN_CARRIAGE_SEPARATION)
64  , TailNode("")
65  , TailNodeLength(Eegeo::Traffic::TRAIN_CARRIAGE_SEPARATION)
66  , MinCarriageCount(0)
67  , MaxCarriageCount(0)
68  , Speed(speed)
69  , Scale(1.0f)
70  , SpawnWeighting(1.0f)
71  , FunctionalRoadClassFilter(TrafficSimulationRoadClassFilter())
72  {
73  }
74 
75  std::string Name;
76  std::string ModelNode;
77  float EngineNodeLength;
78  std::string CarriageNode;
79  float CarriageNodeLength;
80  std::string TailNode;
81  float TailNodeLength;
82 
83  int MinCarriageCount;
84  int MaxCarriageCount;
85 
86  float Speed;
87  float Scale;
88 
89  float SpawnWeighting;
90 
91  TrafficSimulationRoadClassFilter FunctionalRoadClassFilter;
92 
93  };
94 
101  {
102  public:
103 
105  : DrivesOnRight(true)
106  , MinimumDistanceBetweenSpawns(0)
107  , SpawnChancePerCell(1)
108  {
109  }
110 
111  std::string Name;
112  bool DrivesOnRight;
113  std::string VehiclesBasePodFile;
114  std::vector<TrafficSimulationVehicleConfiguration> Vehicles;
115 
116  float MinimumDistanceBetweenSpawns;
117  float SpawnChancePerCell;
118 
119  // Define state textures?
120  };
121  }
122  }
123 }