当前位置: 首页>>代码示例>>C++>>正文


C++ CField::GetPercentOfCarRoad方法代码示例

本文整理汇总了C++中CField::GetPercentOfCarRoad方法的典型用法代码示例。如果您正苦于以下问题:C++ CField::GetPercentOfCarRoad方法的具体用法?C++ CField::GetPercentOfCarRoad怎么用?C++ CField::GetPercentOfCarRoad使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在CField的用法示例。


在下文中一共展示了CField::GetPercentOfCarRoad方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ProcessModel

void CNature::ProcessModel(CView *pEngine)
{
    CField *pField = static_cast<CTrafficLightDoc *>(pEngine->GetDocument())->GetField();

    m_pOptimalTLight->SetNumbersOfLines(pField->GetNCarLines(), pField->GetNHumanLines());

    CCarStreamDisctrib *pCarDistrib = new CCarStreamDisctrib();

    Days day = Monday;
    int time = 0;
    Weather weather = Sunny;
    TrafficLightType TLightType = Smart;

    int roadLen1 = pField->GetXMax()*(1-pField->GetPercentOfPedestrianCrossing()); 
    int roadLen2 = pField->GetYMax()*(1-pField->GetPercentOfCarRoad());

    m_pOptimalTLight->TeachYourSelf(m_SpeedHumanAppearance, m_SpeedCarAppearance, roadLen1, roadLen2);

    while (true)
    {
	if (m_Paused)
	{
	    while (m_Paused)
	    {
		Sleep(100);
	    };

	    pField->DeleteAllMO();

	    if (pInfoPanel != NULL)
	    {
		int Hours;
		int Minutes;
		day = pInfoPanel->GetDay();
		pInfoPanel->GetTime(Hours, Minutes);
		GetTicsByTime(Hours, Minutes, time);
		weather = pInfoPanel->GetWeather();
		TLightType = pInfoPanel->GetTrafficLightType();
	    }
	    else
	    {
		day = Monday;
		time = 0;
		weather = Sunny;
		TLightType = Smart;
	    };
	};

        for (; (day <= Sunday)&&(!m_Paused); day = static_cast<Days>(static_cast<int>(day) + 1))
        {
            float RedTime;
            float GreenTime;
            float YellowTime;

            int Counter;

            for (; (time < m_CyclesPerDay)&&(!m_Paused); time++, Counter++)
            {
		Times TypeOfTime;

		int Hours; 
		int Minutes;
		GetTimeByTics(time, Hours, Minutes);

		if ((Hours>=6)&&(Hours < 8))
		{
		    TypeOfTime = EarlyMorning;
		}
		else
		{
		    if ((Hours>=8)&&(Hours<11))
		    {
			TypeOfTime = Morning;
		    }
		    else
		    {
			if ((Hours>=11)&&(Hours<16))
			{
			    TypeOfTime = Afternoon;
			}
			else
			{
			    if ((Hours>=16)&&(Hours<21))
			    {
				TypeOfTime = Everning;
			    }
			    else
			    {
				TypeOfTime = Night;
			    };
			};
		    };
		};

                //Generate weather (obsolete, now it is setted by GUI)
                //if (time % (m_CyclesPerDay/5) == 0)
                //{
                //    weather = static_cast<Weather>(rand() % 3);
		//};
                int day1 = ((day!=Saturday)&&(day!=Sunday))?(Workday):(Holiday);
//.........这里部分代码省略.........
开发者ID:billryan,项目名称:OpenPNL,代码行数:101,代码来源:Nature.cpp


注:本文中的CField::GetPercentOfCarRoad方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。