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


C++ Origin::evaluationMode方法代码示例

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


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

示例1: process

		/**
		 * @brief Processes and modifies an event. It checks the current
		 *        location against the configured regions and sets the
		 *        type to OUTSIDE_OF_NETWORK_INTEREST if the location is not
		 *        inside in any of the regions.
		 * @param event The event to be processed
		 * @return Update flag: true, if the event has been updated, false
		 *         otherwise.
		 */
		bool process(Event *event) {
			Origin *org = Origin::Find(event->preferredOriginID());

			if ( !org ) {
				SEISCOMP_WARNING("%s: RC: no origin information",
				                 event->publicID().c_str());
				return false;
			}

			try {
				if ( org->evaluationMode() == DataModel::MANUAL ){
					SEISCOMP_DEBUG("evrc plugin found %s preferred origin %s: "
					               "do not change the event status",
					               org->evaluationMode().toString(),
					               org->publicID().c_str());
					return false;
				}
			}
			catch ( ... ) {}

			GeoCoordinate location;

			try {
				location.set(org->latitude().value(), org->longitude().value());
			}
			catch ( ... ) {
				SEISCOMP_WARNING("%s: RC: no lat/lon information available",
				                 event->publicID().c_str());
				return false;
			}

			SEISCOMP_DEBUG("%s: RC: checking regions for location %f / %f",
			               event->publicID().c_str(), location.lat, location.lon);

			OPT(EventType) currentType;

			try {
				currentType = event->type();
			}
			catch ( ... ) {}

			bool isInside = false;

			for ( size_t i = 0; i < _regions.size(); ++i ) {
				bool isInsideRegion;

				if ( _regions[i].first )
					isInsideRegion = _regions[i].first->contains(location);
				else
					isInsideRegion = true;

				if ( _regions[i].second ) {
					// Positive region
					if ( isInsideRegion ) {
						// Inside of network interest
						isInside = true;
						SEISCOMP_DEBUG("%s: RC: region '%s' matches",
						               event->publicID().c_str(),
						               (_regions[i].first ? _regions[i].first->name().c_str() : "world"));

						// If there are possible negative regions following this
						// match then continue.
						if ( !_hasNegativeRegions )
							break;
					}
				}
				else {
					// Negative region
					if ( isInsideRegion ) {
						// Outside of network interest
						isInside = false;
						SEISCOMP_DEBUG("%s: RC: region '%s' matches and it is a negative region",
						               event->publicID().c_str(),
						               (_regions[i].first ? _regions[i].first->name().c_str() : "world"));

						// Continue with checking as there might follow a positive
						// region that overrides again that result unless there
						// are only negative regions configured
						if ( !_hasPositiveRegions )
							break;
					}
				}
			}

			if ( !isInside ) {
				if ( !currentType || (currentType && *currentType != OUTSIDE_OF_NETWORK_INTEREST) ) {
					SEISCOMP_DEBUG("%s: RC: event is out of network interest",
					               event->publicID().c_str());
					event->setType(EventType(OUTSIDE_OF_NETWORK_INTEREST));
					return true;
				}
//.........这里部分代码省略.........
开发者ID:SeisComP3,项目名称:seiscomp3,代码行数:101,代码来源:regioncheck.cpp


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