00001 // RoadFeature.cpp: implementation of the CRoadFeature class. 00002 // 00004 00005 #include "stdafx.h" 00006 #include "EvolveTraffic.h" 00007 #include "RoadFeature.h" 00008 00009 #ifdef _DEBUG 00010 #undef THIS_FILE 00011 static char THIS_FILE[]=__FILE__; 00012 #define new DEBUG_NEW 00013 #endif 00014 00016 // Construction/Destruction 00018 00019 IMPLEMENT_SERIAL (CRoadFeature, CObject, VERSION_NUMBER) 00020 00021 CRoadFeature::CRoadFeature() 00022 { 00023 m_Type = FEAT_SPEEDLIMIT; 00024 m_DirPos = true; 00025 m_Start = 0; 00026 m_End = 1000; 00027 m_Value = 41.7; // in m/s - about 150 km/h! 00028 } 00029 00030 CRoadFeature::~CRoadFeature() 00031 { 00032 00033 } 00034 00035 void CRoadFeature::Serialize(CArchive &ar) 00036 { 00037 if (ar.IsStoring()) 00038 { 00039 ar << m_Type 00040 << static_cast<int>(m_DirPos) // because I read in an int below 00041 << m_Start 00042 << m_End 00043 << m_Value; 00044 } 00045 else 00046 { 00047 int temp; 00048 ar >> m_Type 00049 >> temp 00050 >> m_Start 00051 >> m_End 00052 >> m_Value; 00053 00054 m_DirPos = temp == 0 ? false : true; 00055 } 00056 } 00057 00058 WORD CRoadFeature::getType() 00059 { 00060 return m_Type; 00061 } 00062 00063 bool CRoadFeature::getDirPos() 00064 { 00065 return m_DirPos; 00066 } 00067 00068 int CRoadFeature::getStart() 00069 { 00070 return m_Start; 00071 } 00072 00073 int CRoadFeature::getEnd() 00074 { 00075 return m_End; 00076 } 00077 00078 double CRoadFeature::getValue() 00079 { 00080 return m_Value; 00081 } 00082 00083 void CRoadFeature::setType(WORD type) 00084 { 00085 m_Type = type; 00086 } 00087 00088 void CRoadFeature::setDirPos(bool dirpos) 00089 { 00090 m_DirPos = dirpos; 00091 } 00092 00093 void CRoadFeature::setStart(int start) 00094 { 00095 m_Start = start; 00096 } 00097 00098 void CRoadFeature::setEnd(int end) 00099 { 00100 m_End = end; 00101 } 00102 00103 void CRoadFeature::setValue(double val) 00104 { 00105 m_Value = val; 00106 } 00107 00108 00109 00110 00111