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


C++ ParametersMap::merge方法代码示例

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


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

示例1: run

		util::ParametersMap PTRouteDetailFunction::run(ostream& stream, const Request& request) const
		{
			const CommercialLine * commercialLine(_journeyPattern->getCommercialLine());

			ParametersMap m;

			// Properties
			m.insert(DATA_ID, _journeyPattern->getKey());
			m.insert(DATA_NAME, _journeyPattern->getName());
			m.insert(DATA_IS_MAIN, _journeyPattern->getMain());
			m.insert(DATA_LINE_ID, commercialLine->getKey());
			m.insert(DATA_LINE_NAME, commercialLine->getName());
			m.insert(DATA_LINE_SHORT_NAME, commercialLine->getShortName());
			m.insert(DATA_LINE_LONG_NAME, commercialLine->getLongName());
			m.insert(DATA_LINE_IMAGE, commercialLine->getImage());
			m.insert(DATA_LINE_STYLE, commercialLine->getStyle());
			if(commercialLine->getColor())
			{
				m.insert(DATA_LINE_COLOR, commercialLine->getColor()->toXMLColor());
			}
			m.insert(
				DATA_DIRECTION,
				_journeyPattern->getDirection().empty() && _journeyPattern->getDirectionObj() ?
					_journeyPattern->getDirectionObj()->getDisplayedText() :
					_journeyPattern->getDirection()
			);

			// Edges
			const StopArea* lastConnPlace(NULL);
			BOOST_FOREACH(const Edge* edge, _journeyPattern->getAllEdges())
			{
				if(	(!edge->isDepartureAllowed() || !_displayDepartureStops) &&
					(!edge->isArrivalAllowed() || !_displayArrivalStops)
				){
					continue;
				}

				const StopPoint* stopPoint(static_cast<const StopPoint *>(edge->getFromVertex()));
				const StopArea* connPlace(stopPoint->getConnectionPlace());

				// Display same stop area once
				if(_displaySameStopAreaOnce && connPlace == lastConnPlace)
				{
					continue;
				}
				lastConnPlace = connPlace;
				const LineStop* lineStop(static_cast<const LineStop*>(edge));

				boost::shared_ptr<ParametersMap> sm(new ParametersMap);
				sm->insert(DATA_ID, stopPoint->getKey());
				sm->insert(DATA_RANK, edge->getRankInPath());
				sm->insert(DATA_DEPARTURE_IS_ALLOWED, edge->isDepartureAllowed());
				sm->insert(DATA_ARRIVAL_IS_ALLOWED, edge->isArrivalAllowed());
				sm->insert(DATA_WITH_SCHEDULES, lineStop->getScheduleInput());
				sm->insert(DATA_RESERVATION_NEEDED, lineStop->getReservationNeeded());
				sm->insert(DATA_NAME, stopPoint->getName());
				sm->insert(DATA_OPERATOR_CODE, stopPoint->getCodeBySources());
				sm->insert(DATA_STOP_AREA_ID, connPlace->getKey());
				sm->insert(DATA_STOP_AREA_NAME, connPlace->getName());
				sm->insert(DATA_CITY_ID, connPlace->getCity()->getKey());
				sm->insert(DATA_CITY_NAME, connPlace->getCity()->getName());
				sm->insert(DATA_DIRECTION_ALIAS, connPlace->getName26());
				if(_service.get())
				{
					if(edge->isDepartureAllowed())
					{
						sm->insert(DATA_DEPARTURE_TIME, to_simple_string(Service::GetTimeOfDay(_service->getDepartureSchedule(false, edge->getRankInPath()))));
					}
					if(edge->isArrivalAllowed())
					{
						sm->insert(DATA_ARRIVAL_TIME, to_simple_string(Service::GetTimeOfDay(_service->getArrivalSchedule(false, edge->getRankInPath()))));
					}
				}

				m.insert(TAG_STOP, sm);
			}


			// CMS Display
			if(_mainPage.get())
			{
				// Template parameters
				m.merge(getTemplateParameters());

				// Stops
				if(_stopPage.get())
				{
					stringstream s;
					BOOST_FOREACH(const boost::shared_ptr<ParametersMap>& item, m.getSubMaps(TAG_STOP))
					{
						item->merge(getTemplateParameters());

						_stopPage->display(s, request, *item);
					}
					m.insert(DATA_STOPS, s.str());
				}
开发者ID:Tisseo,项目名称:synthese,代码行数:96,代码来源:PTRouteDetailFunction.cpp


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