00001 // ConfigData.h: interface for the CConfigData class. 00002 // 00004 00005 #if !defined(AFX_CONFIGDATA_H__F17D3AEB_F9C5_4B29_A869_E50D84EA9B0A__INCLUDED_) 00006 #define AFX_CONFIGDATA_H__F17D3AEB_F9C5_4B29_A869_E50D84EA9B0A__INCLUDED_ 00007 00008 #if _MSC_VER > 1000 00009 #pragma once 00010 #endif // _MSC_VER > 1000 00011 00012 #include "stdafx.h" 00013 #include "CSVParse.h" 00014 00017 class CConfigData 00018 { 00019 public: 00020 void SetDefaults(); 00021 CConfigData(); 00022 virtual ~CConfigData(); 00023 00024 bool ReadData(std::string inFile); 00025 00026 // General IDM Parameters 00027 struct IDM_Config 00028 { 00029 double LANECHANGE_MIN_GAP; 00030 double MIN_SPACE_FOR_NEXT_VEHICLE; 00031 double SAFE_BRAKING; 00032 double T_DELAY; 00033 } IDM; 00034 00035 // Road stuff 00036 struct Road_Config 00037 { 00038 int ROAD_END_BUFFER; 00039 00040 struct RoadFeatures_Config 00041 { 00042 int MAX_NO_ROAD_FEATURES; 00043 00044 // Speed limit info 00045 struct SpeedLimit_Config 00046 { 00047 int SPEEDLIMIT_MIN; 00048 int SPEEDLIMIT_MAX; 00049 } SpeedLimit; 00050 00051 // Constants for how Gradient affects vehicles 00052 struct Gradient_Config 00053 { 00054 int MAX_SLOPE; 00055 struct IDM_Param_Modifiers 00056 { 00057 double T_SLOPE; 00058 double V0_SLOPE; 00059 double V0_MIN; 00060 double A_MIN; 00061 bool A_FLAG; 00062 bool B_FLAG; 00063 } IDM_Modifiers; 00064 } Gradient; 00065 } RoadFeatures; 00066 } Road; 00067 00068 // Time output constants 00069 struct Time_Config 00070 { 00071 int MTS_PER_YR; 00072 int DAYS_PER_MT; 00073 } Time; 00074 00075 // Truck identification constants 00076 struct VehicleID_Config 00077 { 00078 int TRUCK_WEIGHT_THRESHOLD; 00079 int SMALL_TRUCK_NO_AXLES; 00080 int CRANE_MAX_SPACING; 00081 double CRANE_AVERAGE_SPACING; 00082 double LOWLOADER_MIN_MAX_SPACING; 00083 } VehicleID; 00084 00085 // Screen parameters 00086 struct View_Config 00087 { 00088 // Viewing 00089 double MIN_VIEW_SCALE; 00090 double DATATIP_DELAY; 00091 // Colours for vehicles 00092 struct View_Colours 00093 { 00094 struct Col_Vehicles 00095 { 00096 COLORREF VEH_COLOR_CAR; 00097 COLORREF VEH_COLOR_SMALLTRUCK; 00098 COLORREF VEH_COLOR_LARGETRUCK; 00099 COLORREF VEH_COLOR_CRANE; 00100 COLORREF VEH_COLOR_LOWLOADER; 00101 } Vehicles; 00102 00103 // Colours for elements 00104 struct Col_DrawElements 00105 { 00106 COLORREF CLR_BACKGRND; 00107 COLORREF CLR_ROAD_SURFACE; 00108 COLORREF CLR_ROAD_LINES; 00109 COLORREF CLR_RULER_LINES; 00110 COLORREF CLR_RULER_TEXT; 00111 COLORREF CLR_LEGEND_TEXT; 00112 COLORREF CLR_DET_OUTPUT; 00113 COLORREF CLR_DET_FLOWDENSITY; 00114 COLORREF CLR_DET_HEADWAY; 00115 COLORREF CLR_DET_COMPOSITION; 00116 COLORREF CLR_FEAT_SPEEDLIMIT; 00117 COLORREF CLR_FEAT_GRADIENT; 00118 } DrawElements; 00119 } Colours; 00120 } View; 00121 00122 private: 00123 void ExtractData(); 00124 COLORREF stringToColour(string line); 00125 string m_CommentString; 00126 string GetNextDataLine(); 00127 CCSVParse m_CSV; 00128 double stringToDouble(string line); 00129 int stringToInt(string line); 00130 bool stringToBool(string line); 00131 }; 00132 00133 #endif // !defined(AFX_CONFIGDATA_H__F17D3AEB_F9C5_4B29_A869_E50D84EA9B0A__INCLUDED_) 00134 00135 00136