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


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

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


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

示例1: updateChild

// >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
bool EventParameters::updateChild(Object* child) {
	Pick* pickChild = Pick::Cast(child);
	if ( pickChild != NULL ) {
		Pick* pickElement
			= Pick::Cast(PublicObject::Find(pickChild->publicID()));
		if ( pickElement && pickElement->parent() == this ) {
			*pickElement = *pickChild;
			return true;
		}
		return false;
	}

	Amplitude* amplitudeChild = Amplitude::Cast(child);
	if ( amplitudeChild != NULL ) {
		Amplitude* amplitudeElement
			= Amplitude::Cast(PublicObject::Find(amplitudeChild->publicID()));
		if ( amplitudeElement && amplitudeElement->parent() == this ) {
			*amplitudeElement = *amplitudeChild;
			return true;
		}
		return false;
	}

	Reading* readingChild = Reading::Cast(child);
	if ( readingChild != NULL ) {
		Reading* readingElement
			= Reading::Cast(PublicObject::Find(readingChild->publicID()));
		if ( readingElement && readingElement->parent() == this ) {
			*readingElement = *readingChild;
			return true;
		}
		return false;
	}

	Origin* originChild = Origin::Cast(child);
	if ( originChild != NULL ) {
		Origin* originElement
			= Origin::Cast(PublicObject::Find(originChild->publicID()));
		if ( originElement && originElement->parent() == this ) {
			*originElement = *originChild;
			return true;
		}
		return false;
	}

	FocalMechanism* focalMechanismChild = FocalMechanism::Cast(child);
	if ( focalMechanismChild != NULL ) {
		FocalMechanism* focalMechanismElement
			= FocalMechanism::Cast(PublicObject::Find(focalMechanismChild->publicID()));
		if ( focalMechanismElement && focalMechanismElement->parent() == this ) {
			*focalMechanismElement = *focalMechanismChild;
			return true;
		}
		return false;
	}

	Event* eventChild = Event::Cast(child);
	if ( eventChild != NULL ) {
		Event* eventElement
			= Event::Cast(PublicObject::Find(eventChild->publicID()));
		if ( eventElement && eventElement->parent() == this ) {
			*eventElement = *eventChild;
			return true;
		}
		return false;
	}

	return false;
}
开发者ID:salichon,项目名称:seiscomp3,代码行数:70,代码来源:eventparameters.cpp

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